Sign in to follow this  
Followers 0
lsakizada

How to color the background of a Toolbar control?

9 posts in this topic

How to color the background of a Toolbar control?

Here is an example code.

The GUICtrlSetBkColor ( $hToolbar, 0xE0F0FE )does not working?

Thanks in advanced!

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GuiMenu.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global Enum $idNew2 = 1000, $idOpen2, $idSave2, $idExit2, $idCut2, $idCopy2, $idPaste2, $idAbout2
_Main()

Func _Main()
    Local $hGUI, $hToolbar
    Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
Local  $hFile, $hEdit, $hHelp, $hMain
    ; Create GUI
    $hGUI = GUICreate("Toolbar", 400, 300)
    GUISetBkColor(0xE0F0FE)
    $hToolbar = _GUICtrlToolbar_Create ($hGUI)
    GUICtrlSetBkColor ( $hToolbar, 0xE0F0FE )

    GUISetState()

; Create File menu
    $hFile = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew2)
    _GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen2)
    _GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave2)
    _GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
    _GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit2)

    ; Create Edit menu
    $hEdit = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut2)
    _GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy2)
    _GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste2)

    ; Create Help menu
    $hHelp = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout2)

    ; Create Main menu
    $hMain = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
    _GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
    _GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

    ; Set window menu
    _GUICtrlMenu_SetMenu ($hGUI, $hMain)

    ; Add standard system bitmaps
    _GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

    ; Add buttons
    _GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
    _GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
    _GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
    _GUICtrlToolbar_AddButtonSep ($hToolbar)
    _GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

    ; Disable Help button
    _GUICtrlToolbar_EnableButton ($hToolbar, $idHelp, False)
    ; Loop until user exits

Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>_Main

Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites



lsakizada,

From what I can find on Google, you cannot set the back colour of a Tool bar. ;)

But what you can do is to make the toolbar transparent and put it over a child window whose back colour you can change. :)

Take a look at this:

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GuiMenu.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global Enum $idNew2 = 1000, $idOpen2, $idSave2, $idExit2, $idCut2, $idCopy2, $idPaste2, $idAbout2
_Main()

Func _Main()
    Local $hGUI, $hToolbar
    Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
    Local  $hFile, $hEdit, $hHelp, $hMain

    ; Create main GUI
    $hGUI = GUICreate("Toolbar", 400, 300)
    GUISetBkColor(0xE0F0FE)
    Local $hExit = GUICtrlCreateButton("Exit", 10, 100, 80, 30)
    GUISetState()

    ; Create tool bar child <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    Local $hTB_Win = GUICreate("", 400, 40, -1, -1, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
    GUISetBkColor(0xFF8888, $hTB_Win)
    GUISetState()
    ; Get into position
    Local $aWin_Pos = WinGetPos($hGUI)
    Local $iBorder = _WinAPI_GetSystemMetrics(8) ; Border width
    Local $iBar = _WinAPI_GetSystemMetrics(4) ; Title bar height
    WinMove($hTB_Win, "", $aWin_Pos[0] + $iBorder, $aWin_Pos[1] + $iBorder + $iBar)
    
    ; Create the toolbar in the child
    $hToolbar = _GUICtrlToolbar_Create ($hTB_Win)

; Create File menu
    $hFile = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew2)
    _GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen2)
    _GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave2)
    _GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
    _GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit2)

    ; Create Edit menu
    $hEdit = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut2)
    _GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy2)
    _GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste2)

    ; Create Help menu
    $hHelp = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout2)

    ; Create Main menu
    $hMain = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
    _GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
    _GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

    ; Set window menu
    _GUICtrlMenu_SetMenu ($hGUI, $hMain)

    ; Add standard system bitmaps
    _GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

    ; Add buttons
    _GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
    _GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
    _GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
    _GUICtrlToolbar_AddButtonSep ($hToolbar)
    _GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

    ; Disable Help button
    _GUICtrlToolbar_EnableButton ($hToolbar, $idHelp, False)
    
    ; Make tool bar transparent   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    GUISetState(@SW_LOCK)
    _GUICtrlToolbar_SetStyleTransparent($hToolbar, True)
    GUISetState(@SW_UNLOCK)


    ; Loop until user exits
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $hExit
                Exit
        EndSwitch
    WEnd
    
