Search the Community
Showing results for tags 'dynamic panels using labels'.
-
Hello everyone, How to transform the code below into something dynamic? To add 'n' elements as panels with show/hide information and still work. Tried to optimize the code as much as possible : ;INCLUDES #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) ;ELEMENTS $FORM = GUICreate("Example", 615, 192, -1, -1, -1, -1, 0) $ELEMENT_1_INFO_CLICK = GUICtrlCreateLabel("Element 1 info", 16, 16, 87, 20) $ELEMENT_1_INFO = GUICtrlCreateEdit("", 16, 48, 185, 33, $ES_WANTRETURN, 0) $ELEMENT_2_INFO_CLICK = GUICtrlCreateLabel("Element 2 info", 16, 96, 87, 20) $ELEMENT_2_INFO = GUICtrlCreateEdit("", 16, 128, 185, 33, $ES_WANTRETURN, 0) ;DESIGN GUISetBkColor(0xFFFFFF, $FORM) GUISetOnEvent($GUI_EVENT_CLOSE, _Exit, $FORM) GUICtrlSetFont($ELEMENT_1_INFO_CLICK, 10, 400, 4, "Arial") GUICtrlSetCursor($ELEMENT_1_INFO_CLICK, 0) GUICtrlSetData($ELEMENT_1_INFO, StringFormat("ELEMENT 1 DETAILED INFO CHECK \r\nHIDDEN")) GUICtrlSetOnEvent($ELEMENT_1_INFO_CLICK, '_ELEMENT_1_INFO_CLICK') GUICtrlSetFont($ELEMENT_2_INFO_CLICK, 10, 400, 4, "Arial") GUICtrlSetCursor($ELEMENT_2_INFO_CLICK, 0) GUICtrlSetData($ELEMENT_2_INFO, StringFormat("ELEMENT 2 DETAILED INFO CHECK \r\nHIDDEN")) GUICtrlSetOnEvent($ELEMENT_2_INFO_CLICK, '_ELEMENT_2_INFO_CLICK') GUISetState(@SW_SHOW, $FORM) While 1 WEnd ;FUNCTIONS Func _Exit() Exit EndFunc ;==>_Exit Func _ELEMENT_1_INFO_CLICK() If GUICtrlGetState($ELEMENT_1_INFO) = 96 Then GUICtrlSetState($ELEMENT_1_INFO, $GUI_SHOW) GUICtrlSetPos($ELEMENT_2_INFO_CLICK, 16, 96) GUICtrlSetPos($ELEMENT_2_INFO, 16, 128) ElseIf GUICtrlGetState($ELEMENT_1_INFO) = 80 Then GUICtrlSetState($ELEMENT_1_INFO, $GUI_HIDE) GUICtrlSetPos($ELEMENT_2_INFO_CLICK, 16, 48) GUICtrlSetPos($ELEMENT_2_INFO, 16, 78) EndIf EndFunc ;==>_ELEMENT_1_INFO_CLICK Func _ELEMENT_2_INFO_CLICK() If GUICtrlGetState($ELEMENT_2_INFO) = 96 Then GUICtrlSetState($ELEMENT_2_INFO, $GUI_SHOW) ElseIf GUICtrlGetState($ELEMENT_2_INFO) = 80 Then GUICtrlSetState($ELEMENT_2_INFO, $GUI_HIDE) EndIf EndFunc ;==>_ELEMENT_2_INFO_CLICK Many thanks. PS : Any tips making the code more compact and efficient would be cool.
- 2 replies
-
- toggle panels
- dynamic panels using labels
- (and 3 more)