July 13, 2024, 07:34:17 PM

News:

IWBasic runs in Windows 11!


CAPTION manipulation - What is possible?

Started by Junner2003, January 26, 2007, 05:15:02 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Junner2003

I just wonder what kind of manipulation other than changing the title of a window would be possible in the CAPTION BAR ???
There are more and more programs out there as example having different color (background image?) in the caption than the default Windows XP Theme.

Also:
Is there a way to get a MINIMIZE TO TRAY button in the CAPTION like on the pic attached?

What other manipulations would be possible in EBASIC? Anybody some ideas?

Ionic Wind Support Team

Not much you can do with XP themes.   Probably the easiest way to mak a custom caption is not to have one at all and draw it yourself in the client area.  There was an example of that floating around on the old ibasic forums.

Ionic Wind Support Team

Junner2003

Is it at least possible to remove the CLOSE "X" in the CAPTION? I studdied the user guide but could not find anything ...

LarryMc

when creating the window use the "@NOCAPTION" flag (from the user's guide)
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Junner2003

Yep, so far I knew it but the CAPTION is wanted :( ... just not the "X" I guess there is no other way in EBASIC of doing it? :(

Pip1957


mrainey

This thread came from the old IBasic forum - maybe there are some ideas in it for you.



I'm trying to change the style of a childwindow, but I don't know how to do it. I think I have to use SENDMESSAGE and SetWindowPos() and that kind of functions, but I don't know how. :cry:

The desired style for the childwindow I need is:
- has a close button
- has a captionbar
- is not moveable in the parentwindow
- has no borders
- captionbar must look "active": Color of captionbar is blue, not gray

Does somebody know how to get this done?

Jos




A child window is treated differently by Windows. It can't have a blue caption and not all styles are valid. It will always "belong" to its parent unless your using a tool window. A tool window can have a blue caption and can be separate from it's parent.

The exception to the above is MDI child windows. MDI child windows are drawn by the OS differently than normal child windows. The active MDI child will have a blue caption.

Dialogs are also treated and drawn differently than a normal child window. Try a dialog shown with SHOWDIALOG to see what I mean.

In any event there is no easy way to override the default drawing behaviour enforced by the OS. You can make the window captionless, and then draw one yourself in the client area. Override the WM_NCPAINT message through subclassing and draw a custom caption in any color you want, etc.

MSDN is your friend.

Paul.



I will make a captionbar and closebutton myself. :)
The captionbar is no problem: paint a filled rectangle and print the caption in it. I can make a closebutton by creating a button with a picture "X". But then the button is always a (simulated) win95/98 style, not automaticly the style of for example winXP :cry: .

Thanks,
Jos



Here is my solution. I have added the image needed for the closebutton to this poste.

If someone has an idea how to make a real closebutton (such that it can have the winXP style) I would be glad to know how!

Jos


'For IBasic Pro
'This program creates a not-movable, borderless childwindow in the parentwindow
'Jos de Jong
DECLARE "user32.dll",GetSysColor(what:INT),INT
'Create the parentwindow
Def main:window
OPENWINDOW main,100,100,380,340,@size|@MINBOX|@maxbox,0,"Test Child captionbar", &MainRoutine
SETWINDOWCOLOR main, GetSysColor(15)
Control main,@edit,"",160,5, 200,300, 0 , 1
'Create the childwindow
Def child:window
OPENWINDOW child,5,5,150,300,@nocaption,main,"Child", &ChildRoutine
SETWINDOWCOLOR child, GetSysColor(15)
Control child,@listbox,"",0,18, 150,300-18, 0 , 3
Addstring child, 3, "item1"
Addstring child, 3, "item2"
Addstring child, 3, "item3"
'create a captionbar and closebutton for the childwindow
INT L,T,W,H
getclientsize child, L,T,W,H
rect child, 0,0,W,18, GetSysColor(2), GetSysColor(2)
frontpen child, GetSysColor(9)
drawmode child, @TRANSPARENT
setfont child, "ms sans serif", 8, 700, 0
move child, 2,2: PRINT child, "Child"
control child,@button,"X",W-18,2, 16,14, @CTLBTNBITMAP, 2
setcontroltext child, 2, getstartpath+"close.bmp"
run=1
WAITUNTIL run = 0
CLOSEWINDOW Main
END
'________________________________________
SUB MainRoutine
   select @MESSAGE
      case @IDCLOSEWINDOW
         run=0   :'closes the window
   endselect
   RETURN
ENDSUB
'________________________________________
SUB ChildRoutine
   select @MESSAGE
      case @IDCONTROL
         IF @CONTROLID = 2
              'closebutton in childwindow clicked -> close childwindow
            closewindow child
            setsize main, 5,5, 200+155,300, 1
         ENDIF
   endselect
   RETURN
ENDSUB




See the API function DrawFrameControl with the DFCS_CAPTIONCLOSE property. Use google or MSDN for examples.

Paul.
Software For Metalworking
http://closetolerancesoftware.com