#include #include #include Global $wgui = 500, $hgui = 400, $sp = 10, $xleft = $sp, $ytop = $sp, $wctrl, $hctrl Global $gui = GUICreate("Histogram", $wgui, $hgui) ; Global $sFont = "Comic Sans MS" ; GUISetFont(8, $FW_NORMAL, $GUI_FONTNORMAL, $sFont) ; GROUP WITH RADIO BUTTONS $wctrl = $wgui ; default width seems to be the previous control width, but here this is the first in the GUI , so select the GUI's one ! $hctrl = $hgui ; same as for the height local $groupCTRL = GUICtrlCreateGroup("Rendering Modes", $xleft, $ytop, $wctrl, $hctrl) local $aPosG = ControlGetPos($gui, "", $groupCTRL) ; special array to optimize later the group size ! consolewrite("! aPosG x= " & $aPosG[0] & " - y= " & $aPosG[1] & " - w= " & $aPosG[2] & " - h= " & $aPosG[3] & @CRLF) $xleft = $aPosG[0] + $sp ; inside the group $ytop = $aPosG[1] + 2 * $sp ; inside the group taking care of the group title height ! Global $Histo1 = GUICtrlCreateRadio("Mode 1 (Draw Curve) ", $xleft, $ytop) GUICtrlSetBkColor(-1, $COLOR_RED) ; just to check the control rectangle expansion ! GUICtrlSetState(-1, $GUI_CHECKED) local $aPos = ControlGetPos($gui, "", $Histo1) ; Next command voluntary commented to see bad text troncation ! ; GUICtrlSetPos($Histo1, $aPos[0], $aPos[1], $aPos[2] + $aPos[3]) local $ctrlwMax = $aPos[2] ; attempt to detect the broadest radio button consolewrite("! aPos-Histo1 x= " & $aPos[0] & " - y= " & $aPos[1] & " - w= " & $aPos[2] & " - h= " & $aPos[3] & " - ctrlwMax= " & $ctrlwMax & @CRLF) $hctrl = $aPos[3] ; the first radio button give us the height dimension for all $ytop += $hctrl + $sp Global $Histo2 = GUICtrlCreateRadio("Mode 2 (Draw Line GUI) ", $xleft, $ytop) GUICtrlSetBkColor(-1, $COLOR_RED) $aPos = ControlGetPos($gui, "", $Histo2) ; Next command voluntary not commented to see no text troncation ! GUICtrlSetPos($Histo2, $aPos[0], $aPos[1], $aPos[2] + $aPos[3]) if $aPos[2] > $ctrlwMax then $ctrlwMax = $aPos[2] ; attempt to detect the broadest radio button consolewrite("! aPos-Histo2 x= " & $aPos[0] & " - y= " & $aPos[1] & " - w= " & $aPos[2] & " - h= " & $aPos[3] & " - ctrlwMax= " & $ctrlwMax & @CRLF) ; same comments for the 2 last radio button $ytop += $hctrl + $sp Global $Histo3 = GUICtrlCreateRadio("Mode 3 (Draw Line Pic) ", $xleft, $ytop) GUICtrlSetBkColor(-1, $COLOR_RED) $aPos = ControlGetPos($gui, "", $Histo3) if $aPos[2] > $ctrlwMax then $ctrlwMax = $aPos[2] GUICtrlSetPos($Histo3, $aPos[0], $aPos[1], $aPos[2] + $aPos[3]) consolewrite("! aPos-Histo3 x= " & $aPos[0] & " - y= " & $aPos[1] & " - w= " & $aPos[2] & " - h= " & $aPos[3] & " - ctrlwMax= " & $ctrlwMax & @CRLF) $ytop += $hctrl + $sp Global $Histo4 = GUICtrlCreateRadio("Mode 4 (Draw Curve: f[t]) ", $xleft, $ytop) GUICtrlSetBkColor(-1, $COLOR_RED) $aPos = ControlGetPos($gui, "Histogram", $Histo4) if $aPos[2] > $ctrlwMax then $ctrlwMax = $aPos[2] GUICtrlSetPos($Histo4, $aPos[0], $aPos[1], $aPos[2] + $aPos[3]) consolewrite("! aPos-Histo4 x= " & $aPos[0] & " - y= " & $aPos[1] & " - w= " & $aPos[2] & " - h= " & $aPos[3] & " - ctrlwMax= " & $ctrlwMax & @CRLF) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group ; ; at this step, we need to redefine the group dimensions ! ; $hctrl = $aPos[1] +$aPos[3] + $sp - $aPosG[1] ; just to know late y position and late control height ; if the broadest radio button value is $ctrlwMax, just add the space border on the left and on the right -> (2*$sp) to compute the correct group width ! $wctrl = $ctrlwMax + 2* $sp GUICtrlSetPos($groupCTRL, $aPosG[0], $aPosG[1], $ctrlwMax + 2* $sp, $hctrl) $aPosG = ControlGetPos($gui, "", $groupCTRL) consolewrite("! aPosG x= " & $aPosG[0] & " - y= " & $aPosG[1] & " - w= " & $aPosG[2] & " - h= " & $aPosG[3] & @CRLF) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Switch $msg ; ********************************************************************** Case $GUI_EVENT_CLOSE ; Exit GUIDelete($gui) Exit ; ********************************************************************** Case $Histo1 ; Render Histo mode 1 ; do something .... ; ********************************************************************** Case $Histo2 ; Render Histo mode 2 ; do something .... ; ********************************************************************** Case $Histo3 ; Render Histo mode 3 ; do something .... ; ********************************************************************** Case $Histo4 ; Render Histo mode 4 ; do something .... ; ********************************************************************** EndSwitch WEnd