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