Cr�e un contr�le Rebar, conteneur de rubans, contenant eux-m�mes des contr�les
#include <GuiReBar.au3>
_GUICtrlRebar_Create ( $hWnd [, $iStyles = 0x513] )
$hWnd | Handle du parent ou de la fen�tre prori�taire |
$iStyles | [optionnel] Le contr�le Rebar prend en charge une vari�t� de styles de contr�le en plus des styles standards de fen�tre: $RBS_AUTOSIZE - Version 4.71. Le contr�le Rebar changera automatiquement la pr�sentation des rubans lorsque la taille ou la position d'un contr�le change. Une notification $RBN_AUTOSIZE sera envoy� lorsque cela se produit $RBS_BANDBORDERS - Version 4.71. Le contr�le Rebar affiche des lignes en pointill�s pour s�parer deux bandes adjacentes $RBS_DBLCLKTOGGLE - Version 4.71. Le ruban d'un Rebar bascule d'un �tat maximis� � un �tat minimis� lorsque l'utilisateur double-clique sur le ruban. Sans ce style, l'�tat maximis� ou minimis� est commut� lorsque l'utilisateur fait un simple clic sur la bande $RBS_FIXEDORDER - Version 4.70. Le contr�le Rebar affiche toujours les rubans dans le m�me ordre. Vous pouvez d�placer des rubans d'une rang�e � l'autre, mais l'ordre des ruban est inchang�. $RBS_REGISTERDROP - Version 4.71. Le contr�le Rebar g�n�re le message de notification $RBN_GETOBJECT lorsqu'un objet est d�plac� sur une bande du contr�le $RBS_TOOLTIPS - Version 4.71. Pas encore pris en charge $RBS_VARHEIGHT - Version 4.71. Le contr�le Rebar affiche des bandes de hauteur minimale, lorsque cela est possible. Sans ce style, le contr�le Rebar affiche toutes les bandes � la m�me hauteur, en utilisant la hauteur de la bande visible la plus haute pour d�terminer la hauteur des autres bandes. $RBS_VERTICALGRIPPER - Version 4.71. La poign�e de redimensionnement sera affich� verticalement au lieu d'horizontalement dans un contr�le Rebar vertical. Ce style est ignor� pour les contr�les Rebar qui n'ont pas le style $CCS_VERT. $CCS_LEFT - Version 4.70. Le contr�le Rebar s'affiche verticalement sur le c�t� gauche de la fen�tre parent $CCS_NODIVIDER - Emp�che la ligne de s�paration avec la barre de titre d'�tre dessin� dans le haut du contr�le $CCS_RIGHT - Version 4.70. Le contr�le Rebar s'affiche verticalement sur le c�t� droit de la fen�tre parent $CCS_VERT - Version 4.70. Force le contr�le � s'afficher verticalement Par d�faut: $CCS_TOP, $RBS_VARHEIGHT For��: $WS_CHILD, $WS_VISIBLE, $WS_CLIPCHILDREN, $WS_CLIPSIBLINGS |
Succ�s: | Retourne le handle du contr�le Rebar. |
�chec: | D�finit @error <> 0. |
#include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <GuiDateTimePicker.au3> #include <GuiEdit.au3> #include <GuiReBar.au3> #include <GuiToolbar.au3> #include <WinAPIConstants.au3> #include <WindowsConstants.au3> Global $g_hReBar Example() Func Example() Local $hGui, $idBtnExit, $hToolbar, $hCombo, $hDTP, $hInput, $msg Local Enum $e_idNew = 1000, $e_idOpen, $e_idSave, $idHelp $hGui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX)) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; Cr�e un contr�le rebar $g_hReBar = _GUICtrlRebar_Create($hGui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS)) ; Cr�e un contr�le toolbar pour le placer dans le rebar $hToolbar = _GUICtrlToolbar_Create($hGui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN)) ; Ajoute des bitmaps syst�me standards Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar) Case 0 _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR) Case 2 _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) EndSwitch ; Ajoute des boutons _GUICtrlToolbar_AddButton($hToolbar, $e_idNew, $STD_FILENEW) _GUICtrlToolbar_AddButton($hToolbar, $e_idOpen, $STD_FILEOPEN) _GUICtrlToolbar_AddButton($hToolbar, $e_idSave, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP) ; Cr�e un combobox pour le placer dans le rebar $hCombo = _GUICtrlComboBox_Create($hGui, "", 0, 0, 120) _GUICtrlComboBox_BeginUpdate($hCombo) _GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe") _GUICtrlComboBox_EndUpdate($hCombo) ; Cr�e un DTP (date time picker) pour le placer dans le rebar $hDTP = _GUICtrlDTP_Create($hGui, 0, 0, 190) ; Cr�e un inputbox pour le placer dans le rebar ; $hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20) $hInput = _GUICtrlEdit_Create($hGui, "Input control", 0, 0, 120, 20) ; L'op�ration add par d�faut est append ; Ajoute un ruban avec le combobox _GUICtrlRebar_AddBand($g_hReBar, $hCombo, 120, 200, "Dir *.exe") ; Ajoute un ruban avec le date time picker _GUICtrlRebar_AddBand($g_hReBar, $hDTP, 120) ; Ajoute un ruban avec le toolbar au d�but du rebar _GUICtrlRebar_AddToolBarBand($g_hReBar, $hToolbar, "", 0) ; Ajoute un ruban avec le inputbox ; _GUICtrlRebar_AddBand($g_hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:") _GUICtrlRebar_AddBand($g_hReBar, $hInput, 120, 200, "Name:") $idBtnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25) GUISetState(@SW_SHOW) Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE Or $msg = $idBtnExit EndFunc ;==>Example Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR Local $tAUTOBREAK, $tAUTOSIZE, $tNMREBAR, $tCHEVRON, $tCHILDSIZE, $tOBJECTNOTIFY $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") If $hWndFrom = $g_hReBar Then Switch $iCode Case $RBN_AUTOBREAK ; Informe le parent du contr�le rebar qu'une rupture appara�t dans la barre. Le parent d�termine quoi faire $tAUTOBREAK = DllStructCreate($tagNMREBARAUTOBREAK, $lParam) _DebugPrint("$RBN_AUTOBREAK" & @CRLF & "--> hWndFrom:" & @TAB & DllStructGetData($tAUTOBREAK, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tAUTOBREAK, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tAUTOBREAK, "Code") & @CRLF & _ "-->uBand:" & @TAB & DllStructGetData($tAUTOBREAK, "uBand") & @CRLF & _ "-->wID:" & @TAB & DllStructGetData($tAUTOBREAK, "wID") & @CRLF & _ "-->lParam:" & @TAB & DllStructGetData($tAUTOBREAK, "lParam") & @CRLF & _ "-->uMsg:" & @TAB & DllStructGetData($tAUTOBREAK, "uMsg") & @CRLF & _ "-->fStyleCurrent:" & @TAB & DllStructGetData($tAUTOBREAK, "fStyleCurrent") & @CRLF & _ "-->fAutoBreak:" & @TAB & DllStructGetData($tAUTOBREAK, "fAutoBreak")) ; Retourne une valeur non utilis�e Case $RBN_AUTOSIZE ; Envoy� par le contr�le rebar cr�e avec le style $RBS_AUTOSIZE losque le rebar automatiquement se redimensionne lui-m�me $tAUTOSIZE = DllStructCreate($tagNMRBAUTOSIZE, $lParam) _DebugPrint("$RBN_AUTOSIZE" & @CRLF & "--> hWndFrom:" & @TAB & DllStructGetData($tAUTOSIZE, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tAUTOSIZE, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tAUTOSIZE, "Code") & @CRLF & _ "-->fChanged:" & @TAB & DllStructGetData($tAUTOSIZE, "fChanged") & @CRLF & _ "-->TargetLeft:" & @TAB & DllStructGetData($tAUTOSIZE, "TargetLeft") & @CRLF & _ "-->TargetTop:" & @TAB & DllStructGetData($tAUTOSIZE, "TargetTop") & @CRLF & _ "-->TargetRight:" & @TAB & DllStructGetData($tAUTOSIZE, "TargetRight") & @CRLF & _ "-->TargetBottom:" & @TAB & DllStructGetData($tAUTOSIZE, "TargetBottom") & @CRLF & _ "-->ActualLeft:" & @TAB & DllStructGetData($tAUTOSIZE, "ActualLeft") & @CRLF & _ "-->ActualTop:" & @TAB & DllStructGetData($tAUTOSIZE, "ActualTop") & @CRLF & _ "-->ActualRight:" & @TAB & DllStructGetData($tAUTOSIZE, "ActualRight") & @CRLF & _ "-->ActualBottom:" & @TAB & DllStructGetData($tAUTOSIZE, "ActualBottom")) ; Retourne une valeur non utilis�e Case $RBN_BEGINDRAG ; Envoy� par le contr�le rebar lorsque l'utilisateur commence � tirer un ruban avec la souris $tNMREBAR = DllStructCreate($tagNMREBAR, $lParam) _DebugPrint("$RBN_BEGINDRAG" & @CRLF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMREBAR, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tNMREBAR, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tNMREBAR, "Code") & @CRLF & _ "-->dwMask:" & @TAB & DllStructGetData($tNMREBAR, "dwMask") & @CRLF & _ "-->uBand:" & @TAB & DllStructGetData($tNMREBAR, "uBand") & @CRLF & _ "-->fStyle:" & @TAB & DllStructGetData($tNMREBAR, "fStyle") & @CRLF & _ "-->wID:" & @TAB & DllStructGetData($tNMREBAR, "wID") & @CRLF & _ "-->lParam:" & @TAB & DllStructGetData($tNMREBAR, "lParam")) Return 0 ; pour permettre au rebar de continuer l'op�ration drag ; Return 1 ; non nul pour annuler l'op�ration drag Case $RBN_CHEVRONPUSHED ; Envoy� par le contr�le rebar lorsque l'utilisateur pousse un chevron ; Quand une application re�oit cette notification, elle doit se charger d'afficher un menu d�roulant avec des �l�ments pour chaque outil cach�. ; Utilisez le membre rc de la structure NMREBARCHEVRON pour trouver la position correcte du menu d�roulant $tCHEVRON = DllStructCreate($tagNMREBARCHEVRON, $lParam) _DebugPrint("$RBN_CHEVRONPUSHED" & @CRLF & "--> hWndFrom:" & @TAB & DllStructGetData($tCHEVRON, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tCHEVRON, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tCHEVRON, "Code") & @CRLF & _ "-->uBand:" & @TAB & DllStructGetData($tCHEVRON, "uBand") & @CRLF & _ "-->wID:" & @TAB & DllStructGetData($tCHEVRON, "wID") & @CRLF & _ "-->lParam:" & @TAB & DllStructGetData($tCHEVRON, "lParam") & @CRLF & _ "-->Left:" & @TAB & DllStructGetData($tCHEVRON, "Left") & @CRLF & _ "-->Top:" & @TAB & DllStructGetData($tCHEVRON, "Top") & @CRLF & _ "-->Right:" & @TAB & DllStructGetData($tCHEVRON, "Right") & @CRLF & _ "-->lParamNM:" & @TAB & DllStructGetData($tCHEVRON, "lParamNM")) ; Retourne une valeur non utilis�e Case $RBN_CHILDSIZE ; Envoy� par le contr�le rebar lorsqu'un ruban d'une fen�tre enfant est redimensionn� $tCHILDSIZE = DllStructCreate($tagNMREBARCHILDSIZE, $lParam) _DebugPrint("$RBN_CHILDSIZE" & @CRLF & "--> hWndFrom:" & @TAB & DllStructGetData($tCHILDSIZE, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tCHILDSIZE, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tCHILDSIZE, "Code") & @CRLF & _ "-->uBand:" & @TAB & DllStructGetData($tCHILDSIZE, "uBand") & @CRLF & _ "-->wID:" & @TAB & DllStructGetData($tCHILDSIZE, "wID") & @CRLF & _ "-->CLeft:" & @TAB & DllStructGetData($tCHILDSIZE, "CLeft") & @CRLF & _ "-->CTop:" & @TAB & DllStructGetData($tCHILDSIZE, "CTop") & @CRLF & _ "-->CRight:" & @TAB & DllStructGetData($tCHILDSIZE, "CRight") & @CRLF & _ "-->CBottom:" & @TAB & DllStructGetData($tCHILDSIZE, "CBottom") & @CRLF & _ "-->BLeft:" & @TAB & DllStructGetData($tCHILDSIZE, "BandLeft") & @CRLF & _ "-->BTop:" & @TAB & DllStructGetData($tCHILDSIZE, "BTop") & @CRLF & _ "-->BRight:" & @TAB & DllStructGetData($tCHILDSIZE, "BRight") & @CRLF & _ "-->BBottom:" & @TAB & DllStructGetData($tCHILDSIZE, "BBottom")) ; Retourne une valeur non utilis�e Case $RBN_DELETEDBAND ; Envoy� par le contr�le rebar apr�s qu'un ruban ait �t� supprim� $tNMREBAR = DllStructCreate($tagNMREBAR, $lParam) _DebugPrint("$RBN_DELETEDBAND" & @CRLF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMREBAR, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tNMREBAR, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tNMREBAR, "Code") & @CRLF & _ "-->dwMask:" & @TAB & DllStructGetData($tNMREBAR, "dwMask") & @CRLF & _ "-->uBand:" & @TAB & DllStructGetData($tNMREBAR, "uBand") & @CRLF & _ "-->fStyle:" & @TAB & DllStructGetData($tNMREBAR, "fStyle") & @CRLF & _ "-->wID:" & @TAB & DllStructGetData($tNMREBAR, "wID") & @CRLF & _ "-->lParam:" & @TAB & DllStructGetData($tNMREBAR, "lParam")) ; Retourne une valeur non utilis�e Case $RBN_DELETINGBAND ; Envoy� par le contr�le rebar lorsqu'un ruban est sur le point d'�tre supprim� $tNMREBAR = DllStructCreate($tagNMREBAR, $lParam) _DebugPrint("$RBN_DELETINGBAND" & @CRLF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMREBAR, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tNMREBAR, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tNMREBAR, "Code") & @CRLF & _ "-->dwMask:" & @TAB & DllStructGetData($tNMREBAR, "dwMask") & @CRLF & _ "-->uBand:" & @TAB & DllStructGetData($tNMREBAR, "uBand") & @CRLF & _ "-->fStyle:" & @TAB & DllStructGetData($tNMREBAR, "fStyle") & @CRLF & _ "-->wID:" & @TAB & DllStructGetData($tNMREBAR, "wID") & @CRLF & _ "-->lParam:" & @TAB & DllStructGetData($tNMREBAR, "lParam")) ; Retourne une valeur non utilis�e Case $RBN_ENDDRAG ; Envoy� par le contr�le rebar lorsque l'utilisateur arr�te le d�placement d'un ruban $tNMREBAR = DllStructCreate($tagNMREBAR, $lParam) _DebugPrint("$RBN_ENDDRAG" & @CRLF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMREBAR, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tNMREBAR, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tNMREBAR, "Code") & @CRLF & _ "-->dwMask:" & @TAB & DllStructGetData($tNMREBAR, "dwMask") & @CRLF & _ "-->uBand:" & @TAB & DllStructGetData($tNMREBAR, "uBand") & @CRLF & _ "-->fStyle:" & @TAB & DllStructGetData($tNMREBAR, "fStyle") & @CRLF & _ "-->wID:" & @TAB & DllStructGetData($tNMREBAR, "wID") & @CRLF & _ "-->lParam:" & @TAB & DllStructGetData($tNMREBAR, "lParam")) ; Retourne une valeur non utilis�e Case $RBN_GETOBJECT ; Envoy� par le contr�le rebar cr�� avec le style $RBS_REGISTERDROP lorsqu'un objet est d�plac� au dessus d'un ruban du rebar $tOBJECTNOTIFY = DllStructCreate($tagNMOBJECTNOTIFY, $lParam) _DebugPrint("$RBN_GETOBJECT" & @CRLF & "--> hWndFrom:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "Code") & @CRLF & _ "-->Item:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "Item") & @CRLF & _ "-->piid:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "piid") & @CRLF & _ "-->pObject:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "pObject") & @CRLF & _ "-->Result:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "Result")) ; Retourne une valeur non utilis�e Case $RBN_HEIGHTCHANGE ; Envoy� par le contr�le rebar lorsque sa hauteur a chang� ; Les contr�les rebar qui utilise le style $CCS_VERT envoie ce message de notification quand leur largeur change _DebugPrint("$RBN_HEIGHTCHANGE" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; Retourne une valeur non utilis�e Case $RBN_LAYOUTCHANGED ; Envoy� par le contr�le rebar lorsque l'utilisateur change l'apparence des rubans du contr�le _DebugPrint("$RBN_LAYOUTCHANGED" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; Retourne une valeur non utilis�e Case $RBN_MINMAX ; Envoy� par le contr�le rebar avant de maximiser ou minimiser un ruban _DebugPrint("$RBN_MINMAX" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; Return 1 ; une valeur non nulle pour emp�cher l'op�ration de se faire Return 0 ; z�ro pour lui permettre de continuer EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @CRLF & _ "+======================================================" & @CRLF & _ "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _ "+======================================================" & @CRLF) EndFunc ;==>_DebugPrint