Jump to content
Sign in to follow this  
buzz44

Style/Extended Styles

Recommended Posts

Is it possible to have something like this.

Posted Image

I want the GUI window to have no border like a tool window. But I still want it to have the Close/Minimize and Maximize buttons and the Icon in the corner etc. (Due to my windows theme I have some extra buttons in the title bar, please ignore :()

I tried all the styles I thought might be able to do it but none yet :(.

Edited by Burrup

qq

Share this post


Link to post
Share on other sites

Bump...

Edit: Ok, I done some further research and this is what I'm hoping to achieve.

The default styles are $WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU styles.

$WS_MINIMIZEBOX needs $WS_SYSMENU to be specified. $WS_SYSMENU needs $WS_CAPTION to be specified. And $WS_CAPTION includes $WS_BORDER which is the style I don't want.

Any idea's?

Edited by Burrup

qq

Share this post


Link to post
Share on other sites

This might help since the close and minimize buttons are drawn from the script.....

OR...you can use ANYGUI(or your own methods) to add a child window to the top of your window, then add bitmapped buttons(for min,max, & close) and your icon to it.Then set events for the button clicks..........

;// AXWindow - AutoIt eXperimental Window (7/08/2004)
;// By: 'Josbe' (mrjosbe AT yahoo DOT com)
;// Based in Ideas: CyberSlug, Rednhead (http://www.hiddensoft.com/forum)
;// Requirement: AutoIt v3.0.102+ (GUI version)

_AXWindow()
Exit

Func _AXWindow()
;// AutoIt Options
Opt("WinWaitDelay",20); If the value is less, it's more easy to move the window.
Opt("GuiResizeMode",800);

;// Window's settings
$wTITLE="AXWindow-My flat window"
$wHEIGHT=365
$wWIDTH=365
$wTITHEIGHT=16
$wColorFont_Title=0xFFFFFF
$wColorBack_Title=0x0BAFEE
$wFont_Title="Arial"
Local $MOVE_MODE=0,$OFFSET

;// Default states
$wStateTop=1;// State by default for window. :: 0 = remove on top flag, 1=set on top flag
$mAnimate=1;// Default state mode for animate 'resizing' the window. :: 0= remove this mode, 1=set this mode on

;// GUI Vars
$WS_EX_STATICEDGE=0x00020000
$WS_EX_CLIENTEDGE=0x00000200
$WS_POPUP=0x80000000
$WS_EX_DLGMODALFRAME=0x00000001
$WS_BORDER=0x00800000
$WS_THICKFRAME=0x00040000
$BS_FLAT=32768
$BS_CENTER    =768
$BS_PUSHLIKE=0x1000

;// Finding default Window's color. Function ::RGB 2 HEX
$rgbComp=StringSplit(StringStripWS(RegRead("HKCU\Control Panel\Colors","ButtonFace"),3),"")
$_hexWinColor=Hex(BitAND($rgbComp[1],255),2)&Hex(BitAND($rgbComp[2],255),2)&Hex(BitAND($rgbComp[3],255),2)

;// >>>==[ WINDOW DEFINITION ]===>>>
If 1 Then; This "IF" only for collapse [+] in the editor (Scite).
GUICreate($wTITLE,$wWIDTH,$wHEIGHT,-1,-1,$WS_POPUP+$WS_BORDER)
GuiSetIcon('')
GuiSetBkColor(Dec($_hexWinColor))

;// TITLE DEFINITION
GuiSetFont(10,700,0,$wFont_Title)
$wTITLEBorder=GUICtrlCreateLabel(''&$wTITLE,0,0,$wWIDTH-80,$wTITHEIGHT)
GuiCtrlSetResizing($wTITLEBorder,'')
GuiCtrlSetTip($wTITLEBorder,'')
GuiCtrlSetLimit($wTITLEBorder,$wColorFont_Title)
GuiCtrlSetBkColor($wTITLEBorder,$wColorBack_Title)

;// ==> BUTTONS DEFINITION - START
GuiSetFont(9,300,0,'Wingdings')
; ASCII Characters for icons
$charM="y"
$charX="x"

If $wStateTop=0 Then
$chrSTop='m'
Else
$chrSTop='l'
EndIf
$btnTop=GUICtrlCreateButton($chrSTop,$wWIDTH-80,0,20,16,$BS_FLAT)
GuiCtrlSetResizing(-1,'')
GuiCtrlSetTip(-1,'Always on top')


Global $btnMin=GUICtrlCreateButton('Ú',$wWIDTH-60,0,20,16,$BS_FLAT)
GuiCtrlSetResizing(-1,'')
GuiCtrlSetTip(-1,'Minimize')


Global $btnCut=GUICtrlCreateButton($charM,$wWIDTH-40,0,20,16,$BS_FLAT)
GuiCtrlSetResizing(-1,'')
GuiCtrlSetTip(-1,'Cut window')


Global $btnClose=GUICtrlCreateButton($charX,$wWIDTH-20,0,20,16,$BS_FLAT)
GuiCtrlSetResizing(-1,'')
GuiCtrlSetTip(-1,'Close')


GuiSetFont(9); Font by default

Global $btnHello=GUICtrlCreateButton('Hello World',$wWIDTH/2-50,$wHEIGHT/2-10,100,20)

;// <== BUTTONS DEFINITION - END

EndIf
;// <<<==[ WINDOW DEFINITION ]===<<<

GuiSetState(@SW_SHOW)

;// Setting value
WinSetOnTop($wTITLE,"",$wStateTop)

While WinExists($wTITLE)
Sleep(10)

;// MOVE MODE - Title
If $MOVE_MODE Then
$mouse=MouseGetPos()
WinMove($wTITLE,"",$mouse[0]+$x_offset,$mouse[1]+$y_offset)
EndIf

$msg=GuiGetMsg()
Select

Case $msg=$btnClose
Exit

Case $msg=$btnCut
$oWWD=Opt("WinWaitDelay",1)
$wPos=WinGetPos($wTITLE)
If $wPos[3]<>$wTITHEIGHT Then
If $mAnimate=1 Then
For $t=$wHEIGHT to $wTITHEIGHT step-6
WinMove($wTITLE,'',$wPos[0],$wPos[1],$wWIDTH,$t-1)
Next
WinMove($wTITLE,'',$wPos[0],$wPos[1],$wWIDTH,$wTITHEIGHT)
Else
WinMove($wTITLE,'',$wPos[0],$wPos[1],$wWIDTH,$wTITHEIGHT)
EndIf
ControlSetText($wTITLE,'','Button3','p')
ControlFocus($wTITLE,"","Static1"); remove the focus
Else
If $mAnimate=1 Then
For $t=$wTITHEIGHT to $wHEIGHT Step 6
WinMove($wTITLE,'',$wPos[0],$wPos[1],$wWIDTH,$t)
Next
Else
WinMove($wTITLE,'',$wPos[0],$wPos[1],$wWIDTH,$wHEIGHT)
EndIf
ControlSetText($wTITLE,'','Button3',$charM)
ControlFocus($wTITLE,"","Static1")
EndIf
Opt("WinWaitDelay",$oWWD)
ContinueLoop

Case $msg=$btnTop
If $wStateTop=0 Then
ControlSetText($wTITLE,'','Button1','l')
ControlFocus($wTITLE,"","Static1"); remove the focus
$wStateTop=1
Else
ControlSetText($wTITLE,'','Button1','m')
ControlFocus($wTITLE,"","Static1"); remove the focus
$wStateTop=0
EndIf
WinSetOnTop($wTITLE,"",$wStateTop)

Case $msg=$btnMin
WinSetState($wTITLE,"",@SW_MINIMIZE)

Case $msg=$btnHello
MsgBox(4096,"","Hello World!")

Case $msg=$wTITLEBorder
$MOVE_MODE=Not $MOVE_MODE;toggle mode
;// Calculate relative offset between window and mouse
If $MOVE_MODE Then
$mouse=MouseGetPos()
$window=WinGetPos($wTITLE)
$x_offset=$window[0]-$mouse[0]
$y_offset=$window[1]-$mouse[1]
GuiCtrlSetTip($wTITLEBorder,"Moving...")
GuiCtrlSetLimit($wTITLEBorder,0xFFFFFF)
GuiCtrlSetBkColor($wTITLEBorder,0x000000)
Else
GuiCtrlSetTip($wTITLEBorder,"Move")
GuiCtrlSetLimit($wTITLEBorder,$wColorFont_Title)
GuiCtrlSetBkColor($wTITLEBorder,$wColorBack_Title)
EndIf
EndSelect
Wend
EndFunc
Edited by quaizywabbit

[u]Do more with pre-existing apps![/u]ANYGUIv2.8

Share this post


Link to post
Share on other sites

Thanks quaizywabbit. I was aware of this code when it came out but never fully understood it. I have now, since you posted it and revived my memory of it :(, look at the code and understand :(. I'm sure I won't have anymore problems.

Thanks again.


qq

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...