Jump to content

Recommended Posts

Posted

Okay, i've been wondering how you would get a function to return its value to a variabel specified by the user...

Like: here is my UDF

Func SpriteCreate($Image, $Width, $Height, $StartX, $StartY)

GUICtrlCreatePic($Image, $StartX, $StartY, $Width, $Height)

EndFunc

I would want the user to be able to do:

$SpriteBox = SpriteCreate($Image, $Width, $Height, $StartX, $StartY)

so $SpriteBox would be the variable for GUICtrlCreatePic...

sorry, it is kind of hard for me to explain. any ideas people?

Posted (edited)

you mean something like?

Func SpriteCreate($Image, $Width, $Height, $StartX, $StartY)
    Local $controlID
    $controlID = GUICtrlCreatePic($Image, $StartX, $StartY, $Width, $Height)
    If $controlID Then
        Return $controlID
    Else
        SetError(1)
        Return 0
    EndIf
EndFunc
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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
×
×
  • Create New...