?
Solved

Not allowing focus to form/control

Posted on 1997-11-14
3
Medium Priority
?
181 Views
Last Modified: 2010-05-18
[Delphi 3 / WinNT 4]

I'm creating a sort of "monitor window" that displays various messages based a different set of 12 byte masks.

I split the "monitor" up into 4 TRichEdit controls so I could display the various status's with color and font control.. bold red for some severe problems.. normal black for normal things.

The problem is that when the TRichEdit see's any modification to it's font, it grabs the focus.  I don't want that to happen.  I want it to politely sit in the background and update it's status.

Setting to ReadOnly or (Enabled := False) don't work.

Are there any Win32 messages I can use and programmatically disallow focus?
0
Comment
Question by:greendot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Expert Comment

by:Pegasus100397
ID: 1350508
Greendot,

in each of the RichEdit controls OnEnter event use the SetFocus to set the focus back to something other than the richedit, such as

procedure TForm1.RichEdit1Enter(Sender: TObject);
begin
Button1.SetFocus;
end;

As soon as the RichEdit gets the focus it immediately shifts focus back to Button1.

Hope this helps and good luck with your project!
Pegasus
0
 
LVL 2

Author Comment

by:greendot
ID: 1350509
Oops, I should have explained what I don't like about the focus situation a little better.

I don't want anything in that window getting the focus.  
0
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 300 total points
ID: 1350510
I think this can solve it:
Use GetWindow(your window's hanlde, HWNDNEXT)
This will get the handle of the window below yours - the one who had the focus before.
Use SetForeGroundWindow(returned_handle)
This will set the focus to the previos window
Put this code to OnEnter(or whatever it's in Delphi)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question