LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Text justification in Text Ring

Solved!
Go to solution

LV 2010

Win Vista

 

I have a VI with a TEXT ring, used as a channel selector.

 

My client wants to have the selected text RIGHT justified when at rest, but have the pop-up menu be LEFT justified.

 
There is only one RingText.Justification property. Whichever way it is set, the selector and the menu both obey it.

I already intercept the MOUSE DOWN? event for this control, because I adjust the order of channels displayed in the pop-up menu (based on CTRL / ALT / SHIFT keys).

 

So, I thought it would be easy to switch the RingText.Justification property in the MOUSE DOWN? event, and switch it back in the MOUSE UP event.

 

But that doesn't work. Well, the switching one way (MOUSE DOWN) works, but the other way doesn't.

 

The MOUSE UP event never gets called (unless I click on the UP/DOWN widgets, which is no help).

 

So I tried using the MOUSE LEAVE event to switch back.

 

That doesn't work either - the MOUSE LEAVE event gets triggered immediately after the MOUSE DOWN? event.

 

Those things tell me that the menu is really a separate control (in Windows terms, anyway) from the ring.  The mouse LEAVEs the ring control when the menu pops up.  And when you release the mouse button in the menu, it's the MENU, not the ring that gets a MOUSE UP.

 

The VALUE CHANGED event is no good for this: you can choose the same channel as before, or just click off, and the menu goes away without an event.

 

So, is there any way to do what I want?

 

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 1 of 6
(2,519 Views)

Probably not the most elegant but you could use two controls that have the two justifications and switch visibility of them. Clinking but it may accomplish what you want.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 6
(2,510 Views)

you could use two controls that have the two justifications and switch visibility of them.

 

Hmmm.

In the MOUSE DOWN? event, I look at the SHIFT/ALT/CTRL keys and set up the STRINGS & VALUES property to show the channels in a specific order.

In the VALUE CHANGED event, I set the STRINGS & VALUES property back to a single value (the one chosen).

(I have 800+ of these controls, so leaving each one with a copy of 200+ channel names is wasteful.)

 

So adding a switcheroo is not a big deal.

 

I'll run a test, but I don't think it will work.

 

If I react to a click on control A, and then make A invisible and B visible, B doesn't know I've clicked on it (because I haven't), so the menu won't pop up.

The MOUSE DOWN? event won't let me redirect the click to another control.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 6
(2,504 Views)
Solution
Accepted by topic author CoastalMaineBird

could use two controls that have the two justifications and switch visibility of them.

 

Well, that SORT OF works.

If I react to a click on A by making B Visible in front of A, then the menu for A pops up in front of BOTH, and I don't gain anything.

If I react to a click on A by making B visible and hiding A, then the menu DOES pop up (how?) and I have the menu for B.

I guess I could use the VALUE CHANGED event for B to stuff the new value back into A.

 

Wait a minute...

 

Looks like I gorched the first test.

 

When I said that "both the control and the menu obey the JUSTIFICATION setting", THAT IS NOT TRUE.

 

Looks like the menu is ALWAYS left-justified, regardless of the JUSTIFICATION setting.

 

So there is no issue, since he wants it left in the menu and right in the control.

 

Gosh, I hate Mondays.

 

Oh, wait....

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 6
(2,496 Views)

Hate to suggest the obvious here, and maybe this is different depending on Windows version, but... at least on my machine (Win XP, LabVIEW 2009) when I put a ring control on the front panel, select the text and set the text justification to "right," I still get a left-justified menu, which, if I've understood correctly, is exactly what you're trying to achieve.  Are you sure you need a more complicated solution?

 

EDIT: and looks like you figured this out at the same time I did...

0 Kudos
Message 5 of 6
(2,488 Views)

Sorry for the noise.  Somehow I got it into my head that the menu followed the same property.

 

Thanks for your reply.

 

Like I said, I hate Mondays.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 6 of 6
(2,483 Views)