EndFunc   ;==>_Main

I hope this helps you in your project.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Very good idea Melba23, but it will also work without _GUICtrlToolbar_SetStyleTransparent and without SystemMetrics Posted Image

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GuiMenu.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global Enum $idNew2 = 1000, $idOpen2, $idSave2, $idExit2, $idCut2, $idCopy2, $idPaste2, $idAbout2
_Main()

Func _Main()
    Local $hGUI, $hToolbar
    Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
    Local  $hFile, $hEdit, $hHelp, $hMain

    ; Create main GUI
    $hGUI = GUICreate("Toolbar", 400, 300)
    GUISetBkColor(0xE0F0FE)
    Local $hExit = GUICtrlCreateButton("Exit", 10, 100, 80, 30)

    ; Create tool bar child <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    Local $hTB_Win = GUICreate("", 400, 32, 0, 0, 0x40000000, 0, $hGUI)
    GUISetBkColor(0xFF8888, $hTB_Win)
    GUISetState()

    ; Create the toolbar in the child
    $hToolbar = _GUICtrlToolbar_Create ($hTB_Win)

; Create File menu
    $hFile = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew2)
    _GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen2)
    _GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave2)
    _GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
    _GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit2)

    ; Create Edit menu
    $hEdit = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut2)
    _GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy2)
    _GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste2)

    ; Create Help menu
    $hHelp = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout2)

    ; Create Main menu
    $hMain = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
    _GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
    _GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

    ; Set window menu
    _GUICtrlMenu_SetMenu ($hGUI, $hMain)

    ; Add standard system bitmaps
    _GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

    ; Add buttons
    _GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
    _GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
    _GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
    _GUICtrlToolbar_AddButtonSep ($hToolbar)
    _GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

    ; Disable Help button
    _GUICtrlToolbar_EnableButton ($hToolbar, $idHelp, False)

    GUISetState(@SW_SHOW, $hGUI)

    ; Loop until user exits
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $hExit
                Exit
        EndSwitch
    WEnd

EndFunc   ;==>_Main

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

funkey,

Not using SystemMetrics is cheating! Are you sure the correct value will be 32 on all systems? ;)

But I am facinated that you do not need a transparent ToolBar - what use is the function if it is not needed? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

lsakizada,

From what I can find on Google, you cannot set the back colour of a Tool bar. ;)

But what you can do is to make the toolbar transparent and put it over a child window whose back colour you can change. :)

Take a look at this:

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GuiMenu.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global Enum $idNew2 = 1000, $idOpen2, $idSave2, $idExit2, $idCut2, $idCopy2, $idPaste2, $idAbout2
_Main()

Func _Main()
    Local $hGUI, $hToolbar
    Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
    Local  $hFile, $hEdit, $hHelp, $hMain

    ; Create main GUI
    $hGUI = GUICreate("Toolbar", 400, 300)
    GUISetBkColor(0xE0F0FE)
    Local $hExit = GUICtrlCreateButton("Exit", 10, 100, 80, 30)
    GUISetState()

    ; Create tool bar child <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    Local $hTB_Win = GUICreate("", 400, 40, -1, -1, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
    GUISetBkColor(0xFF8888, $hTB_Win)
    GUISetState()
    ; Get into position
    Local $aWin_Pos = WinGetPos($hGUI)
    Local $iBorder = _WinAPI_GetSystemMetrics(8) ; Border width
    Local $iBar = _WinAPI_GetSystemMetrics(4) ; Title bar height
    WinMove($hTB_Win, "", $aWin_Pos[0] + $iBorder, $aWin_Pos[1] + $iBorder + $iBar)
    
    ; Create the toolbar in the child
    $hToolbar = _GUICtrlToolbar_Create ($hTB_Win)

; Create File menu
    $hFile = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew2)
    _GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen2)
    _GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave2)
    _GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
    _GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit2)

    ; Create Edit menu
    $hEdit = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut2)
    _GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy2)
    _GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste2)

    ; Create Help menu
    $hHelp = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout2)

    ; Create Main menu
    $hMain = _GUICtrlMenu_CreateMenu ()
    _GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
    _GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
    _GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

    ; Set window menu
    _GUICtrlMenu_SetMenu ($hGUI, $hMain)

    ; Add standard system bitmaps
    _GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

    ; Add buttons
    _GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
    _GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
    _GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
    _GUICtrlToolbar_AddButtonSep ($hToolbar)
    _GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

    ; Disable Help button
    _GUICtrlToolbar_EnableButton ($hToolbar, $idHelp, False)
    
    ; Make tool bar transparent   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    GUISetState(@SW_LOCK)
    _GUICtrlToolbar_SetStyleTransparent($hToolbar, True)
    GUISetState(@SW_UNLOCK)


    ; Loop until user exits
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $hExit
                Exit
        EndSwitch
    WEnd
    
