15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Input from the status bar.

Paul Martinsen -- pmartinsen@hort.cri.nz
Tuesday, January 14, 1997

Environment:  VC++ 4.0, Win 95

Hello All,

I want to use the status bar for simple input in a similar way that 
MS Developer does for its folding search (Ctrl + I). 
At the moment, when it is appropriate, my view sends WM_CHAR messages 
to a simple class that deals with the input by keeping track of what 
has been entered so far, modifying it in response to the WM_CHAR 
message, and displaying it using CMainFrame::SetMessageText. All this 
works very nicely until another part of the program uses the message 
bar do display something. For example, the menu messages. At this 
point my input text is overwritten & I can't figure out where to make 
it come back.

Last night I gave the message section of the status bar an ID (and 
created a new class CMyStatusBar, which had a special OnSetText 
member to use this ID for setting the message text). This let me use 
an ON_UPDATE_COMMAND_UI, in my view class to set the message text. 
(The view knows what the text should be). This half worked. The input 
prompt is restored after menu messages have been displayed, but each 
time I set the text in my input class (ie when the user types 
something), the idle message (For Help, Press F1) appears briefly 
before being replaced by the correct prompt. 

I've also tried processing the mfc message WM_SETMESSAGESTRING in my
view but the message never gets there. I'd really like to do the
work in the view because it knows what should be displayed for the
input text.

Does anybody know if there is an easy way of achieving the correct 
(ie like developer studio) behaviour? Also, how can I change the 
background colour of a text pane the way developer studio does for 
important messages (eg the "Past end of file" message that you see 
when using the find command)?

Thanks for any help,
Paul.



Shaju Mathew -- shajum@hpptc51.rose.hp.com
Wednesday, January 15, 1997

> 
> Environment:  VC++ 4.0, Win 95
> 
> Hello All,
> 
> I want to use the status bar for simple input in a similar way that 
> MS Developer does for its folding search (Ctrl + I). 
> At the moment, when it is appropriate, my view sends WM_CHAR messages 
> to a simple class that deals with the input by keeping track of what 
> has been entered so far, modifying it in response to the WM_CHAR 
> message, and displaying it using CMainFrame::SetMessageText. All this 
> works very nicely until another part of the program uses the message 
> bar do display something. For example, the menu messages. At this 
> point my input text is overwritten & I can't figure out where to make 
> it come back.
> 
> Last night I gave the message section of the status bar an ID (and 
> created a new class CMyStatusBar, which had a special OnSetText 
> member to use this ID for setting the message text). This let me use 
> an ON_UPDATE_COMMAND_UI, in my view class to set the message text. 
> (The view knows what the text should be). This half worked. The input 
> prompt is restored after menu messages have been displayed, but each 
> time I set the text in my input class (ie when the user types 
> something), the idle message (For Help, Press F1) appears briefly 
> before being replaced by the correct prompt. 
> 
> I've also tried processing the mfc message WM_SETMESSAGESTRING in my
> view but the message never gets there. I'd really like to do the
> work in the view because it knows what should be displayed for the
> input text.
> 
> Does anybody know if there is an easy way of achieving the correct 
> (ie like developer studio) behaviour? Also, how can I change the 
> background colour of a text pane the way developer studio does for 
> important messages (eg the "Past end of file" message that you see 
> when using the find command)?

The first part of your qn was a bit vague, (or so it seemed to me) -
but to change the background message, you need to override the OnPaint() 
so that your CMyStatusBar'll handle it's own painting. You should keep
track of the bkgnd color attribute within that class, and in your handler
for a case such as 'Past end of file', you should just reset the 
bkgnd color and call an Invalidate() - which would call your 
overridden OnPaint()
> 
> Thanks for any help,
> Paul.
> 


--
***********************************************************************
                              .---.         .---.
Shaju Mathew                 /" "  \  WWW  /  " "\    Off:(916)785-9018 
Performance Technology Lab  / / ""  \(*|*)/  "" \ \ 
WCSO Group R & D           //////   '. V .`   \\\\\\ Home:(916)722-4576
Hewlett-Packard Company   //// / // : """ : \\ \ \\\\
8000, Foothills Blvd     // /   /  /`.""" '\  \   \ \\Fax:(916)785-1264
MS 5723, Roseville      //          //.".\\          \\
CA 95747-5723        	     -------UU---UU-------
                                   '//|||\\`        Shaju_Mathew@hp.com
***********************************************************************




| Вернуться в корень Архива |