Jump to content

Floating ToolBar...


Valuater
 Share

Recommended Posts

Enjoy!!!

Posted Image

Updated 7/30/2008 ver 1.2.0 ... ( Thanks Volly )

#include <GUIConstantsEX.au3>
#include <windowsconstants.au3>
#include <buttonconstants.au3>
#include <StaticConstants.au3>
;Opt("MustDeclareVars", 1)

; ver 1.2.0
; $h_ToolBar = XSkinToolBarCreate($Xh_Gui, $tool_left, $tool_top, $tool_width, $tool_bkcolor = "")
; XSkinToolBarButton($iNumber, $iDLL = "shell32.dll")
; XSkinToolBarSeparator()

Global $TBcnt = -1
; ************************ YOUR CODE GOES BELOW HERE *****************************

$h_ToolBar = XSkinToolBarCreate("Float-ToolBar", 200, 200, 324)

$TButton1 = XSkinToolBarButton( "", @WindowsDir & "\notepad.exe")

; #1 - Using Icons from a dll ( shell32.dll is default)
XSkinToolBarButton(21)
XSkinToolBarButton(17)
XSkinToolBarButton(44)
XSkinToolBarSeparator()
GUICtrlSetTip( -1, "Drag Me")

; #2 - Using Icons from an exe file

XSkinToolBarButton(22)
XSkinToolBarButton("", @ProgramFilesDir & "\Internet Explorer\iexplore.exe")
XSkinToolBarButton( "", @WindowsDir & "\explorer.exe")
XSkinToolBarButton( "", @SystemDir & "\calc.exe")
XSkinToolBarSeparator()
GUICtrlSetTip( -1, "Drag Me")

; #3 - Using Icons from an ico file
XSkinToolBarButton("", @ScriptDir & "\Skins\Default-ToolBar\Admin Tools.ico")
XSkinToolBarButton("", @ScriptDir & "\Skins\Default-ToolBar\Control Panel.ico")
XSkinToolBarButton("", @ScriptDir & "\Skins\Default-ToolBar\E-Mail.ico")

; Exit Button
XSkinToolBarSeparator()
GUICtrlSetTip( -1, "Drag Me")
$TButtonLast = XSkinToolBarButton(27)


GUISetState(@SW_SHOW, $h_ToolBar)

WinSetOnTop($h_ToolBar, "", 1)

While 1
    $msg = GUIGetMsg()
   
    if $msg = $TButton1 Then Run('notepad.exe')
       
    if $msg = $TButtonLast Then Exit
WEnd


; ************************ YOUR CODE ENDS HERE *****************************

Func XSkinToolBarCreate($XTitle, $tool_left, $tool_top, $tool_width, $tool_bkcolor = "")
    Local $Xh_ToolBar
 $Xh_ToolBar = GUICreate($XTitle, $tool_width, 24, $tool_left, $tool_top, $WS_POPUP, $WS_CLIPCHILDREN);-1, $WS_EX_STATICEDGE);, $Xh_Gui)
    If $tool_bkcolor <> "" Then GUISetBkColor($tool_bkcolor, $Xh_ToolBar)
    Return $Xh_ToolBar
EndFunc   ;==>XSkinToolBarCreate

Func XSkinToolBarButton($iNumber, $iDLL = "shell32.dll")
    Local $Xhadd, $TBBleft
    $TBcnt = $TBcnt + 1
    $TBBleft = $TBcnt * 24
    $Xhadd = GUICtrlCreateButton("", $TBBleft, 1, 24, 24, $BS_ICON)
    GUICtrlSetImage($Xhadd, $iDLL, $iNumber, 0)
    Return $Xhadd
EndFunc   ;==>XSkinToolBarButton

Func XSkinToolBarSeparator()
    Local $TBBleft
    $TBcnt = $TBcnt + .5
    $TBBleft = $TBcnt * 24
    GUICtrlCreateLabel("", $TBBleft + 17, 2, 2, 22, $SS_ETCHEDVERT, $GUI_WS_EX_PARENTDRAG)
EndFunc   ;==>XSkinToolBarSeparator

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

This works like a champ. Quick question though, I tried to apply my caveman logic to this app and swapped the w/x with the h/y for a vertical bar. It seemed to work fine but choked on the seperator. I thought I could get away with switching the $SS_ETCHEDVERT for $SS_ETCHEDHORIZ but it still collapsed on drawing the divider. I probably just messed up on the measuring variables somewhere, unless you can think of something that would prevent it from working?

Thanks again.

Link to comment
Share on other sites

  • Moderators

This works like a champ. Quick question though, I tried to apply my caveman logic to this app and swapped the w/x with the h/y for a vertical bar. It seemed to work fine but choked on the seperator. I thought I could get away with switching the $SS_ETCHEDVERT for $SS_ETCHEDHORIZ but it still collapsed on drawing the divider. I probably just messed up on the measuring variables somewhere, unless you can think of something that would prevent it from working?

