Jump to content
Sign in to follow this  
quick_sliver007

How do I check to see if a ctrl is used in a Gui?

Recommended Posts

How do I check to see if a ctrl is used in a Gui? What I want to do is check if a menu item is clicked. like this....

Func _checkmenuitemsave()
If menu item is clicked = true then
do this
EndIf
EndFunc

case $msg = $exit
              Call("_checkmenuitemsave")
        Exitloop

I want to check if the menu item save is clicked any time while the program is runing, so that it does something on exit if it was clicked. Please help.


.

Share this post


Link to post
Share on other sites

One way is when the menu item is clicked, trap it in the while loop and set a variable accordingly. Later, when exiting the script, check the current value of the variable to decide what steps to take.

For another method, see the example in the help file for GUICtrlCreateMenuitem and look at what is done for the menu item $viewstatusitem.


Phillip

Share this post


Link to post
Share on other sites

One way is when the menu item is clicked, trap it in the while loop and set a variable accordingly.  Later, when exiting the script, check the current value of the variable to decide what steps to take.

For another method, see the example in the help file for GUICtrlCreateMenuitem and look at what is done for the menu item $viewstatusitem.

<{POST_SNAPBACK}>

I have no ideal how to trap it and I don't think the otherway would work. But, I just had an ideal,

case msg = $save

iniwrite 1 to some where on character ini

case msg = $exit

$var = iniread where that 1 is

If $var = 1 then

do this

Else

do other

end if

exitloop

I think will try it tomorrow. All of this programing is cutting in on my sleep.

Thank you Phil, for being most helpful.


.

Share this post


Link to post
Share on other sites

I have no ideal how to trap it and I don't think the otherway would work. But, I just had an ideal,

<{POST_SNAPBACK}>

By "trap", I meant to assign the menu buttons to a variable, then in the While loop, check the value of $msg in the Select statement. If it's a menu button, assign a value to a variable so that later you will know it was clicked.

Phillip

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