Jump to content

Need help with toolbar


Recommended Posts

Can someone help me look:

#include <GUIConstantsEx.au3>
#Include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>



$Fenster = GUICreate("TEST TEST TEST", 460, 490)
GUISetState(@SW_SHOW)
;Toolbar--------------------------------------------------------------
$hToolbar= _GUICtrlToolbar_Create($Fenster)
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
$1=_GUICtrlToolbar_AddButton ($hToolbar, 1000, $STD_FILENEW)
$2=_GUICtrlToolbar_AddButton ($hToolbar, 1000, $STD_FILEOPEN)
$3=_GUICtrlToolbar_AddButton ($hToolbar, 1000, $STD_FILESAVE)
$4=_GUICtrlToolbar_AddButtonSep ($hToolbar)
$5=_GUICtrlToolbar_AddButton ($hToolbar, 1000, $STD_HELP)


While 1
    $msg = GUIGetMsg(1)
        Select
            Case $msg[0] = $GUI_EVENT_CLOSE 
                    Exit
                Case $msg[0] = $1
                    MsgBox(0,"TEST","This is a Test")
        EndSelect
WEnd

If I start this every second opens the msgbox but I want if I click the button the msgbox will open.

So can someone help me

Link to comment
Share on other sites

Can someone help me look:

#include <GUIConstantsEx.au3>
#Include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>



$Fenster = GUICreate("TEST TEST TEST", 460, 490)
GUISetState(@SW_SHOW)
;Toolbar--------------------------------------------------------------
$hToolbar= _GUICtrlToolbar_Create($Fenster)
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
$1=_GUICtrlToolbar_AddButton ($hToolbar, 1000, $STD_FILENEW)
$2=_GUICtrlToolbar_AddButton ($hToolbar, 1000, $STD_FILEOPEN)
$3=_GUICtrlToolbar_AddButton ($hToolbar, 1000, $STD_FILESAVE)
$4=_GUICtrlToolbar_AddButtonSep ($hToolbar)
$5=_GUICtrlToolbar_AddButton ($hToolbar, 1000, $STD_HELP)


While 1
    $msg = GUIGetMsg(1)
        Select
            Case $msg[0] = $GUI_EVENT_CLOSE 
                    Exit
                Case $msg[0] = $1
                    MsgBox(0,"TEST","This is a Test")
        EndSelect
WEnd

If I start this every second opens the msgbox but I want if I click the button the msgbox will open.

So can someone help me

Toolbars don't work like that. Every control in the toolbar needs its own ID; only one should have the ID 1000. The return from _GUICtrlToolbar_AddButton is a boolean value not an id, so you are testing if $msg[0] is true.

Have a look at the example in the help for _GUICtrlToolbar_Create which will show you how to use a toolbar.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
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
 Share

  • Recently Browsing   0 members

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