Jump to content

want to know how to replicate this Gui


Go to solution Solved by Melba23,

Recommended Posts

Posted

hi guys, i was wondering if anyone knew how to replicate the following feature, a menubar on a listview i think it is :s

 

uhu.png

thanx in advance

and proud of it!!!
Posted

If I good understand you (and good see it) ,

You trying to add separate menu inside each Tab , or something similar ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

You can add Labels and PopUp menu for each Label.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Moderators
Posted

damian666,

I would do it using child GUIS like this: ;)

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

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

$cTab = GUICtrlCreateTab(10, 10, 480, 300)

$cTabItem_0 = GUICtrlCreateTabItem("Tab 0")

$cTabItem_1 = GUICtrlCreateTabItem("Tab 1")

$cTabItem_2 = GUICtrlCreateTabItem("Tab 2")

GUICtrlCreateTabItem("")

GUISetState(@SW_SHOW, $hGUI)

; Get tab position
$aTab_Pos = ControlGetPos($hGUI, "", $cTab)
; Get size of user area
$aTab_Rect = _GUICtrlTab_GetItemRect($cTab, 0)

; Create Child GUIs
$hChild_0 = GUICreate("Child 0", $aTab_Pos[2] - 6, $aTab_Pos[3] - $aTab_Rect[3] - 6, $aTab_Pos[0] + 2, $aTab_Pos[1] + $aTab_Rect[3] + 2, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
GUICtrlCreateMenu("Menu 00")
GUICtrlCreateMenu("Menu 01")
GUICtrlCreateMenu("Menu 02")
$aClient = WinGetClientSize($hChild_0)
GUICtrlCreateListView("Col 00|Col 01|Col 02", 10, 10, $aClient[0] - 20, $aClient[1] - 20)
GUISetState(@SW_SHOW, $hChild_0)
GUISetBkColor(0xFFCCCC, $hChild_0)

$hChild_1 = GUICreate("Child 1", $aTab_Pos[2] - 6, $aTab_Pos[3] - $aTab_Rect[3] - 6, $aTab_Pos[0] + 2, $aTab_Pos[1] + $aTab_Rect[3] + 2, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
GUICtrlCreateMenu("Menu 10")
GUICtrlCreateMenu("Menu 21")
GUICtrlCreateMenu("Menu 32")
GUICtrlCreateListView("Col 10|Col 11|Col 12", 10, 10, $aClient[0] - 20, $aClient[1] - 20)
GUISetBkColor(0xCCFFCC, $hChild_1)
GUISetState(@SW_HIDE, $hChild_1)

$hChild_2 = GUICreate("Child 2", $aTab_Pos[2] - 6, $aTab_Pos[3] - $aTab_Rect[3] - 6, $aTab_Pos[0] + 2, $aTab_Pos[1] + $aTab_Rect[3] + 2, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
GUICtrlCreateMenu("Menu 20")
GUICtrlCreateMenu("Menu 21")
GUICtrlCreateMenu("Menu 22")
GUICtrlCreateListView("Col 20|Col 21|Col 20", 10, 10, $aClient[0] - 20, $aClient[1] - 20)
GUISetBkColor(0xCCCCFF, $hChild_2)
GUISetState(@SW_HIDE, $hChild_2)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cTab
            Switch GUICtrlRead($cTab)
                Case 0
                    _HideAll()
                    GUISetState(@SW_SHOW, $hChild_0)
                Case 1
                    _HideAll()
                    GUISetState(@SW_SHOW, $hChild_1)
                Case 2
                    _HideAll()
                    GUISetState(@SW_SHOW, $hChild_2)
            EndSwitch
    EndSwitch
WEnd

Func _HideAll()
    GUISetState(@SW_HIDE, $hChild_0)
    GUISetState(@SW_HIDE, $hChild_1)
    GUISetState(@SW_HIDE, $hChild_2)
EndFunc
Please ask if you have any questions. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

  • Moderators
  • Solution
Posted

damian666,

 

  Quote

thats a lot of code for such a little feature

If you want a menu control inside a tab control I can see no other way of doing it - making a user-drawn menu bar would be a lot more work. :)

 

  Quote

does this work with Opt("GUIOnEventMode", 1) ?

Did you even try? ;)

  Reveal hidden contents

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

to be honest, no i didnt, i had no clue how to modify the code from the example to onevent mode, i always use o event, never use the other way xd

i think your right, this is the best way, thank you very much :)

dami

and proud of it!!!

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
  • Recently Browsing   0 members

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