I have a form with a tabbed subform for my customer data. On the from next to the subform i have a series of buttons. Is there any was to Enable/Disable these buttons depending on which tab on the subform has focus?
Beau
I have a form with a tabbed subform for my customer data. On the from next to the subform i have a series of buttons. Is there any was to Enable/Disable these buttons depending on which tab on the subform has focus?
Beau
Try looking at conditional objects or I believe you can control object properties using xbasic. I'd like to give you the full solution but I am new to A5 and although I have read the help files on these subjects I have yet to use them.
I am pretty sure that the conditional objects hide certain objects on the from due to a condition. I only want to disable the button not hide it. I am only a newbie myself and dont know much about xbasic. Thanks for the thought.
beau
Beau, I think you could use the OnTabChange event for the tabbed object to enable or disable the button controls. You'd do this by running either the .enable() or .disable() method for each button object. The OnTabChange script would figure out which tab had focus and then run the appropriate button control method for each button. Check the help file explanation for both events and methods applicable to Tabbed Control (form); and then the discussioin of methods for the Button Control (form).
Last edited by Tom Cone Jr; 02-08-2007 at 09:08 AM. Reason: correcting mistakes
In the help file under button properties it gives the following xbasic reference.
Hide - :formname.controlname.object.visible as L
(When checked the button becomes invisible.)
There is also an action script function under object properties(set/get) to hide and show objects.
Beau,
I would use the following for using the OnTabChange event. Sheets simply refer to the tabs and how many depend on how many tabs of course. The button number suffix can be seen in the object's properties. Modify to whatever you have and want.
MikeCode:sheet = topparent:TABBED1.tab_get() t=table.current() if sheet=1 then button1.disable() button2.disable() button3.enable() elseif sheet=2 then button1.disable() button2.enable() button3.disable() elseif sheet=3 then button1.enable() button2.disable() button3.disable() end if topparent.resynch()
Hi Mike,
Your solution works well, thanks for the info. Is there anyway to grey the button out at the same time so people know it can't be used?
Thanks,
Beau
Beau,
Within the code you use you can set whatever properties you want---check out the "Object Explorer" to find all the properites and such of each object. I wish someone told me about this when I first started! I spent a month trying to figure out how everyone but me knew what everything was called!
Experiment in the button properties to see what combination suits you for graying out something--once you find the color and transparency you want simply set them with the script.
Mike
Edit: This current thread shows a few of the properties you can set. Just thought to throw this your way.
http://msgboard.alphasoftware.com/al...ad.php?t=58535
Last edited by MikeC; 02-08-2007 at 10:09 PM. Reason: more info
Thanks for the help Mike, had a look and found what i needed to change the font color with the xbasic. My only problem is with the script is that when i first open the form it does not know that it is on sheet1 and does not disable the buttons until i goto another tab and back again.
Beau
Ok then i fixed this by adding this code to the OnActivate event for the form.
Thanks for the help.sheet = topparent:CustomerTabbed.tab_get()
t=table.current()
button2.disable()
button2.font.color="Gray-40"
button6.disable()
button6.font.color="Gray-40"
topparent.resynch()
Beau
Beau,
I couldn't get on the messageboard this am as must have been down but exactly as what I would have suggested! Good job! :) Just remember, almost any question you may have most likely has been answered somewhere on this messageboard...just a matter of figuring out how to do searches is all (which sometimes is harder than the actual programming! ).
MIke
Bookmarks