|
andreir23 wrote:
I mean I mapped thru ClassWizard a CString to that static text control named m_Source.
Dont map a CString to that static text control. Map a CStatic to that static text control m_source( Just select Control in the combobox where u map a variable, it will autmatically show CStatic in the datatype field)
Now if u just want to change the text of static control, and want other controls like radio to remain unchanged, just call this function
<br />
m_source.SetWindowText("My Text!!");<br />
It will modify its contents and update it visually.. Now to retrieve the text from static control call
<br />
CString str;<br />
m_source.GetWindowText(str);<br />
OR
U can also use
<br />
SendMessage(m_source.GetSafeHwnd(),WM_SETTEXT,(WPARAM)0,(LPARAM)"My Text"); <br />
to achieve the same task *visually updating static text without chaning any
other control.
This will definately solve your problem..
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
Add a handler for BN_CLICKED for each of your radio buttons. In the handler, set the m_Operation member to the button that was just clicked. It isn't otherwise being updated, which is why it reverts to the old setting when UpdateData(FALSE) is called.
void CDlgtestDlg::OnRadio1()
{
m_Radio = 0;
}
void CDlgtestDlg::OnRadio2()
{
m_Radio = 1;
}
or you can add a single handler for this using ON_CONTROL_RANGE(BN_CLICKED ...)
Nick
This posting is provided “AS IS” with no warranties, and confers no rights. You assume all risk for your use. © 2003 Microsoft Corporation. All rights reserved.
|
|
|
|
|
Hello all.
I can't seem to find this anywhere, but I do remember at some point in time I've used this in c, for printf.
What I'm basically trying to do is conditionally format my sprintf() statement to display an "s" character if an integer is greater than one.
Sort of like this:
if (x>1) {
sprintf(buf,"%d files processed",x);
} else {
sprintf(buf,"%d file processed,x);
}
Except I do not wish to use an if statement like that.
I remember somewhere that you can do this with some sort of printf(...? i>1...); I remember it had something to do with a question mark in there but that's all I can remember. Unfortunately a google search of "printf ?" doesn't seem to help me out.
|
|
|
|
|
You're thinking of a lisp statement.
printf(buf,(x > 1 ? "%d files processed" : "%d file processed"),x);
conditional ? true : false
Hope this helps,
Tyler Kellen
|
|
|
|
|
<br />
int i=5;<br />
int j=6;<br />
printf("Hello %d", i>0?i:j);<br />
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
int i=5;
int j=6;
printf("Hello %d", i>0?i:j);
hahahaha
Programming is an art not a skill, every one can be a skilled programmer but not an artist.
|
|
|
|
|
is it funny???
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
yeah it is, what he asked for and what you giving answer for.
Programming is an art not a skill, every one can be a skilled programmer but not an artist.
|
|
|
|
|
he was just asking for syntax that how to use ternary operator in a sngle printf statement
Not everyone is dumb like u ..that he wont get his answer from
printf("Hello %d", x>0?i ;
mr.prakash wrote:
Programming is an art not a skill, every one can be a skilled programmer but not an artist.
and think over it before posting..
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
sprintf(buf, "%d file%s processed", x, ( x == 1 ? "" : "s" ) );
is art.
printf("Hello %d", x>0?i); is skill.
and hey sorry to hurt your ego.
Programming is an art not a skill, every one can be a skilled programmer but not an artist.
|
|
|
|
|
|
Clever
|
|
|
|
|
I was wondering who'd come up with the sane solution, and here you are!
--
You're entertaining at least.
|
|
|
|
|
|
Indeed! A textbook C solution. Sometimes I miss getting down and dirty with raw bits
--
You're entertaining at least.
|
|
|
|
|
Jörgen Sigvardsson wrote:
Indeed! A textbook C solution.
Thank you
Jörgen Sigvardsson wrote:
Sometimes I miss getting down and dirty with raw bits
I don't miss void * at all though
And I'm quite happy programming at almost any level - each has it's own appeals and virtues. using VB.NET is a bit like going on a hedonistic and debauched holiday, C++ provides some much appreciated feelings of divinity, Lisp is all about artistry, and I'll leave Assembly to the philosophers
--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
|
|
|
|
|
You got my 5.
Programming is an art not a skill, every one can be a skilled programmer but not an artist.
|
|
|
|
|
Thank you guys for the posts I knew that thing was in there somewhere!!!!!
I was trying to consolidate the code and make it in as less lines as possible (to make it easier to read / go through) but now I see that in this case it would probably be a bit better to do the IF statement because "sprintf(buf2,"%d File%s Processed",i,(i==1 ? "":"s"));" isn't exactly an eye appeal (although it works exactly like I want it to!) ... and since I do most of my work after a few Jack&Coke's ...... heheheh
Thanks again!
|
|
|
|
|
|
According to:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/editcontrols/editcontrolreference/editcontrolmessages/en_vscroll.asp
This message is sent for the following mouse events on the vertical
scroll bar: clicking either arrow button or clicking between the arrow
button and the thumb. However, the message is not sent when clicking
the scroll bar mouse itself. The message is also sent when a keyboard
event causes a change in the view area of the edit control, for
example, pressing HOME, END, PAGE UP, PAGE DOWN, UP ARROW, or DOWN
ARROW.
How can I capture the scroll event when the user drags the actual
scrollbar? (SB_THUMBTRACK)
Any pointsers would be very helpful. I'm writing this in pure
c/win32api.
I am using a Richedit 1.0 common control.
Also, I have turned on the ENM_MOUSEEVENTS & ENM_SCROLL event masks.
I can capture EN_VSCROLL just fine.
Current source:
http://www.curvyline.com/codepad.c
http://www.curvyline.com/linefunc.h
http://www.curvyline.com/protos.h
http://www.curvyline.com/openclose.h
-Tyler Kellen
|
|
|
|
|
Dear all,
How can I output a carriage return character in CView object? I tried the combination of "0x0A" and "0x0D", also "\n" character, but both of them failed. The "\n" character works properly with CRichEditView, but not with CView. How can I solve this problem? Thanks.
Best regards.
____
Tuan
|
|
|
|
|
What method of the CView class are using in order to output the carriage return character?
Chris Meech
It's much easier to get rich telling people what they want to hear. Christopher Duncan
I can't help getting older, but I refuse to grow up. Roger Wright
I've been meaning to change my sig. Thanks! Alvaro Mendez
We're more like a hobbiest in a Home Depot drooling at all the shiny power tools, rather than a craftsman that makes the chair to an exacting level of comfort by measuring the customer's butt. Marc Clifton
|
|
|
|
|
Dear Chris,
I used the method TextOut of CDC object got from GetDC().
____
Tuan
|
|
|
|
|
Have a look at using the DrawText method instead. You call it twice. First to have it calculate the necessary coordinates and then a second time to actually 'draw' the text. The string of characters can contain any kind of control sequences such as HT, CR, and LF.
Chris Meech
It's much easier to get rich telling people what they want to hear. Christopher Duncan
I can't help getting older, but I refuse to grow up. Roger Wright
I've been meaning to change my sig. Thanks! Alvaro Mendez
We're more like a hobbiest in a Home Depot drooling at all the shiny power tools, rather than a craftsman that makes the chair to an exacting level of comfort by measuring the customer's butt. Marc Clifton
|
|
|
|
|
Thank you very much,
I'm using that method now.
BRs.
____
Tuan
|
|
|
|