Jump to content

Change var name to string


Miliardsto
 Share

Recommended Posts

I got that func

Func makeHelpImgGUI($title,$width,$height,$img)

$img = GUICtrlCreatePic("",20,40,$width,$height)
_ResourceSetImageToCtrl($img, "HERE")


EndFunc

and I call this func like that

makeHelpImgGUI("Image",1190, 800,$SETTINGS_JPG)

 

so what is the problem in the parameter where is - "HERE" I need value of img but passed as string

so $img = $SETTINGS_JPG and how make it "SETTINGS_JPG"

 

I tried something like that but not work

Func makeHelpImgGUI($title,$width,$height,$img)


$name_str = String($img)
$name_str = StringTrimLeft ($name_str, 1 )

$img = GUICtrlCreatePic("",20,40,$width,$height)
_ResourceSetImageToCtrl($img, $name_str)



EndFunc

 

Link to comment
Share on other sites

  • Moderators

Read it, perhaps? And "not work" is about as little information as you could possibly provide.

How about you help us help you by A: putting forth some actual effort and B: if something doesn't work, explaining what exactly you're seeing?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Can't you just pass a string to begin with and not have to worry bout converting a variable name into a string?

makeHelpImgGUI("Image",1190, 800,"SETTINGS_JPG")

Func makeHelpImgGUI($title,$width,$height,$img_name)
    $img = GUICtrlCreatePic("",20,40,$width,$height)
    _ResourceSetImageToCtrl($img, $img_name)
EndFunc

Also, you don't use the $title variable in the function you shared,  You should remove it if it is not necessary.

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

×
×
  • Create New...