|
-
April 3rd, 1999, 10:57 AM
#1
Which Control to disply a variable(s)
Wondering which control I would use to disply a variable ( char. or num.) And how is it done.... Please help if you can...
I have tried using a static text box in VC++ 5. and I just get errors..
-
April 3rd, 1999, 12:25 PM
#2
Re: Which Control to disply a variable(s)
Hi.
I often use CStaic, CEdit and CListBox to display my data.
I assume that a static text box means CStatic control?
You must change its ID from IDC_STATIC to IDC_MYSTATIC, for example.
When you put label by CStatic control, its id is always IDC_STATIC.
So you must differentiate it.
GetDlgItem(IDC_MYSTATIC)->SetWidnowText("Test");
or
CStatic* ptrCtl = (CStatic*)GetDlgItem(IDC_MYSTATIC);
ptrCtl->SetWindowText("Test");
or make control the member control by class wizard
and m_ctl.SetWindowText("Test");
Hope for help.
-Masaaki Onishi-
-
April 3rd, 1999, 12:59 PM
#3
Re: Which Control to disply a variable(s)
ok,
GetDlgItem(IDC_MYSTATIC)->SetWidnowText("Test");
Would '("Test")' be replaced with ("VarriableName") ???? ..
ex... Dialog based program.. click this button and it increasses value X
by value Y... show the new varriable called VarriableName...
??
or am I lost
-
April 3rd, 1999, 05:59 PM
#4
Re: Which Control to disply a variable(s)
Hi.
I don't know your approach and code, so can't point out a idea which you want.
Basically, you need some conversion function. For example,
int -> string : itoa() function
or
string -> int: atoi() function and so on.
If you enter the data in Edit box, how this edit box deal with this data as int or string.
This is your choice. But if you deal with the data by plus, you had better use int format.
After this, in order to convert it from int to string in order to use SetWindowText() to CStatic control,
you use conversion function above.
Hope for help.
-Masaaki Onishi-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|