Jump to content


Photo
- - - - -

Anyone know how to tell a ring to resize to the size of its longest string?


  • Please log in to reply
10 replies to this topic

#1 Aristos Queue

Aristos Queue

    LV R&D: I write C++/# so you don't have to.

  • Premium Member
  • 2,643 posts
  • Location:Austin, TX
  • Version:LabVIEW 2011
  • Since:2000

Posted 15 May 2012 - 12:12 AM

Or is that just not possible to do? I'm specifically trying to find a way to do that to a System Ring control.

[EDIT] I post to LAVA... and that way, LabVIEW knows I've sufficiently embarrassed myself publicly with my lack of knowledge, and so now it can show me the answer.

There's a property that I *swear* was not in the pop up menu for the last half-hour called "Named Numeric Size" that I can use to resize the ring control. Not exactly what I wanted, but at least I can build it.

Grrr.

[EDIT] Just in case anyione else is looking for this...
Ring.png

#2 mike5

mike5

    Very Active

  • Members
  • PipPipPip
  • 160 posts
  • Location:Slovenia
  • Version:LabVIEW 2010
  • Since:2009

Posted 15 May 2012 - 10:51 AM

Looking for *what*? The property you mention is not displayed in the picture.

OTOH, where does the "Get Text Rect.vi" come from - just in case I ever need to know...

Br, Mike
Close the world, txEn eht nepO.

#3 Mellroth

Mellroth

    The 500 club

  • Members
  • PipPipPipPipPip
  • 539 posts
  • Version:LabVIEW 2011
  • Since:1995

Posted 15 May 2012 - 11:04 AM

*
POPULAR

OTOH, where does the "Get Text Rect.vi" come from - just in case I ever need to know...

Graphics & Sound -> Picture Functions

Here's a snippet that handles the horizontal resize but also takes into account the font setting in the ring control.

ResizeRingToText.png

/J

Edited by Mellroth, 15 May 2012 - 11:56 AM.


#4 Aristos Queue

Aristos Queue

    LV R&D: I write C++/# so you don't have to.

  • Premium Member
  • 2,643 posts
  • Location:Austin, TX
  • Version:LabVIEW 2011
  • Since:2000

Posted 15 May 2012 - 02:36 PM

Mike5: The last property in my property node is the one I was talking about... but Mellroth's "Ring Text.Width" property is even better because you don't have to worry about the stupid "+ 30" that I'm doing to account for the ring.

Mellroth: Does yours work for "zero strings in the array"?

#5 Phillip Brooks

Phillip Brooks

    The 500 club

  • Members
  • PipPipPipPipPip
  • 758 posts
  • Location:Boston, MA
  • Version:LabVIEW 8.6
  • Since:1999

Posted 15 May 2012 - 02:45 PM

I recall having some weirdness with "Get Text Rect" not working well with italic and bold fonts.

I ended up padding by +(x)% of the width to make things 'pretty'...

Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T


#6 Mellroth

Mellroth

    The 500 club

  • Members
  • PipPipPipPipPip
  • 539 posts
  • Version:LabVIEW 2011
  • Since:1995

Posted 15 May 2012 - 07:26 PM

Mellroth: Does yours work for "zero strings in the array"?



Currently it would probably be 7 pixels wide ;-)
The easiest way of changing this would probably be to add minimum width to the init terminal of the shift register.

/J

#7 Saverio

Saverio

    Enough LAVA to be dangerous

  • Members
  • PipPipPip
  • 144 posts
  • Version:LabVIEW 8.2
  • Since:1994

Posted 15 May 2012 - 08:26 PM

[EDIT] I post to LAVA... and that way, LabVIEW knows I've sufficiently embarrassed myself publicly with my lack of knowledge, and so now it can show me the answer.


For shame! Tsk, tsk.... A less polished version of Mellroth's solution was provided in a post all the way back in 2002 in the LabVIEW forums over at NI (I'm sure you know the place :D ): http://forums.ni.com...ght/true#M30020

All tongue-in-cheek, of course.

#8 Antoine Châlons

Antoine Châlons

    The 500 club

  • Members
  • PipPipPipPipPip
  • 590 posts
  • Version:LabVIEW 2012
  • Since:1999

Posted 15 May 2012 - 09:11 PM


[EDIT] I post to LAVA... and that way, LabVIEW knows I've sufficiently embarrassed myself publicly with my lack of knowledge, and so now it can show me the answer.


We're all just humans, aren't we?

#9 jgcode

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 16 May 2012 - 04:22 AM


We're all just humans, aren't we?


I sometimes think some of you are programming machines.

Sent back in time...

#10 mje

mje

    The 500 club

  • Premium Member
  • 823 posts
  • Location:Milford MA USA
  • Version:LabVIEW 2011
  • Since:1997

Posted 16 May 2012 - 09:51 PM

I recall having some weirdness with "Get Text Rect" not working well with italic and bold fonts. I ended up padding by +(x)% of the width to make things 'pretty'...


Indeed: http://lavag.org/top...ps-italic-text/

The solution proposed by vugie however works: pad the string with a space.

Also I expect the ring control might have a minimum width, and if s trying to set 7px could return an error. Might be wise to enforce a minimum.

#11 Aristos Queue

Aristos Queue

    LV R&D: I write C++/# so you don't have to.

  • Premium Member
  • 2,643 posts
  • Location:Austin, TX
  • Version:LabVIEW 2011
  • Since:2000

Posted 17 May 2012 - 03:48 AM

We're all just humans, aren't we?

For the time being. We strive for better, and I hope to live long enough for the cybernetic implants to kick into high gear.