Solved

I need to make a toolwindow (like in Photoshop)

Posted on 2001-06-27
7
360 Views
Last Modified: 2010-04-06
Ok, I was wondering if there was a component out there to make a toolwindow.  I've tried to use the bsToolWindow setting for a window, but it does not give the desired effect.  I guess what I really need is a way to:
1) have a form with controls on it
2) be able to use the StayOnTop setting
3) have the controls be clickable, BUT
4) does not take focus away from currently active window.

I guess I could always return focus to a form, but was wondering if there was an obvious (easier) way that I am missing.
0
Comment
Question by:felonious
7 Comments
 
LVL 6

Expert Comment

by:Jaymol
ID: 6234198
I'd advise using a form without a caption bar or border, and place an image on it that looks like a form.  That way, when it does not have focus, it doesn't look disabled.

I know this is basic, but you may not know so I'll tell you anyway.  Set the border style to bsNone and set the caption blank.  The form will just appear as a grey rectangle.  Drop the image on it and set both the image and form to autosize:=true.

It's not the best way, but it does work nicely.

John.
0
 
LVL 9

Expert Comment

by:ITugay
ID: 6234201
Hi felonious,
it is not an easy question, really.
It something like combobox dropdown window, right?
You can take a look at my component TDBFieldsGrid, there is a sample how to show ListBox by the meaning way. Pay attension on TConstBox.CreateWnd and  TDBFieldsGrid.ShowConstBox methods.

http://i-g-o-r.virtualave.net/fldgrd.html

------
Igor
0
 
LVL 1

Expert Comment

by:Kaspars
ID: 6234588
I suggest you to use, for example, panel and make it docked with ManualFloat. It will look like just as a tool window but will be focused with the form it belongs to ad is minimized also, when the form is minimized.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:felonious
ID: 6236715
Ok, while everything offered so far had been very interesting, I've either failed to understand it or it doesn't give the desired effect.  

For instance, ManualFloating a panel (never knew this was possible) does give you something that is close to a toolwindow, but again when the panel is clicked on the currently active window (in this case an MDI child form) losses focus.

And I guess I just dont understand windows messages and such enough to comprehend Igor's code.  I checked out the WM_SETFOCUS and WM_KILLFOCUS messages as well as SETFOCUS, and everything else in the CreateWnd procedure but I failed to understand what it does (as I cant compile/install the package in Delphi 6 I can not see the effects on that component).

Again, to restate what I would like:

-A form that *DOES NOT* take the focus away from currently selected window when it is clicked yet the controls on it act normally (OnClick events fire when a control is clicked) (i.e. like Photoshops toolbars.  I can select a tool to use from a toolbar, but the image I am working on always retains focus)
0
 
LVL 9

Accepted Solution

by:
ITugay earned 50 total points
ID: 6237250
Ok, here is another way.

let say you have Form2 that should be toolbar. Set it's property in designtime.
Form2.FormStyle := fsStayOnTop;
Form2.BorderStyle := bsToolWindow;

To show this form without loosing focus on current( main) form do next:

  Form2.Parent := Self;
  Form2.Show;

Your main form will not loose focus, but toolbar window will never get focus, so, some of controls
may not works on toolbar form. (e.g. TEdit.) while TListBox, TComboBox, TButtons etc. still works.

-----
Igor.
0
 

Author Comment

by:felonious
ID: 6237841
This worked very well for me.  I ended up going into the main project file where the application creates the forms and adding in a few lines of code:

  Application.CreateForm(TTBTools, TBTools);
  TBTools.Parent := mainform;
  Application.CreateForm(TTBDetails, TBDetails);
  TBDetails.Parent := mainform;
  Application.CreateForm(TTBItems, TBItems);
  TBItems.Parent := mainform;

Thanks for the help Igor!
0
 
LVL 9

Expert Comment

by:ITugay
ID: 6237857
always wellcome :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
loading dll from external path 1 210
Delphi XE10, MySQL Query 4 126
Using idhttp to login to instagram 2 76
Is anyone willing to have a look through this code and help debug? 25 57
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now