Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Spin + Text
Spin + Text [message #39849] Mon, 06 May 2013 14:56 Go to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

I am looking to make a combination of a widget that houses a label with spin buttons. The intention is to use the spin buttons to change the text displayed in the widget from an array of texts

I have investigated various options including the template WithSpin<>. However, these things are beyond my understanding at this stage and I seek some help.

The way I did the task right now is very clumsy, but it works
I have an EditIntSpin on my layout that is shrunk to just show the spin buttons but not the value it holds. Another StaticLabel is lying adjacent to it that shows the String corresponding to the int value contained in the EditIntSpin. The way it works is when the spin is used, it callsback a function that loads the text to the label.
index.php?t=getfile&id=4172&private=0
Example
index Text
0 125
1 250
2 500
3 750

So, if the IntSpinner holds a value of 2, the Label will show 500

void	A2001_13::ChangeFrequency()
{
	Test.lblFreq.SetText(xLegend[Test.spnFrequency]);
}

// in the topwindow code
	Test.spnFrequency <<= THISBACK(ChangeFrequency);



I know this can be done using an ArrayCtrl + WithSpin; but, I am not upto it at the moment. Help please
Re: Spin + Text [message #39852 is a reply to message #39849] Tue, 07 May 2013 01:21 Go to previous messageGo to next message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
Hello, Jerson.
jerson wrote on Mon, 06 May 2013 14:56

I am looking to make a combination of a widget that houses a label with spin buttons. The intention is to use the spin buttons to change the text displayed in the widget from an array of texts

I created following example, based on SpinButtons and EditString classes, which may solve what you looking for:
Toggle Spoiler

index.php?t=getfile&id=4174&private=0

Where instead of EditString you might use StaticText or Label with NoIgnoreMouse(); and SetFrame(FieldFrame()); into constructor, but they will look a bit differently, than other Edit*Spin widgets.

Edit: Added GetValue methods. Changed some checks to ASSERT.

[Updated on: Tue, 07 May 2013 05:48]

Report message to a moderator

Re: Spin + Text [message #39853 is a reply to message #39852] Tue, 07 May 2013 02:48 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

SenderGhost. That is really food for thought to me. Really appreciate your help.
Re: Spin + Text [message #39856 is a reply to message #39853] Tue, 07 May 2013 05:42 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Any idea why the application(only the above code) would crash when compiled with MINGW optimal settings? MINGW debug works fine.

[Updated on: Tue, 07 May 2013 05:43]

Report message to a moderator

Re: Spin + Text [message #39857 is a reply to message #39856] Tue, 07 May 2013 06:03 Go to previous messageGo to next message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
jerson wrote on Tue, 07 May 2013 05:42

Any idea why the application(only the above code) would crash when compiled with MINGW optimal settings? MINGW debug works fine.

The MinGW GCC v4.8.0 from nuwen.net compiled (and built) above example for Optimal and Debug build modes. They run without errors.

Check the U++ sources, SSE2 package configuration flag (disabled in my tests), the compiler.

[Updated on: Tue, 07 May 2013 06:16]

Report message to a moderator

Re: Spin + Text [message #39858 is a reply to message #39857] Tue, 07 May 2013 07:01 Go to previous message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Thanks SenderGhost. SSE2 was the culprit.
Previous Topic: Socket Communication 101
Next Topic: MenuBar
Goto Forum:
  


Current Time: Thu Mar 28 20:48:31 CET 2024

Total time taken to generate the page: 0.03196 seconds