Jump to content

Using external variables in function


Recommended Posts

Hi all,

This might be a very dumb question, but I just can't figure out how to get it working.

I start out creating a button:

$Button = GUICtrlCreateButton("My button",0,0)oÝ÷ Ø  Ýiû§rب«­¢+ÙչѥÙÑ   ±±½½¸ ¤(  ±±½½¹Q¥À ÀÌØí    ÕÑѽ¸°ÅÕ½Ðí!±±¼ÅÕ½Ðì°U%
ÑɱI ÀÌØí    ÕÑѽ¸¤¤)¹Õ¹ìôôÐíÑ¥ÙÑ ±±½½¸oÝ÷ Ø  Ý¡÷(º»¶jYh¢tâ¥û§rب«­¢+ÙÕ¹   ±±½½¹Q¥À ÀÌØí    ±±½½¹YÈÄ°ÀÌØí   ±±½½¹YÈÈ°ÀÌØí   ±±½½¹YÈ̤(U%
ÑɱMÑQ¥À ÀÌØí ±±½½¹YÈÄ°ÀÌØí   ±±½½¹YÈÈ°ÀÌØí   ±±½½¹YÈÌ°À°Ì¤)¹Õ¹ìôôÐí  ±±½½¹Q¥ÀoÝ÷ Ø Ý¶®º+jëh×6==> Variable used without being declared.: 
BalloonTip($Button, "Hello", GUICtrlRead($Button)) 
BalloonTip(^ ERROR

How can I get this working?

Thanks,

Sven

Edited by svennie
Sorry for my English, I'm Dutch... =DMedia UDFINet Adv UDF
Link to comment
Share on other sites

add

Dim $Button

somewhere on your main script (my guess is you've been creating this button inside a function -> the error you got when trying to use it inside another function)

And never forget:

- if you create a variable inside a function - it will be available (known) only inside that function

- if you create a variable in the main script - it will be available (known) everywhere

Also - look at variable help

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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...