|
Hi!
I want to display multiline text in the edit box. I use CString as a member variable. In edit box properties I checked Multiline. The text is from dialog based application and it consist of data. I would like to display each data in new line but when I use Format with “\n” I don’t get new line instead I get small black rectangle character. After the small rectangle there’s no new line. So what I should do to get new line displayed?
Thanks in advance.
|
|
|
|
|
Johnny Peszek wrote:
...when I use Format with “\n” I don’t get new line instead I get small black rectangle character.
Use \r\n instead.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks a lot it works great!!!
|
|
|
|
|
what's the format with "\r" process?
msn:Flashcutreg@hotmail.com
|
|
|
|
|
Format with "\r" stands for "carriage return" which is an escape sequence.
|
|
|
|
|
As a rule of thumb (there are some variations to this rule - like with message boxes in Windows), when it comes to text just remember this...
\n - Unix/Linux/MacOS X/etc.
\r\n - Windows/DOS
\r - MacOS 1-9
Jeremy Falcon
|
|
|
|
|
|
hello,
I am new to MFC programming. I have an urgent requirement of
creating an Address Book application with MSAccess database. I am using the
ODBC data source administrator.
I have created the GUI with two fields for name and address.
For this Edit box i have created the member variables also.
I am able to retrieve the data from the database through DoDataExchange part.
For Adding a record into the database i have written the
following code.
void CAddbookView::OnAddClick()
{
m_pSet->AddNew();
UpdateData(FALSE);
}
In this case the data i am entering is overwriting the current data. And
the next, previous, first and last control in the DR_MAINFRAME main form are
disabled.
So i want to know whether i should add any extra code for the
add operation or any steps needs to be done while creating the GUI.
I am stuck with this problem. I need to do update also. I am totally
lost in the code.
If anybody can help regarding this it will be of useful and timely help.
Thank you
|
|
|
|
|
You need something like:
void CAddbookView::OnAddClick()
{
CString strName,
strAddr;
m_name.GetWindowText(strName);
m_addr.GetWindowText(strAddr);
m_pSet->AddNew();
m_pSet->name = strName;
m_pSet->addr = strAddr;
m_pSet->Update();
} Make sense?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hello,
Thanks for your message. Sorry that i could'nt reply immediately. I tried
the same code in my application. Then i found that there is a problem.
I am using ODBC to connect to access database. So the member function like GetWindowText() is not available. I am not able to use the above code
u had sent.
I think for ODBC the coding part will be different. I am not able
to find the related member function available in that. So still i am having
the same problem.
Thanks in advance.
|
|
|
|
|
skgk wrote:
Then i found that there is a problem.
And that problem would be what, exactly?
skgk wrote:
I am using ODBC to connect to access database. So the member function like GetWindowText() is not available.
ODBC (which is a way of connecting with a database) and the GetWindowText() method (which gets the text/caption of a control) are mutually exclusive things. One is in no way related to the other.
skgk wrote:
I am not able to use the above code
u had sent.
Why?
skgk wrote:
I think for ODBC the coding part will be different.
Naturally, but since I know nothing of your project (other than it has a class named CAddbookView , a method named OnAddClick() , and a member variable named m_pSet ), I obviously couldn't make it an exact fit. Yes, you might have to tweak it.
skgk wrote:
I am not able
to find the related member function available in that.
Which member function?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
How to call and execute parameter query with ADO from access database?
were rgrtgrtvrtrt rtrtb brt tyuhjghj hbhbnh hnjm 1234567?
|
|
|
|
|
Hey all.
I have a static text control on my dialog application. I set the text at startup with SetDlgItemText(IDC_STATIC,"Blah Blah"); It works great, however if I lose focus (ie, minimize the window, or even switch to another window and back) it disappears. Does anyone know of a way to get around this?
TIA
|
|
|
|
|
Is the static text control covered by another? (You can check this in the resource editor).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi Ravi:
Nope, there's only one static control on the whole page, and it's off to the side not near anything else
|
|
|
|
|
You need to give the control an id other than IDC_STATIC , and assign it a member variable via ClassWizard. Then you can set its text using SetWindowText() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
Hi,
this week I digged a bit deeper into understanding Windows message handling and some things are unclear for me. Let's assume a simple program where you have thread A running the message pump (GetMessage, Translate, Dispatch), and another threads B sending/posting events to this window's message queue. My questions are....
- SendMessage() will not put the message into the queue but directly processes the window's WndProc and block until message was processed. A context switch is triggered immediate to thread A?
- Postmessage() will put the message into the queue and return. When is the context switch happening, before or after PostMessage returns? If after, I wonder how windows wakes up the message queue to process the waiting messages and how big the (average/worst) delay is until the corresponding WndProc will be called.
- Is there a possible dead lock with Sendmessage() and two threads (A and B) both having an own message queue? Example, when you send a message to thread A's message queue and A's Wndproc sends back a message to B's message queue. Since B is waiting blocking for the first message to complete, thread A will then have to wait forever?
- When you use SetTimer() to create repeated timer events, are those WM_TIMER messages generated from the message queue and synchronous for all threads in the same process?
Thanks for information. I am very interested in background information how Windows makes message handling fast and comfortable.
Cheers, Moak
|
|
|
|
|
Moak wrote:
Is there a possible dead lock with Sendmessage() and two threads (A and B) both having an own message queue?
Possibly. It depends on which thread is sending to which queue.
Moak wrote:
Since B is waiting blocking for the first message to complete, thread A will then have to wait forever?
Yes, that's an example of deadlock.
You might want to read these two articles for a bit more on threads:
http://flounder.com/workerthreads.htm
http://flounder.com/uithreads.htm
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I would answer me
1) yes, immediate context switch with SendMessage
2) waits until event being signaled, scheduler switches when he feels so
3) dead lock possible with Sendmail, often discussed on INternet
4) no idea still
|
|
|
|
|
Sorry for the post name !
A week ago I posted a topic on clearing the screen in dos! Got four replies, none of which worked!
Here is the problem. I have the folowing code inside main().
cout << " Hi! I am dumb.";<br />
cout << endl;
// Here I need the screen to clear the way BASIC used to clear it when you put cls() or something like that, cant remember now.
// So that this next statment is printed on a clean dos screen!
cout << " Hi! I am dumb.";<br />
cout << endl;
Some one suggested to cls() but didn't mention the header, then someone else said to use clrscr() and #include conio but conio does not have any members with such name.
Even the docs supplied with VS 7 Ent. do not have any refference to cls() or anything even closely resembling it!
If some one actualy does know how to do this PLEASE HELP!
If somebody was offended by this post I aplgs! But some times you should take the time to read your own posts to see if they make sence or compile proper!
Thanks in advance.
|
|
|
|
|
CreepingFeature wrote:
Got four replies, none of which worked!
Were any of them FillConsoleOutputAttribute() and FillConsoleOutputCharacter() ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I think I replied to your question or was it someone else's?? dunno well you should use
system("cls");
it's fast, easy and painless.
|
|
|
|
|
namethatnooneelsetook2 wrote:
it's fast, easy and painless.
It's also antiquated, inefficient, and reminiscent of Unix days. The system() function starts a complete command interpreter, which then executes the <insert command="" here=""> command. I cringe when I see solutions that have employed the system() function. There is virtually nothing it can do that can't be done better by a direct API call. I consider it to have died with Win16 and is kept on for backward compatibility with old 16-bit programs that are being converted.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Those are what is used in Q99261.
__________________________________________
a two cent stamp short of going postal.
|
|
|
|