Jump to content
Sign in to follow this  
tamir

global

Recommended Posts

i have a function that counts something and use "for" loop to assign number of vars (he number is the count result).

i don't know how many vars i will get so i used "for" loop that does something like this:

For $i=1 To $count
   Assign("var" & $i, $sometext)
Next

but since this code is in a function, the vars only declared in the function itself, and i can't use them in other functions, so i wanted to use Global for each var in the func.

how do i do that? or r there any other ways to global these vars?

Share this post


Link to post
Share on other sites

There is no something to put a by defaut all variables as global. But you can force the assign variable to be global

Assign("var" & $i, $sometext,   2   )
:lmao:

Share this post


Link to post
Share on other sites

hmm i used the assign as u said, and in other func i did:

For $a=0 To $count
   $tmp = Eval("var" & $a)
   _ArrayDisplay($tmp)
Next

but it isn't working, why?

Edited by tamir

Share this post


Link to post
Share on other sites

hmm i used the assign as u said, and in other func i did:

For $a=0 To $count
   $tmp = Eval("var" & $a)
   _ArrayDisplay($tmp)
Next

but it isn't working, why?

<{POST_SNAPBACK}>

Tamir,

In your first code you started with 1, so that would give: var1, var2, etc.

In this code you started with 0, but "var0" has not been assigned anything.

Regards,

-Sven

Share this post


Link to post
Share on other sites

in my script i started from 1, i didn't copy it right...

so what is the problem? :/

nvm, it suddenly worked :lmao:

Edited by tamir

Share this post


Link to post
Share on other sites

another question:

how do i disable the writing on the gui combo?

<{POST_SNAPBACK}>

I am not sure to understand who is writing what.

can you give a small example that' reproduce your problem?

Thanks

Share this post


Link to post
Share on other sites

when i create a combo and put some options, if u choose an option u can edit it (u can type new name but it wont save), i wat it to be read-only...

Share this post


Link to post
Share on other sites

thanks josbe :lmao:

and can i know what each number that i give to $CBS_DROPDOWNLIST does?

is it written somewhere?

Share this post


Link to post
Share on other sites

thanks josbe :lmao:

and can i know what each number that i give to $CBS_DROPDOWNLIST does?

is it written somewhere?

<{POST_SNAPBACK}>

$CBS_DROPDOWNLIST = 0x0003, Displays a static text field that displays the current selection in the list box.

GUI Control Styles in the helpfile.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...