Thanks again.

Do you have a simple example reproducing the error so those that wish to help don't have to go too far out of their way to recreate the issue your having? :whistle:

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Good work AGAIN. I'll be using it.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

  • 1 month later...

I've tried the Dll example and it works great and no I'm not surprised.

Before I start experimenting I may as well just ask now.

Am I correct in assuing that the Dll example will also be valid for an icl file by changing shell32.dll to the icl path/file or would I have to use one of the other examples?

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I've tried the Dll example and it works great and no I'm not surprised.

Before I start experimenting I may as well just ask now.

Am I correct in assuing that the Dll example will also be valid for an icl file by changing shell32.dll to the icl path/file or would I have to use one of the other examples?

With a simple Test... you will see

( but please let me know too... lol )

8)

NEWHeader1.png

Link to comment
Share on other sites

  • 1 year later...

script updated:

CODE
#include <GUIConstantsEX.au3>

#include <windowsconstants.au3>

#include <buttonconstants.au3>

#include <StaticConstants.au3>

;Opt("MustDeclareVars", 1)

; ver 1.0.0

; $h_ToolBar = XSkinToolBarCreate($Xh_Gui, $tool_left, $tool_top, $tool_width, $tool_bkcolor = "")

; XSkinToolBarButton($iNumber, $iDLL = "shell32.dll")

; XSkinToolBarSeparator()

Global $TBcnt = -1

; ************************ YOUR CODE GOES BELOW HERE *****************************

$h_ToolBar = XSkinToolBarCreate("Float-ToolBar", 200, 200, 324)

$TButton1 = XSkinToolBarButton( "", @WindowsDir & "\notepad.exe")

; #1 - Using Icons from a dll ( shell32.dll is default)

XSkinToolBarButton(21)

XSkinToolBarButton(17)

XSkinToolBarButton(44)

XSkinToolBarSeparator()

GUICtrlSetTip( -1, "Drag Me")

; #2 - Using Icons from an exe file

XSkinToolBarButton(22)

XSkinToolBarButton("", @ProgramFilesDir & "\Internet Explorer\iexplore.exe")

XSkinToolBarButton( "", @WindowsDir & "\explorer.exe")

XSkinToolBarButton( "", @SystemDir & "\calc.exe")

XSkinToolBarSeparator()

GUICtrlSetTip( -1, "Drag Me")

; #3 - Using Icons from an ico file

XSkinToolBarButton("", @ScriptDir & "\Skins\Default-ToolBar\Admin Tools.ico")

XSkinToolBarButton("", @ScriptDir & "\Skins\Default-ToolBar\Control Panel.ico")

XSkinToolBarButton("", @ScriptDir & "\Skins\Default-ToolBar\E-Mail.ico")

; Exit Button

XSkinToolBarSeparator()

GUICtrlSetTip( -1, "Drag Me")

$TButtonLast = XSkinToolBarButton(27)

GUISetState(@SW_SHOW, $h_ToolBar)

WinSetOnTop($h_ToolBar, "", 1)

While 1

$msg = GUIGetMsg()

if $msg = $TButton1 Then Run('notepad.exe')

if $msg = $TButtonLast Then Exit

WEnd

; ************************ YOUR CODE ENDS HERE *****************************

Func XSkinToolBarCreate($XTitle, $tool_left, $tool_top, $tool_width, $tool_bkcolor = "")

Local $Xh_ToolBar

$Xh_ToolBar = GUICreate($XTitle, $tool_width, 24, $tool_left, $tool_top, $WS_POPUP, $WS_CLIPCHILDREN);-1, $WS_EX_STATICEDGE);, $Xh_Gui)

If $tool_bkcolor <> "" Then GUISetBkColor($tool_bkcolor, $Xh_ToolBar)

Return $Xh_ToolBar

EndFunc ;==>XSkinToolBarCreate

Func XSkinToolBarButton($iNumber, $iDLL = "shell32.dll")

Local $Xhadd, $TBBleft

$TBcnt = $TBcnt + 1

$TBBleft = $TBcnt * 24

$Xhadd = GUICtrlCreateButton("", $TBBleft, 1, 24, 24, $BS_ICON)

GUICtrlSetImage($Xhadd, $iDLL, $iNumber, 0)

Return $Xhadd

EndFunc ;==>XSkinToolBarButton

Func XSkinToolBarSeparator()

Local $TBBleft

$TBcnt = $TBcnt + .5

$TBBleft = $TBcnt * 24

GUICtrlCreateLabel("", $TBBleft + 17, 2, 2, 22, $SS_ETCHEDVERT, $GUI_WS_EX_PARENTDRAG)

EndFunc ;==>XSkinToolBarSeparator

Link to comment
Share on other sites

  • 5 weeks later...
  • 1 month later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...