LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array of buttons and Event Structure

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.

0 Kudos
Message 1 of 23
(6,725 Views)

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

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 23
(6,709 Views)

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:

  • Use a text input box. I am pretty sure that the average operator can type "PUSH" faster than find a button among thousands.
  • Use one (or a few) list box(es) containing the commands and the user can then simply click on the desired line.
  • Use a 2D array of a cluster containing a string and a button, the string would contain the command and the button would trigger it (make the string disabled). In the event, find the elelment that is different by comparing old and new values and read the corresponding string value.
0 Kudos
Message 3 of 23
(6,703 Views)

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,

Download All
0 Kudos
Message 4 of 23
(6,688 Views)
Can you explain your project a little more?  Not what you have tried but more what your true end goal is.
 
What I understood was that you have a bunch of different keyboards that you are trying to mimic on the Front Panel.  Each keyboard has different meaning behind the different buttons, so you are trying to figure out how to handle them, is that correct?
 
What is the maximium nunber of buttons on the keyboards?  In addition you can change the caption and boolean text, so maybe you just need one set that you create, and then you can just change the text as you need to.  In your code you could have a look-up table of sorts that lets you know hey if I am in keyboard 1 and they hit key 5 that mean X.
 
Of course reading that solution doesn't sound that great to me either, so maybe as I understand the end goal we can come at it from a totalyy differnt and easier way.
0 Kudos
Message 5 of 23
(6,679 Views)

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.  

0 Kudos
Message 6 of 23
(6,679 Views)
OK, use a picture indicator, get the key-down coordinates and then accordingly index into a lookup table containing all desired output strings. 🙂
 
If the keyboard changes, redraw the image with boxes and text strings acccording to the currently active lookup table.
Message 7 of 23
(6,667 Views)

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

 

 

0 Kudos
Message 8 of 23
(6,664 Views)
Do you mean, with out the clicking the button?  Do you mean, we are not going to use push button at all? 
0 Kudos
Message 9 of 23
(6,668 Views)
One idea that comes to mind:

Picture control.

You could easily store the text and key code of each button inside an array string.

The load a button-look-a-like bmp, save this into the picture control and place the text over the bmp, store, the key code and coordinates of the button inside two arrays.
When their is a mouse-down event use vi.lib\picture\PictureSupport.llb\pointinrect.vi, to detect in which rectangle the event was, look up the accompaning key code and output that.
Good luck!

edit:
Altenbach you need to start type slower, we don't stand a chance

Ton

Message Edited by TonP on 01-25-2007 08:58 PM

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 10 of 23
(6,673 Views)