Solved

I need to make a toolwindow (like in Photoshop)

Posted on 2001-06-27
7
361 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

785 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