Armed Buttons

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
xclntdesign
Posts: 34
Joined: Sun Feb 06, 2011 8:33 pm

Armed Buttons

Post by xclntdesign » Tue Mar 29, 2011 4:47 pm

I am trying to arm a button using the following code:

Code: Select all

set the armed of button btnToArm of stack mainProgram to true
And it doesn't work as I expected, unless I am reading the Dictionary wrong. What this code does for me is it changes to the Armed icon only after I move the mouse over the button, and when I move my mouse off the button, it stays armed. What I need it to do is show the Armed icon as soon as that line is processed.
I've tried autoArm, and that didn't seem to make any difference.
Can anyone help?

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: Armed Buttons

Post by BvG » Tue Mar 29, 2011 9:52 pm

The armed should happen automatically whenever you interact with a menu. For other buttons, you might want to use the hilite or maybe mouseEnter/Leave, or simply the hoverIcon, I guess? So it depends on why you are actually doing this and when and for what, respectively with what message and for what goal you trigger it?
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: Armed Buttons

Post by dunbarx » Wed Mar 30, 2011 3:01 am

I also don't know what you have in mind, but to test, why not put these in the button script:

on mouseEnter
set the armed of me to "true"
end mouseEnter

on mouseLeave
set the armed of me to "false"
end mouseLeave

At least you can see what changes. You need to have an armedIcon and a hoverIcon.

xclntdesign
Posts: 34
Joined: Sun Feb 06, 2011 8:33 pm

Re: Armed Buttons

Post by xclntdesign » Thu Apr 07, 2011 3:12 pm

Probably should've elaborated more in my original post.

I have setup an interface that is supposed to function like tabs, but with icons instead of text. When the program loads, I want to set the default "tab" as visible and its icon to the Armed state.

I have set both the Armed and Hover Icons to the same icon, and the Hover part works.

I have tried the MouseEnter and MouseLeave functions and they did not function as I needed, my fault for not explaining better.

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Armed Buttons

Post by Klaus » Thu Apr 07, 2011 3:26 pm

Hi xclntdesign,

hmm, I never understood the meaning of this property, except when using STACKS as popup menus. :D

Can't you just:
1. Group all of your buttons into a "radiobutton" group!
This way you will not need to manage the hilite icons and you can use all the groups "hilitedbutton" stuff etc. in your scripts!
Know what I mean? This will act just like a "simple" "radiobutton" group with custom icons!

2. Use hover icons instead of armed icons, so you will not need to script the icon change "on mouseenter/mouseleave"!

But maybe I do not understand your problem :D


Best

Klaus

xclntdesign
Posts: 34
Joined: Sun Feb 06, 2011 8:33 pm

Re: Armed Buttons

Post by xclntdesign » Thu Apr 07, 2011 3:58 pm

Maybe this pic will help.

Basically, the Menu icons control what is displayed in the Content Area. When the program starts, I want to change the icon for the Invoice button from the Normal state (shown) to the Armed state. I have to do it with code, because the very first time the program is run, the Settings button needs to be selected.
Attachments
PC_Screen03_HomeScreen.jpg
PC_Screen03_HomeScreen.jpg (78.67 KiB) Viewed 4241 times

Post Reply