[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Not allowing focus to form/control

Posted on 1997-11-14
3
Medium Priority
?
184 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

656 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