Numeric Displays
-
- Posts: 625
- Joined: Mon Nov 15, 2021 9:23 pm
Numeric Displays
I was wondering how the numeric displays in things like Andrew Macaulay's Dual Frequency Meter are done. Are they extensions of the Counter type, or done from scratch, maybe with the Canvas Type? Anyone know, or any guesses. I don't see any way to get more than integer digits in the Counter type.
Cyberwerks Heavy Industries -- viewforum.php?f=76
Re: Numeric Displays
For example, in my p.moon CV-Meter I used regular text labels as digital display.
But it's a little bit tricky to get the characters onto right place.
But it's a little bit tricky to get the characters onto right place.
-
- Posts: 625
- Joined: Mon Nov 15, 2021 9:23 pm
Re: Numeric Displays
I thought of that, but figured I'd have the very problem you mentioned.
Cyberwerks Heavy Industries -- viewforum.php?f=76
Re: Numeric Displays
Andrew Macauley seems to use the regular CA Digital Counter. At the moment there are 7 styles for the counter available.
Count of digits is always setable.
Additional characters like "Hz" then can be added by means of a text label with similiar style.
Count of digits is always setable.
Additional characters like "Hz" then can be added by means of a text label with similiar style.
-
- Posts: 625
- Joined: Mon Nov 15, 2021 9:23 pm
Re: Numeric Displays
Monki-bobo's Volt Meter seems to be doing a custom draw.
Cyberwerks Heavy Industries -- viewforum.php?f=76
-
- Posts: 625
- Joined: Mon Nov 15, 2021 9:23 pm
Re: Numeric Displays
I was looking through the sample code, and found that the timer sample does it with a text label.
Cyberwerks Heavy Industries -- viewforum.php?f=76
- honki-bobo
- Posts: 310
- Joined: Sat Nov 09, 2019 1:18 pm
Re: Numeric Displays
I'm using a text label that I update on every GUI repaint.UrbanCyborg wrote: ↑Thu Feb 03, 2022 12:20 pm Monki-bobo's Volt Meter seems to be doing a custom draw.
And it's honki-bobo
-
- Posts: 625
- Joined: Mon Nov 15, 2021 9:23 pm
Re: Numeric Displays
Sorry about that, honki-bobo-san. My memory failed me. So, that's just a text label update, eh? I'm guessing you have a nice custom background for it to draw over. I'd started a new module yesterday that does that. Nice work, btw.
Cyberwerks Heavy Industries -- viewforum.php?f=76
- honki-bobo
- Posts: 310
- Joined: Sat Nov 09, 2019 1:18 pm
Re: Numeric Displays
No worries, my friend
Actually I just use the textlabels background color, border color and border width features and write the numbers in bold Courier New 16px in the upper right corner of the label. The generated code looks like this:UrbanCyborg wrote: ↑Fri Feb 04, 2022 7:11 am So, that's just a text label update, eh? I'm guessing you have a nice custom background for it to draw over.
Code: Select all
textLabel1 = new VoltageLabel( "textLabel1", "textLabel1", this, "-0.12345678" );
AddComponent( textLabel1 );
textLabel1.SetWantsMouseNotifications( false );
textLabel1.SetPosition( 17, 24 );
textLabel1.SetSize( 120, 25 );
textLabel1.SetEditable( false, false );
textLabel1.SetJustificationFlags( VoltageLabel.Justification.Right );
textLabel1.SetJustificationFlags( VoltageLabel.Justification.Top );
textLabel1.SetColor( new Color( 0, 0, 0, 255 ) );
textLabel1.SetBkColor( new Color( 65, 65, 65, 65 ) );
textLabel1.SetBorderColor( new Color( 0, 0, 0, 255 ) );
textLabel1.SetBorderSize( 1 );
textLabel1.SetMultiLineEdit( false );
textLabel1.SetIsNumberEditor( false );
textLabel1.SetNumberEditorRange( 0, 100 );
textLabel1.SetNumberEditorInterval( 1 );
textLabel1.SetNumberEditorUsesMouseWheel( false );
textLabel1.SetHasCustomTextHoverColor( false );
textLabel1.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
textLabel1.SetFont( "Courier New", 16, true, false );
Thanks!
-
- Posts: 625
- Joined: Mon Nov 15, 2021 9:23 pm
Re: Numeric Displays
Kewl. I just went and looked at my debug window, where I'm using your Volt Meter as part of my setup. I had to look closely to tell that it wasn't a custom background. Fools the eye. Nicely done.
Cyberwerks Heavy Industries -- viewforum.php?f=76