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 » U++ Library support » LineEdit, EditFields, DocEdit » [HELP] Getting and setting values to EditInt
[HELP] Getting and setting values to EditInt [message #36546] Wed, 06 June 2012 20:45 Go to next message
thiago__costa is currently offline  thiago__costa
Messages: 1
Registered: June 2012
Location: Guarulhos - SP
Junior Member
Hello people, this is my first topic here.
I'm new to U++, this framework is simply awesome!
I'm making a simple Lottery number checker Razz

I have a WithConfigLayout<TopWindow> d;
This window is for setting an array int result[6] that stores the values for comparation with user input.
I have 6 EditInt(result_1 to result_6), to store the value from result_1 in result[0] I'm doing this: result[0] = ~d.result_1;
But I want to do this within a for loop, how can I do this?

I need a way to to perform something like this:
for (int i = 0; i < 6; i++)
{
result[i] = ~d.result_(somehow I need to put i + 1 here);
}
There is a way to do this ?

Thanks for attention, hope anybody can help me.

[Updated on: Wed, 06 June 2012 20:48]

Report message to a moderator

Re: [HELP] Getting and setting values to EditInt [message #36547 is a reply to message #36546] Wed, 06 June 2012 21:59 Go to previous messageGo to next message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Hi Thiago_Costa,

Welcome to U++ forum. For new comers to U++, please note that a Newbie corner category is designed for beginners with Ultimate development tool.

Otherwise I suggest you store the 6 numbers in an Array:

Array<int> lotoNumbers;


I prefer it to Tab[] Wink

after that you could use the following code:

for(int i=0;i<6;i++)
   switch(i)
   {
     case 0 : edit1<<=lotoNumbers.At(O);
              break;

     case 1 : edit2<<= lotoNumbers.At(1);
              break;

     case 2 : edit3<<= lotoNumbers.At(2);
              break;

     case 3 : edit4<<= lotoNumbers.At(3);
              break;

     case 4 : edit5<<= lotoNumbers.At(4);
              break;

     case 5 : edit6<<= lotoNumbers.At(5);
              break;
   }



I am not sure that is exactly you are seeking for but try it and let me know. Razz

Cheers
____________________

Biobytes

[Updated on: Wed, 06 June 2012 22:03]

Report message to a moderator

Re: [HELP] Getting and setting values to EditInt [message #36556 is a reply to message #36546] Fri, 08 June 2012 19:35 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
thiago__costa wrote on Wed, 06 June 2012 14:45

Hello people, this is my first topic here.
I'm new to U++, this framework is simply awesome!
I'm making a simple Lottery number checker Razz

I have a WithConfigLayout<TopWindow> d;
This window is for setting an array int result[6] that stores the values for comparation with user input.
I have 6 EditInt(result_1 to result_6), to store the value from result_1 in result[0] I'm doing this: result[0] = ~d.result_1;
But I want to do this within a for loop, how can I do this?

I need a way to to perform something like this:
for (int i = 0; i < 6; i++)
{
result[i] = ~d.result_(somehow I need to put i + 1 here);
}
There is a way to do this ?

Thanks for attention, hope anybody can help me.


Actually, yes. In layout designer, simply name fields "result[0]", "result[1]" etc.. In that case, you cannot use type name in layout ("EditInt"); means you will only see rectangles in designer.

In such situation, including layout will not place those members into dialog struct, but it will place them at correct positions. All you need to do now is to add them manually, like

struct MyDialog : MyLayout<TopWindow> {
    EditInt result[6];

    MyDialog() { CtrlLayout(*this); ... }
};


CtrlLayout here will pick your definition of result and will place it accordingly.
Previous Topic: Masking the password field in the login page
Next Topic: To add some methods to LineEdit
Goto Forum:
  


Current Time: Thu Mar 28 14:43:10 CET 2024

Total time taken to generate the page: 0.01102 seconds