Jump to content

How make the function return?


Recommended Posts

How do I make the function return a GUI window?

Eg.

My Function takes width and heigth and returns a GUI windiow

_Function($GUIWidth,$GUIHeigth)

But where does I place the return value?

Thank you :whistle:

Not quite sure where the problem lies... This what you mean?

#include <guiconstants.au3>

$gui = Return_A_GUI(400,380)
$ok = GUICtrlCreateButton("OK",10,10)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $ok Then Exit
WEnd
Exit

Func Return_A_GUI($w,$h)
    $guiToReturn = GUICreate("test gui",$w,$h)
    Return $guiToReturn
EndFunc

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

Not quite sure where the problem lies... This what you mean?

#include <guiconstants.au3>

$gui = Return_A_GUI(400,380)
$ok = GUICtrlCreateButton("OK",10,10)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $ok Then Exit
WEnd
Exit

Func Return_A_GUI($w,$h)
    $guiToReturn = GUICreate("test gui",$w,$h)
    Return $guiToReturn
EndFunc
Thank you :whistle:.

(I'm just used to BJASS. Funtion(takes something, returns something)

Link to comment
Share on other sites

... Doesn't this function take something and return something too?

Yes but in BJASS (Warcraft 3) you declare the vaule your function return, in the function name too.

Example:

_MyFunction(takes $GUIWidth, $GUIHeigth returns $GUIWindow)

Edited by Mr. Zero
Link to comment
Share on other sites

Yes but in BJASS (Warcraft 3) you declare the vaule your function return, in the function name too.

Quess I won't be learning to code WC3 functions anytime soon :whistle:

So anyway, problem solved now?

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...