Page 1 of 1

toolbar question

PostPosted: Fri Jun 26, 2015 10:01 am
by stevec
I have a simple app that I am trying to build a toolbar with several buttons grouped together , group9
I have a button that I have that I'd like to click on and open the toolbar and if I click on the button again, close it.

I have tried the IF command;

Suggestions on a better way of trying to do this?

Thanks;

Re: toolbar question

PostPosted: Fri Jun 26, 2015 10:10 am
by Neosoft Support
Maybe you could have two buttons with different icons. One button opens the toolbar and the other closes it. You can show or hide one of the two buttons depending on whether the toolbar is visible or not.

Re: toolbar question

PostPosted: Fri Jun 26, 2015 10:15 am
by stevec
Thought of that, was just trying to clean it up and have only one button.
Thanks

Re: toolbar question

PostPosted: Fri Jun 26, 2015 10:25 am
by Gaev
stevec:

I have a button that I have that I'd like to click on and open the toolbar and if I click on the button again, close it.
I have tried the IF command;

Why don't you post your code here ? ... and tell us where the code is not performing as expected.

Re: toolbar question

PostPosted: Fri Jun 26, 2015 10:40 am
by stevec
Gaev


Here is what I'm trying

If "[Group9]" "<>" "hide"
ShowObject "Group9" "None" "0"
SetVar "[Group9]" "show"
Else
If "[Group9]" "=" "show"
HideObject "Group9" "None" "0"
SetVar "[Group9]" "Hide"

EndIf

Re: toolbar question

PostPosted: Fri Jun 26, 2015 11:17 am
by Gaev
stevec:

In your publication's startup section ...
Code: Select all
ShowObject "Group9" "None" "0"
SetVar "[Group9State]" "Visible"
... or ...
Code: Select all
HideObject "Group9" "None" "0"
SetVar "[Group9State]" "Hidden"

... depending on whether you want to start with a "hidden" or "visible" state.

In the click action of your Button ...
Code: Select all
If "[Group9State]" "=" "Hidden"
   ShowObject "Group9" "None" "0"
   SetVar "[Group9State]" "Visible"
Else
   HideObject "Group9" "None" "0"
   SetVar "[Group9State]" "Hidden"
EndIf

Re: toolbar question

PostPosted: Fri Jun 26, 2015 11:32 am
by stevec
AWESOME!!!!!!!!!!!!!!!!!!!
Thanks;
:P :P :P :P :P

Re: toolbar question

PostPosted: Fri Jun 26, 2015 2:07 pm
by Tony Kroos
If you do not want to mess with object state variable and just get current status of any object use GetObjectInfo at any time

Re: toolbar question

PostPosted: Fri Jun 26, 2015 2:49 pm
by stevec
Thanks

Re: toolbar question

PostPosted: Fri Jun 26, 2015 3:00 pm
by Gaev
If you do not want to mess with object state variable and just get current status of any object use GetObjectInfo at any time

:idea: :idea: :idea: :idea:

Code: Select all
GetObjectInfo "Group9" "Visible" "[Status]"
If "[Status]" "=" "True"
   HideObject "Group9" "None" "0"
Else
   ShowObject "Group9" "None" "0"
EndIf

Re: toolbar question

PostPosted: Sat Jun 27, 2015 8:30 am
by stevec
you are the coding master! :mrgreen: :mrgreen: :mrgreen: :mrgreen: