Link to home
Start Free TrialLog in
Avatar of felonious
felonious

asked on

I need to make a toolwindow (like in Photoshop)

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.
Avatar of Jaymol
Jaymol

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.
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
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.
Avatar of felonious

ASKER

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)
ASKER CERTIFIED SOLUTION
Avatar of Igor UL7AAjr
Igor UL7AAjr
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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!
always wellcome :-)