Bert Posted June 17, 2008 Share Posted June 17, 2008 I'm using _GUICtrlToolbar_Create in the process to make a text editor. I want to be able to add a combo box so I can add the ability to change what font being used. I tried using GUICtrlCreateCombo, but I can't see it in the toolbar. How do I add a combo to the toolbar? Here is my code so far. expandcollapse popup#include <GuiToolbar.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.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 $hToolbar, $iMemo, $z, $file_save, $path_save, $file_open, $path_open Global $iItem; Command identifier of the button associated with the notification. Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp Global $cfg = @ScriptDir &"/settings.cfg" _Main() Func _Main() Local $hGUI, $aSize, $aStrings[4], $w = @DesktopWidth - 150, $h = @DesktopHeight - 150 ; Create GUI $hGUI = GUICreate("Transdumper Test Editor",$w , $h) $hToolbar = _GUICtrlToolbar_Create ($hGUI) $aSize = _GUICtrlToolbar_GetMaxSize ($hToolbar) $iMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 15, $w - 2, ($h - 2) - ($aSize[1] + 15), $WS_VSCROLL) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUISetState() GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") ; Add standard system bitmaps _GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) ; Add buttons _GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW, $aStrings[0]) _GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1]) _GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2]) _GUICtrlToolbar_AddButtonSep ($hToolbar) _GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_PRINT, $aStrings[3]) ;------------------------------------------------------- ;add combo here on the row of buttons. how??? ;------------------------------------------------------- Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main ; Write message to memo Func MemoWrite($sMessage = "") GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite ; WM_NOTIFY event handler Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld Local $tNMTOOLBAR, $tNMTBHOTITEM $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom") $idFrom = DllStructGetData($tNMHDR, "IDFrom") $code = DllStructGetData($tNMHDR, "Code") Switch $hwndFrom Case $hToolbar Switch $code Case $NM_LDOWN ;---------------------------------------------------------------------------------------------- Select case $iItem = 1000 MsgBox(0, "", "new file") case $iItem = 1001 $path_open = IniRead($cfg, "1", "pathopen", @ScriptDir) $file_open = FileopenDialog("Open Test for Editing", $path_save, "Text files (*.txt)", 3) MsgBox(0, "", $file_open) case $iItem = 1002 $path_save = IniRead($cfg, "1", "filesave", @ScriptDir) $file_save = FileopenDialog("Save Test", $path_save, "Text files (*.txt)", 18) MsgBox(0, "", $file_save) case $iItem = 1003 MsgBox(0, "", "printing") EndSelect ;---------------------------------------------------------------------------------------------- Case $TBN_HOTITEMCHANGE $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam) $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld") $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew") $iItem = $i_idNew $dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
NELyon Posted June 17, 2008 Share Posted June 17, 2008 expandcollapse popup#include <GuiToolbar.au3> #Include <GUIComboBox.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.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 $hToolbar, $iMemo, $z, $file_save, $path_save, $file_open, $path_open, $hCombo Global $iItem; Command identifier of the button associated with the notification. Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp Global $cfg = @ScriptDir &"/settings.cfg" _Main() Func _Main() Local $hGUI, $aSize, $aStrings[4], $w = @DesktopWidth - 150, $h = @DesktopHeight - 150 ; Create GUI $hGUI = GUICreate("Transdumper Test Editor",$w , $h) $hToolbar = _GUICtrlToolbar_Create ($hGUI) $aSize = _GUICtrlToolbar_GetMaxSize ($hToolbar) $iMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 15, $w - 2, ($h - 2) - ($aSize[1] + 15), $WS_VSCROLL) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUISetState() GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") ; Add standard system bitmaps _GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) ; Add buttons _GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW, $aStrings[0]) _GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1]) _GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2]) _GUICtrlToolbar_AddButtonSep ($hToolbar) _GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_PRINT, $aStrings[3]) $hCombo = _GUICtrlComboBox_Create($hToolbar, "Test", 500, 5) ;------------------------------------------------------- ;add combo here on the row of buttons. how??? ;------------------------------------------------------- Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main ; Write message to memo Func MemoWrite($sMessage = "") GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite ; WM_NOTIFY event handler Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld Local $tNMTOOLBAR, $tNMTBHOTITEM $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom") $idFrom = DllStructGetData($tNMHDR, "IDFrom") $code = DllStructGetData($tNMHDR, "Code") Switch $hwndFrom Case $hToolbar Switch $code Case $NM_LDOWN ;---------------------------------------------------------------------------------------------- Select case $iItem = 1000 MsgBox(0, "", "new file") case $iItem = 1001 $path_open = IniRead($cfg, "1", "pathopen", @ScriptDir) $file_open = FileopenDialog("Open Test for Editing", $path_save, "Text files (*.txt)", 3) MsgBox(0, "", $file_open) case $iItem = 1002 $path_save = IniRead($cfg, "1", "filesave", @ScriptDir) $file_save = FileopenDialog("Save Test", $path_save, "Text files (*.txt)", 18) MsgBox(0, "", $file_save) case $iItem = 1003 MsgBox(0, "", "printing") EndSelect ;---------------------------------------------------------------------------------------------- Case $TBN_HOTITEMCHANGE $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam) $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld") $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew") $iItem = $i_idNew $dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY Link to comment Share on other sites More sharing options...
GaryFrost Posted June 17, 2008 Share Posted June 17, 2008 _GUICtrlRebar_AddBand SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Bert Posted June 17, 2008 Author Share Posted June 17, 2008 Thanks Gary! There are so many more things now...It is like a kid in a candy store! The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now