EndFunc   ;==>_Main

I hope this helps you in your project.

M23

Hi Melba23 I am very sorry, I posted false description.

I wanted to set the background of the menu control NOT the Toolbar!

Can you please add some more effort?

realy sorry for the false title


Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

M23

Yes you are right :)

I was eating beens while I posted the topic, and that's was the result.

I am looking now into the MoidernMenu UDF to see if I could find there help...

Best Regards!


Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites

lsakizada,

Never lose hope - it took a bit longer, but we got there. The problem was that you must be able to click through the coloured GUI overlay.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

$hGUI = GUICreate("Test", 500, 500)

; Create menu
Global $mFile_Menu = GUICtrlCreateMenu("&Click")
Global $hHide_Menu_Item = GUICtrlCreateMenuItem("&Melba23", $mFile_Menu)
GUICtrlCreateMenuItem("", $mFile_Menu) ; separator line
Global $hExit_Menu_Item = GUICtrlCreateMenuItem("  Rules!", $mFile_Menu)

GUISetState()

$hMenu_Overlay = GUICreate("", 500, 20, -1, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TRANSPARENT, $WS_EX_MDICHILD), $hGUI)
GUISetState()
GUISetBkColor(0xFF8888)
; Move to correct position
Local $aWin_Pos = WinGetPos($hGUI)
Local $iBorder = _WinAPI_GetSystemMetrics(8) ; Border width
Local $iBar = _WinAPI_GetSystemMetrics(4) ; Title bar height
WinMove($hMenu_Overlay, "", $aWin_Pos[0] + $iBorder, $aWin_Pos[1] + $iBorder + $iBar)
WinSetTrans($hMenu_Overlay, "", 64)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

The only problem left is that the menu items look a bit pale until you have clicked on the one of them - I will look into that tomorow if it is too wet to play a round of golf! ;)

I hope that what you were looking for? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

lsakizada,

Never lose hope - it took a bit longer, but we got there. The problem was that you must be able to click through the coloured GUI overlay.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

$hGUI = GUICreate("Test", 500, 500)

; Create menu
Global $mFile_Menu = GUICtrlCreateMenu("&Click")
Global $hHide_Menu_Item = GUICtrlCreateMenuItem("&Melba23", $mFile_Menu)
GUICtrlCreateMenuItem("", $mFile_Menu) ; separator line
Global $hExit_Menu_Item = GUICtrlCreateMenuItem("  Rules!", $mFile_Menu)

GUISetState()

$hMenu_Overlay = GUICreate("", 500, 20, -1, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TRANSPARENT, $WS_EX_MDICHILD), $hGUI)
GUISetState()
GUISetBkColor(0xFF8888)
; Move to correct position
Local $aWin_Pos = WinGetPos($hGUI)
Local $iBorder = _WinAPI_GetSystemMetrics(8) ; Border width
Local $iBar = _WinAPI_GetSystemMetrics(4) ; Title bar height
WinMove($hMenu_Overlay, "", $aWin_Pos[0] + $iBorder, $aWin_Pos[1] + $iBorder + $iBar)
WinSetTrans($hMenu_Overlay, "", 64)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

The only problem left is that the menu items look a bit pale until you have clicked on the one of them - I will look into that tomorow if it is too wet to play a round of golf! ;)

I hope that what you were looking for? :)

M23

Hi Melba23, this is cute.

You are setting child app above the menu bar with sort of transparencey.

It is working that way but for me it is too expensive to manage the child GUI because my application has many other childs

forms opened at same time. It is some kind of layer.

Regards!


Be Green Now or Never (BGNN)!

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  
Followers 0