Sign in to follow this  
Followers 0
cppman

Another Problem

4 posts in this topic

#1 ·  Posted (edited)

Okay here we go again..

Func Surface_Create($BackgroundColor)
    $SurfaceGUI = GUICreate("SurfaceGUI", 700, 700)
    Global $SurfaceColor = $BackgroundColor
    Return GUICtrlCreateGraphic(0, 0, 700, 700)
EndFunc

Im Trying to Return GUICtrlCreateGraphic(0, 0, 700, 700) and set the Background Color of it to $Background Color. How would i do this WITHIN the function, while still ONLY returning the CONTROL ID??

nvm again.. i got it:

Func Surface_Create($BackgroundColor)
    $SurfaceGUI = GUICreate("SurfaceGUI", 700, 700)
    Global $SurfaceColor = $BackgroundColor
    Dim $Array[2]
    $Array[0] = GUICtrlCreateGraphic(0, 0, 700, 700)
    $Array[1] = GUICtrlSetBkColor(-1, $BackgroundColor)
    Return $Array[0]
EndFunc
Edited by CHRIS95219

Share this post


Link to post
Share on other sites



Store it as a var, change the background color, and then return the var.

Share this post


Link to post
Share on other sites

Well I suppose you could do it that way, but you could also just have made them global vars at the top of your script and then modify them inside the func.

Share this post


Link to post
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
Sign in to follow this  
Followers 0