From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

focus on clicked element - GUI

Solved!
Go to solution

Hello,

 

I have some form that user will fill that has many string and enum controlls, more than 40.

User wil tab and fill one by one. I want to set focus on controll when user clicks on it.

 

I don't want to make more than 40 event cases and service each control in separate way.

My another idea is to get refs and positions of all controls on FP, then monitor mouse click event on FP, get click position and then search for that controll.

But maybe there is more elegant way that I am not aware of ?

 

0 Kudos
Message 1 of 7
(2,959 Views)
Solution
Accepted by topic author pawhan11

Hey Pawhan11,

 

You could place all references in an Array and register for an mouse down event. In an eventstructure use the Dynamic Event to modifyy the enum you clicked.

EventFocus.png

 

Regards,

CMW

0 Kudos
Message 2 of 7
(2,954 Views)

Even 40 controls is bit high only. Do you have controls of similar data type? If yes why don't you try to create an array out of it and use the event?

-----

The best solution is the one you find it by yourself
0 Kudos
Message 3 of 7
(2,944 Views)

I thinked about that but it is end user interface and it has to look nice and with array it is not possible.

Yes controlls will have the same type, string or enum.

 

I think many controlls is acceptable in that case. We only fill these values, print that and forget about them...

0 Kudos
Message 4 of 7
(2,934 Views)

Thanks Member CMW..

 

I tried dynamic event but I registered all events in separate way  and it didn't worked  like I wanted 😄

You'r code makes it 🙂

Big thanks! , problem solved

0 Kudos
Message 5 of 7
(2,928 Views)

Looking nice really depends on how you use the Tools palette to make the arrays better.

 

Sample Array Controls

 

Array.png

-----

The best solution is the one you find it by yourself
0 Kudos
Message 6 of 7
(2,924 Views)

I know but this form fields have to be placed in many many diffrent places - like that :

 

gui.JPG

 

And belive me - this was not my idea 😄

 

This form has to be saved to pdf and printed. So I wanted to use exaprom pdf addon. But there was problem in creating table with so many fields in different places ( cells had to be added one by one with diffrent colspan and border type...  and that would take ages) So I put every page on invisible tab controll and printed that tab as an image to pdf. Text is not as vector but as image. The best part of it is that quality of that was acceptable 😄 😄

0 Kudos
Message 7 of 7
(2,916 Views)