01-25-2007 11:21 AM
I have a the same problem... I was wondering if you were able to find a soln.
I have literally thousands of buttons and each button as a unique key code and unique name.
For Example :
Button Name – Key code #
PUSH - 1
POP - 2
PULL - 3
…
The way I program this simple algorithm is deadly painful.
1) I create 1000 buttons by going to control->buttons.
2) Then I have to go through one by one to change the Boolean text to “PUSH,POP,PULL…”
3) Then used the Event Structure, adding in all the controls names “PUSH, POP, PULL..” In side each event, I placed the key codes “1,2,3..”
I have search and tried for weeks to find a better way, and still nothing comes to mind.
Please help.
01-25-2007 11:56 AM
Hi greenTea_clare,
I noticed you posted this same Q in this old thread
http://forums.ni.com/ni/board/message?board.id=170&message.id=159387&jump=true
I am not sure what you are attempting to accomplish.
Could please post the "simple" code example that shows us what you have done by hand.
We can then look at that and may be able to offer suggestions.
Trying to help,
Ben
01-25-2007 12:26 PM
Well, don't use 1000s of buttons. This is a UI useability and code nightmare. Is this for a regular computer or for e.g. a touchpanel interface?
Some ideas:
01-25-2007 01:32 PM
Hi Ben,
Thank you for your reply, I have attached my try_code and a picture of the code I currently have. I am new in Labview, but I am confident that, there must be a easier way to make an array of buttons with different button name and an associated number to that button.
The 1st file, is to show you want I am currently doing, (painful)
The 2nd file attached is some of the things i tried, I had great hope with my try_code, array_jan25. But I couldn't get it. I think I am very close.
Thanks again,
01-25-2007 01:41 PM
01-25-2007 01:42 PM
Hi altenbach
Thank you for the suggestions. I have an design requirement that I must follow. I have to have the keyboard, looking just like a keyboard.
It can't be typed in as a string, (which would truely be easier by using enum). Because, there are short keys, such as SETPT (SET POINT), RDPWR(READ POWER)... the user will not be able to remember all the short key. Some button names are very long. ie power step to low range.
A string with button in cluster can't be used as well. I need to have the keyname on the button. Disable the string and put it on top of the button may cause trouble to click on the button.
List box can't be used, because it will not meet the GUI design requirement, it has to be a keyboard.
Sorry to shoot your ideas down, but I have gone through all those possibalities.
01-25-2007 01:50 PM
01-25-2007 01:53 PM
Hi Evan,
The concept it self is quite simple. I will list them as an design requirement to explain the project better.
1) There are 15 keyboards in total.
2) each keyboard has 30-50 buttons, differe depending and the keyboard.
3) each button has a key code #, so that when a button on a keyboard is pressed, this key code # is passed to the next modual.
my solution starting with keyboard1.
1) draw out 30 buttons.
2) go to button properity and change boolean text to the name of the button
3) accourding to the name of the button, add it as an event in a event sturcture, activate upon value change.
4) In each event structure, type in the keycode coorsponding to the event (a button name).
So that, when a button is pressed, that button's event will active and pass out the keycode.
Thats all.
I don't like the way I am doing it, because, this means I have to do the above for all 15 keyboards. Its not good code keeping having all those button in the block diagram either.
I am not sure if I explained it clearly.. its really simple concept.. but some how unachieveable.
Liz
01-25-2007 01:55 PM
01-25-2007 01:57 PM - edited 01-25-2007 01:57 PM
Message Edited by TonP on 01-25-2007 08:58 PM