gcriaco Posted August 11, 2006 Share Posted August 11, 2006 Double clicking on listview doesn't show correctly a parent form.Here is the code based on the Gary example:expandcollapse popup#include <GuiConstants.au3>;Inclusion file for the GUI interface controls #include <GuiListView.au3> Global $Event_On_Control Global $Event_Code Global Const $WM_NOTIFY = 0x004E Global Const $DebugIt = 1 ;ListView Events Global Const $NM_FIRST = 0 Global Const $NM_LAST = (-99) Global Const $NM_OUTOFMEMORY = ($NM_FIRST - 1) Global Const $NM_CLICK = ($NM_FIRST - 2) Global Const $NM_DBLCLK = ($NM_FIRST - 3) Global Const $NM_RETURN = ($NM_FIRST - 4) Global Const $NM_RCLICK = ($NM_FIRST - 5) Global Const $NM_RDBLCLK = ($NM_FIRST - 6) Global Const $NM_SETFOCUS = ($NM_FIRST - 7) Global Const $NM_KILLFOCUS = ($NM_FIRST - 8) Global Const $NM_CUSTOMDRAW = ($NM_FIRST - 12) Global Const $NM_HOVER = ($NM_FIRST - 13) Global Const $NM_NCHITTEST = ($NM_FIRST - 14) Global Const $NM_KEYDOWN = ($NM_FIRST - 15) Global Const $NM_RELEASEDCAPTURE = ($NM_FIRST - 16) Global Const $NM_SETCURSOR = ($NM_FIRST - 17) Global Const $NM_CHAR = ($NM_FIRST - 18) Global Const $NM_TOOLTIPSCREATED = ($NM_FIRST - 19) #endregion End Global variables Opt("WinTitleMatchMode", 2) $main_GUI = GUICreate("GuiRegisterMsg Test", 225, 400, 300, 10, BitOR($WS_THICKFRAME, $WS_SIZEBOX)) $btnOK = GUICtrlCreateButton("Test", 5, 40, 75, 25, $BS_DEFPUSHBUTTON) $Event_On_Control = GUICtrlCreateListView("Entry Name|Category", 5, 75, 195, 280, BitOR($LVS_SORTASCENDING, $LVS_SINGLESEL)) ;~ $Event_On_Control = $CodeListView _GUICtrlListViewSetColumnWidth ($Event_On_Control, 0, 100) _GUICtrlListViewSetColumnWidth ($Event_On_Control, 1, 100) GUICtrlSendMsg($Event_On_Control, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($Event_On_Control, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) $Trans_slider = GUICtrlCreateSlider(203, 75, 20, 280, $TBS_VERT, $WS_EX_CLIENTEDGE) GUICtrlSetLimit($Trans_slider, 255, 62); change min/max value GUICtrlSetData($Trans_slider, 255) $Transparency = Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) GUISetState() ;Register WM_NOTIFY events GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") While 1 $msg = GUIGetMsg() Switch $msg ;----------------------------------------------------------------------------------------- ;This case statement exits and updates code if needed Case $GUI_EVENT_CLOSE Exit Case $btnOK _PgmEditGUI($main_GUI) ;----------------------------------------------------------------------------------------- ;put all the misc. stuff here Case Else If $Transparency <> Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) Then $Transparency = Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) WinSetTrans($main_GUI, "", Int(GUICtrlRead($Trans_slider))) EndIf Switch $Event_Code Case $NM_DBLCLK $Event_Code = 0 ContinueLoop Case $NM_CLICK $Event_Code = 0 ContinueLoop Case Else $Event_Code = 0 EndSwitch EndSwitch WEnd ; ; WM_NOTIFY event handler Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID Local $tagNMHDR, $event Switch $wParam Case $Event_On_Control $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Switch $event Case $NM_CHAR $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_CHAR" & @LF) Case $NM_CLICK $Event_Code = $event If $DebugIt Then ConsoleWrite ("-->$NM_CLICK" & @LF) Case $NM_CUSTOMDRAW $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_CUSTOMDRAW" & @LF) Case $NM_DBLCLK $Event_Code = $event If $DebugIt Then ConsoleWrite ("-->$NM_DBLCLK" & @LF) _PgmEditGUI($main_GUI) Case $NM_HOVER $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_HOVER" & @LF) Case $NM_KILLFOCUS $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_KILLFOCUS" & @LF) Case $NM_KEYDOWN $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_KEYDOWN" & @LF) Case $NM_NCHITTEST $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_NCHITTEST" & @LF) Case $NM_OUTOFMEMORY $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_OUTOFMEMORY" & @LF) Case $NM_RCLICK $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RCLICK" & @LF) Case $NM_RDBLCLK $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RDBLCLK" & @LF) Case $NM_RELEASEDCAPTURE $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RELEASEDCAPTURE" & @LF) Case $NM_RETURN $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RETURN" & @LF) Case $NM_SETCURSOR $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_SETCURSOR" & @LF) Case $NM_SETFOCUS $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_SETFOCUS" & @LF) Case $NM_TOOLTIPSCREATED $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_TOOLTIPSCREATED" & @LF) EndSwitch EndSwitch $tagNMHDR = 0 EndFunc;==>WM_Notify_Events ;----------------------------------------------------------------------------------------------------------------------------------------------- Func _PgmEditGUI($main_GUI) Local $sMsg ; create the child Program Window $frmPgmAdd = GUICreate("Add Program", 405, 485, 193, 116, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS),0,$main_GUI) $cmbCategory = GUICtrlCreateCombo("", 80, 16, 145, 21, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$CBS_SORT)) GUICtrlSetState(-1, $GUI_FOCUS) GUICtrlCreateLabel("Category", 24, 24, 46, 17) GUICtrlCreateLabel("Name", 24, 64, 32, 17) $txtPgm = GUICtrlCreateInput("", 80, 56, 313, 21) GUICtrlCreateLabel("Version", 24, 104, 39, 17) $txtVer = GUICtrlCreateInput("", 80, 96, 145, 21) ;License $Group1 = GUICtrlCreateGroup("License", 16, 136, 177, 113) $optFree = GUICtrlCreateRadio("Freeware", 48, 168, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) $optShareware = GUICtrlCreateRadio("Shareware", 48, 208, 113, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) ;Package $Group2 = GUICtrlCreateGroup("Package", 213, 138, 177, 113) $optSetup = GUICtrlCreateRadio("Setup", 245, 170, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) $optNoSetup = GUICtrlCreateRadio("No Setup", 245, 210, 113, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) ;Description $txtDescr = GUICtrlCreateEdit("", 16, 296, 369, 137) GUICtrlSetData(-1, "") GUICtrlCreateLabel("Description:", 16, 272, 60, 17) $btnOK = GUICtrlCreateButton("OK", 224, 448, 75, 25, $BS_DEFPUSHBUTTON) $btnCancel = GUICtrlCreateButton("&Cancel", 312, 448, 75, 25, 0) GUISetState(@SW_SHOW,$frmPgmAdd) While 1 $sMsg = GUIGetMsg() Select Case $sMsg = $GUI_EVENT_CLOSE Or $sMsg = $btnCancel ExitLoop EndSelect WEnd GUIDelete($frmPgmAdd) EndFuncAs you can see, I show a parent form from the function _PgmEditGUI($main_GUI) in 2 cases:Button "Test" clicked => OKDouble clicking on listview => the parent form doesn't appear correctly.Please helpThanks in advancePeppe Link to comment Share on other sites More sharing options...
GaryFrost Posted August 11, 2006 Share Posted August 11, 2006 I think that would be something for Holger to look at, but here's a work around expandcollapse popup#include <GuiConstants.au3>;Inclusion file for the GUI interface controls #include <GuiListView.au3> #region Global Variables Global $Event_On_Control Global $Event_Code Global Const $WM_NOTIFY = 0x004E Global Const $DebugIt = 1 ;ListView Events Global Const $NM_FIRST = 0 Global Const $NM_LAST = (-99) Global Const $NM_OUTOFMEMORY = ($NM_FIRST - 1) Global Const $NM_CLICK = ($NM_FIRST - 2) Global Const $NM_DBLCLK = ($NM_FIRST - 3) ;~ Global Const $NM_RETURN = ($NM_FIRST - 4) ;~ Global Const $NM_RCLICK = ($NM_FIRST - 5) ;~ Global Const $NM_RDBLCLK = ($NM_FIRST - 6) ;~ Global Const $NM_SETFOCUS = ($NM_FIRST - 7) ;~ Global Const $NM_KILLFOCUS = ($NM_FIRST - 8) ;~ Global Const $NM_CUSTOMDRAW = ($NM_FIRST - 12) ;~ Global Const $NM_HOVER = ($NM_FIRST - 13) ;~ Global Const $NM_NCHITTEST = ($NM_FIRST - 14) ;~ Global Const $NM_KEYDOWN = ($NM_FIRST - 15) ;~ Global Const $NM_RELEASEDCAPTURE = ($NM_FIRST - 16) ;~ Global Const $NM_SETCURSOR = ($NM_FIRST - 17) ;~ Global Const $NM_CHAR = ($NM_FIRST - 18) ;~ Global Const $NM_TOOLTIPSCREATED = ($NM_FIRST - 19) Global $frmPgmAdd, $btnOK_frmPrgmAdd, $btnCancel #endregion End Global variables Opt("WinTitleMatchMode", 2) $main_GUI = GUICreate("GuiRegisterMsg Test", 225, 400, 300, 10, BitOR($WS_THICKFRAME, $WS_SIZEBOX)) $btnOK = GUICtrlCreateButton("Test", 5, 40, 75, 25, $BS_DEFPUSHBUTTON) $Event_On_Control = GUICtrlCreateListView("Entry Name|Category", 5, 75, 195, 280, BitOR($LVS_SORTASCENDING, $LVS_SINGLESEL)) ;~ $Event_On_Control = $CodeListView _GUICtrlListViewSetColumnWidth($Event_On_Control, 0, 100) _GUICtrlListViewSetColumnWidth($Event_On_Control, 1, 100) GUICtrlSendMsg($Event_On_Control, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($Event_On_Control, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) $Trans_slider = GUICtrlCreateSlider(203, 75, 20, 280, $TBS_VERT, $WS_EX_CLIENTEDGE) GUICtrlSetLimit($Trans_slider, 255, 62); change min/max value GUICtrlSetData($Trans_slider, 255) $Transparency = Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) _PgmEditGUI($main_GUI) GUISetState(@SW_HIDE, $frmPgmAdd) GUISetState(@SW_SHOW, $main_GUI) ;Register WM_NOTIFY events GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") While 1 $msg = GUIGetMsg() Switch $msg ;----------------------------------------------------------------------------------------- ;This case statement exits and updates code if needed Case $GUI_EVENT_CLOSE Exit Case $btnOK GUISetState(@SW_SHOW, $frmPgmAdd) Case $btnOK_frmPrgmAdd, $btnCancel GUISetState(@SW_HIDE, $frmPgmAdd) ;----------------------------------------------------------------------------------------- ;put all the misc. stuff here Case Else If $Transparency <> Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) Then $Transparency = Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) WinSetTrans($main_GUI, "", Int(GUICtrlRead($Trans_slider))) EndIf EndSwitch WEnd Func ListView_Click() ;---------------------------------------------------------------------------------------------- If $DebugIt Then ConsoleWrite (_DebugHeader("$NM_CLICK")) ;---------------------------------------------------------------------------------------------- EndFunc ;==>ListView_Click Func ListView_DoubleClick() ;---------------------------------------------------------------------------------------------- If $DebugIt Then ConsoleWrite (_DebugHeader("$NM_DBLCLK")) ;---------------------------------------------------------------------------------------------- GUISetState(@SW_SHOW, $frmPgmAdd) EndFunc ;==>ListView_DoubleClick ; WM_NOTIFY event handler Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam) ;NMHDR (hwndFrom, idFrom, code) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Select Case $wParam = $Event_On_Control Select Case $event = $NM_CLICK ListView_Click() Case $event = $NM_DBLCLK ListView_DoubleClick() EndSelect EndSelect $tagNMHDR = 0 $event = 0 $lParam = 0 Return $GUI_RUNDEFMSG EndFunc ;==>WM_Notify_Events Func _DebugHeader($s_text) Return _ "!===========================================================" & @LF & _ "+===========================================================" & @LF & _ "-->" & $s_text & @LF & _ "+===========================================================" & @LF EndFunc ;==>_DebugHeader ;----------------------------------------------------------------------------------------------------------------------------------------------- Func _PgmEditGUI($main_GUI) Local $sMsg ; create the child Program Window $frmPgmAdd = GUICreate("Add Program", 405, 485, 193, 116, $WS_CAPTION, -1, $main_GUI) $cmbCategory = GUICtrlCreateCombo("testing", 80, 16, 145, 21, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $CBS_SORT)) GUICtrlSetState(-1, $GUI_FOCUS) GUICtrlCreateLabel("Category", 24, 24, 46, 17) GUICtrlCreateLabel("Name", 24, 64, 32, 17) $txtPgm = GUICtrlCreateInput("", 80, 56, 313, 21) GUICtrlCreateLabel("Version", 24, 104, 39, 17) $txtVer = GUICtrlCreateInput("", 80, 96, 145, 21) ;License $Group1 = GUICtrlCreateGroup("License", 16, 136, 177, 113) $optFree = GUICtrlCreateRadio("Freeware", 48, 168, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) $optShareware = GUICtrlCreateRadio("Shareware", 48, 208, 113, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) ;Package $Group2 = GUICtrlCreateGroup("Package", 213, 138, 177, 113) $optSetup = GUICtrlCreateRadio("Setup", 245, 170, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) $optNoSetup = GUICtrlCreateRadio("No Setup", 245, 210, 113, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) ;Description $txtDescr = GUICtrlCreateEdit("", 16, 296, 369, 137) GUICtrlSetData(-1, "") GUICtrlCreateLabel("Description:", 16, 272, 60, 17) $btnOK_frmPrgmAdd = GUICtrlCreateButton("OK", 224, 448, 75, 25, $BS_DEFPUSHBUTTON) $btnCancel = GUICtrlCreateButton("&Cancel", 312, 448, 75, 25, 0) EndFunc ;==>_PgmEditGUI 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...
GaryFrost Posted August 11, 2006 Share Posted August 11, 2006 another way probably more to your liking: expandcollapse popup#include <GuiConstants.au3>;Inclusion file for the GUI interface controls #include <GuiListView.au3> Global $Event_On_Control Global $Event_Code Global Const $WM_NOTIFY = 0x004E Global Const $DebugIt = 1 ;ListView Events Global Const $NM_FIRST = 0 Global Const $NM_LAST = (-99) Global Const $NM_OUTOFMEMORY = ($NM_FIRST - 1) Global Const $NM_CLICK = ($NM_FIRST - 2) Global Const $NM_DBLCLK = ($NM_FIRST - 3) Global Const $NM_RETURN = ($NM_FIRST - 4) Global Const $NM_RCLICK = ($NM_FIRST - 5) Global Const $NM_RDBLCLK = ($NM_FIRST - 6) Global Const $NM_SETFOCUS = ($NM_FIRST - 7) Global Const $NM_KILLFOCUS = ($NM_FIRST - 8) Global Const $NM_CUSTOMDRAW = ($NM_FIRST - 12) Global Const $NM_HOVER = ($NM_FIRST - 13) Global Const $NM_NCHITTEST = ($NM_FIRST - 14) Global Const $NM_KEYDOWN = ($NM_FIRST - 15) Global Const $NM_RELEASEDCAPTURE = ($NM_FIRST - 16) Global Const $NM_SETCURSOR = ($NM_FIRST - 17) Global Const $NM_CHAR = ($NM_FIRST - 18) Global Const $NM_TOOLTIPSCREATED = ($NM_FIRST - 19) #endregion End Global variables Opt("WinTitleMatchMode", 2) $main_GUI = GUICreate("GuiRegisterMsg Test", 225, 400, 300, 10, BitOR($WS_THICKFRAME, $WS_SIZEBOX)) $btnOK = GUICtrlCreateButton("Test", 5, 40, 75, 25, $BS_DEFPUSHBUTTON) $Event_On_Control = GUICtrlCreateListView("Entry Name|Category", 5, 75, 195, 280, BitOR($LVS_SORTASCENDING, $LVS_SINGLESEL)) ;~ $Event_On_Control = $CodeListView _GUICtrlListViewSetColumnWidth ($Event_On_Control, 0, 100) _GUICtrlListViewSetColumnWidth ($Event_On_Control, 1, 100) GUICtrlSendMsg($Event_On_Control, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($Event_On_Control, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) $Trans_slider = GUICtrlCreateSlider(203, 75, 20, 280, $TBS_VERT, $WS_EX_CLIENTEDGE) GUICtrlSetLimit($Trans_slider, 255, 62); change min/max value GUICtrlSetData($Trans_slider, 255) $Transparency = Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) GUISetState() ;Register WM_NOTIFY events GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") While 1 $msg = GUIGetMsg() Switch $msg ;----------------------------------------------------------------------------------------- ;This case statement exits and updates code if needed Case $GUI_EVENT_CLOSE Exit Case $btnOK _PgmEditGUI($main_GUI) ;----------------------------------------------------------------------------------------- ;put all the misc. stuff here Case Else If $Transparency <> Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) Then $Transparency = Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) WinSetTrans($main_GUI, "", Int(GUICtrlRead($Trans_slider))) EndIf Switch $Event_Code Case $NM_DBLCLK $Event_Code = 0 ContinueLoop Case $NM_CLICK $Event_Code = 0 _PgmEditGUI($main_GUI) ContinueLoop Case Else $Event_Code = 0 EndSwitch EndSwitch WEnd ; ; WM_NOTIFY event handler Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID Local $tagNMHDR, $event Switch $wParam Case $Event_On_Control $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Switch $event Case $NM_CHAR $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_CHAR" & @LF) Case $NM_CLICK $Event_Code = $event If $DebugIt Then ConsoleWrite ("-->$NM_CLICK" & @LF) Case $NM_CUSTOMDRAW $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_CUSTOMDRAW" & @LF) Case $NM_DBLCLK $Event_Code = $event If $DebugIt Then ConsoleWrite ("-->$NM_DBLCLK" & @LF) Return 0 Case $NM_HOVER $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_HOVER" & @LF) Case $NM_KILLFOCUS $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_KILLFOCUS" & @LF) Case $NM_KEYDOWN $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_KEYDOWN" & @LF) Case $NM_NCHITTEST $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_NCHITTEST" & @LF) Case $NM_OUTOFMEMORY $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_OUTOFMEMORY" & @LF) Case $NM_RCLICK $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RCLICK" & @LF) Case $NM_RDBLCLK $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RDBLCLK" & @LF) Case $NM_RELEASEDCAPTURE $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RELEASEDCAPTURE" & @LF) Case $NM_RETURN $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RETURN" & @LF) Case $NM_SETCURSOR $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_SETCURSOR" & @LF) Case $NM_SETFOCUS $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_SETFOCUS" & @LF) Case $NM_TOOLTIPSCREATED $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_TOOLTIPSCREATED" & @LF) EndSwitch EndSwitch $tagNMHDR = 0 EndFunc;==>WM_Notify_Events ;----------------------------------------------------------------------------------------------------------------------------------------------- Func _PgmEditGUI($main_GUI) Local $sMsg ; create the child Program Window $frmPgmAdd = GUICreate("Add Program", 405, 485, 193, 116, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS),0,$main_GUI) $cmbCategory = GUICtrlCreateCombo("", 80, 16, 145, 21, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$CBS_SORT)) GUICtrlSetState(-1, $GUI_FOCUS) GUICtrlCreateLabel("Category", 24, 24, 46, 17) GUICtrlCreateLabel("Name", 24, 64, 32, 17) $txtPgm = GUICtrlCreateInput("", 80, 56, 313, 21) GUICtrlCreateLabel("Version", 24, 104, 39, 17) $txtVer = GUICtrlCreateInput("", 80, 96, 145, 21) ;License $Group1 = GUICtrlCreateGroup("License", 16, 136, 177, 113) $optFree = GUICtrlCreateRadio("Freeware", 48, 168, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) $optShareware = GUICtrlCreateRadio("Shareware", 48, 208, 113, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) ;Package $Group2 = GUICtrlCreateGroup("Package", 213, 138, 177, 113) $optSetup = GUICtrlCreateRadio("Setup", 245, 170, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) $optNoSetup = GUICtrlCreateRadio("No Setup", 245, 210, 113, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) ;Description $txtDescr = GUICtrlCreateEdit("", 16, 296, 369, 137) GUICtrlSetData(-1, "") GUICtrlCreateLabel("Description:", 16, 272, 60, 17) $btnOK = GUICtrlCreateButton("OK", 224, 448, 75, 25, $BS_DEFPUSHBUTTON) $btnCancel = GUICtrlCreateButton("&Cancel", 312, 448, 75, 25, 0) GUISetState(@SW_SHOW,$frmPgmAdd) While 1 $sMsg = GUIGetMsg() Select Case $sMsg = $GUI_EVENT_CLOSE Or $sMsg = $btnCancel ExitLoop EndSelect WEnd GUIDelete($frmPgmAdd) EndFunc 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...
gcriaco Posted August 11, 2006 Share Posted August 11, 2006 (edited) Thanks. Edited August 17, 2006 by gcriaco Link to comment Share on other sites More sharing options...
gcriaco Posted August 17, 2006 Share Posted August 17, 2006 Unfortunately, in this example the test button works just the first time another way probably more to your liking: expandcollapse popup#include <GuiConstants.au3>;Inclusion file for the GUI interface controls #include <GuiListView.au3> Global $Event_On_Control Global $Event_Code Global Const $WM_NOTIFY = 0x004E Global Const $DebugIt = 1 ;ListView Events Global Const $NM_FIRST = 0 Global Const $NM_LAST = (-99) Global Const $NM_OUTOFMEMORY = ($NM_FIRST - 1) Global Const $NM_CLICK = ($NM_FIRST - 2) Global Const $NM_DBLCLK = ($NM_FIRST - 3) Global Const $NM_RETURN = ($NM_FIRST - 4) Global Const $NM_RCLICK = ($NM_FIRST - 5) Global Const $NM_RDBLCLK = ($NM_FIRST - 6) Global Const $NM_SETFOCUS = ($NM_FIRST - 7) Global Const $NM_KILLFOCUS = ($NM_FIRST - 8) Global Const $NM_CUSTOMDRAW = ($NM_FIRST - 12) Global Const $NM_HOVER = ($NM_FIRST - 13) Global Const $NM_NCHITTEST = ($NM_FIRST - 14) Global Const $NM_KEYDOWN = ($NM_FIRST - 15) Global Const $NM_RELEASEDCAPTURE = ($NM_FIRST - 16) Global Const $NM_SETCURSOR = ($NM_FIRST - 17) Global Const $NM_CHAR = ($NM_FIRST - 18) Global Const $NM_TOOLTIPSCREATED = ($NM_FIRST - 19) #endregion End Global variables Opt("WinTitleMatchMode", 2) $main_GUI = GUICreate("GuiRegisterMsg Test", 225, 400, 300, 10, BitOR($WS_THICKFRAME, $WS_SIZEBOX)) $btnOK = GUICtrlCreateButton("Test", 5, 40, 75, 25, $BS_DEFPUSHBUTTON) $Event_On_Control = GUICtrlCreateListView("Entry Name|Category", 5, 75, 195, 280, BitOR($LVS_SORTASCENDING, $LVS_SINGLESEL)) ;~ $Event_On_Control = $CodeListView _GUICtrlListViewSetColumnWidth ($Event_On_Control, 0, 100) _GUICtrlListViewSetColumnWidth ($Event_On_Control, 1, 100) GUICtrlSendMsg($Event_On_Control, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($Event_On_Control, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) $Trans_slider = GUICtrlCreateSlider(203, 75, 20, 280, $TBS_VERT, $WS_EX_CLIENTEDGE) GUICtrlSetLimit($Trans_slider, 255, 62); change min/max value GUICtrlSetData($Trans_slider, 255) $Transparency = Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) GUISetState() ;Register WM_NOTIFY events GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") While 1 $msg = GUIGetMsg() Switch $msg ;----------------------------------------------------------------------------------------- ;This case statement exits and updates code if needed Case $GUI_EVENT_CLOSE Exit Case $btnOK _PgmEditGUI($main_GUI) ;----------------------------------------------------------------------------------------- ;put all the misc. stuff here Case Else If $Transparency <> Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) Then $Transparency = Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) WinSetTrans($main_GUI, "", Int(GUICtrlRead($Trans_slider))) EndIf Switch $Event_Code Case $NM_DBLCLK $Event_Code = 0 ContinueLoop Case $NM_CLICK $Event_Code = 0 _PgmEditGUI($main_GUI) ContinueLoop Case Else $Event_Code = 0 EndSwitch EndSwitch WEnd ; ; WM_NOTIFY event handler Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID Local $tagNMHDR, $event Switch $wParam Case $Event_On_Control $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Switch $event Case $NM_CHAR $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_CHAR" & @LF) Case $NM_CLICK $Event_Code = $event If $DebugIt Then ConsoleWrite ("-->$NM_CLICK" & @LF) Case $NM_CUSTOMDRAW $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_CUSTOMDRAW" & @LF) Case $NM_DBLCLK $Event_Code = $event If $DebugIt Then ConsoleWrite ("-->$NM_DBLCLK" & @LF) Return 0 Case $NM_HOVER $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_HOVER" & @LF) Case $NM_KILLFOCUS $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_KILLFOCUS" & @LF) Case $NM_KEYDOWN $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_KEYDOWN" & @LF) Case $NM_NCHITTEST $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_NCHITTEST" & @LF) Case $NM_OUTOFMEMORY $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_OUTOFMEMORY" & @LF) Case $NM_RCLICK $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RCLICK" & @LF) Case $NM_RDBLCLK $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RDBLCLK" & @LF) Case $NM_RELEASEDCAPTURE $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RELEASEDCAPTURE" & @LF) Case $NM_RETURN $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RETURN" & @LF) Case $NM_SETCURSOR $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_SETCURSOR" & @LF) Case $NM_SETFOCUS $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_SETFOCUS" & @LF) Case $NM_TOOLTIPSCREATED $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_TOOLTIPSCREATED" & @LF) EndSwitch EndSwitch $tagNMHDR = 0 EndFunc;==>WM_Notify_Events ;----------------------------------------------------------------------------------------------------------------------------------------------- Func _PgmEditGUI($main_GUI) Local $sMsg ; create the child Program Window $frmPgmAdd = GUICreate("Add Program", 405, 485, 193, 116, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS),0,$main_GUI) $cmbCategory = GUICtrlCreateCombo("", 80, 16, 145, 21, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$CBS_SORT)) GUICtrlSetState(-1, $GUI_FOCUS) GUICtrlCreateLabel("Category", 24, 24, 46, 17) GUICtrlCreateLabel("Name", 24, 64, 32, 17) $txtPgm = GUICtrlCreateInput("", 80, 56, 313, 21) GUICtrlCreateLabel("Version", 24, 104, 39, 17) $txtVer = GUICtrlCreateInput("", 80, 96, 145, 21) ;License $Group1 = GUICtrlCreateGroup("License", 16, 136, 177, 113) $optFree = GUICtrlCreateRadio("Freeware", 48, 168, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) $optShareware = GUICtrlCreateRadio("Shareware", 48, 208, 113, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) ;Package $Group2 = GUICtrlCreateGroup("Package", 213, 138, 177, 113) $optSetup = GUICtrlCreateRadio("Setup", 245, 170, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) $optNoSetup = GUICtrlCreateRadio("No Setup", 245, 210, 113, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) ;Description $txtDescr = GUICtrlCreateEdit("", 16, 296, 369, 137) GUICtrlSetData(-1, "") GUICtrlCreateLabel("Description:", 16, 272, 60, 17) $btnOK = GUICtrlCreateButton("OK", 224, 448, 75, 25, $BS_DEFPUSHBUTTON) $btnCancel = GUICtrlCreateButton("&Cancel", 312, 448, 75, 25, 0) GUISetState(@SW_SHOW,$frmPgmAdd) While 1 $sMsg = GUIGetMsg() Select Case $sMsg = $GUI_EVENT_CLOSE Or $sMsg = $btnCancel ExitLoop EndSelect WEnd GUIDelete($frmPgmAdd) EndFunc Link to comment Share on other sites More sharing options...
GaryFrost Posted August 17, 2006 Share Posted August 17, 2006 (edited) expandcollapse popup#include <GuiConstants.au3>;Inclusion file for the GUI interface controls #include <GuiListView.au3> Opt("MustDeclareVars", 1) Global $Event_On_Control Global Const $WM_NOTIFY = 0x004E Global Const $DebugIt = 1 ;ListView Events Global Const $NM_FIRST = 0 Global Const $NM_LAST = (-99) Global Const $NM_OUTOFMEMORY = ($NM_FIRST - 1) Global Const $NM_CLICK = ($NM_FIRST - 2) Global Const $NM_DBLCLK = ($NM_FIRST - 3) Global Const $NM_RETURN = ($NM_FIRST - 4) Global Const $NM_RCLICK = ($NM_FIRST - 5) Global Const $NM_RDBLCLK = ($NM_FIRST - 6) Global Const $NM_SETFOCUS = ($NM_FIRST - 7) Global Const $NM_KILLFOCUS = ($NM_FIRST - 8) Global Const $NM_CUSTOMDRAW = ($NM_FIRST - 12) Global Const $NM_HOVER = ($NM_FIRST - 13) Global Const $NM_NCHITTEST = ($NM_FIRST - 14) Global Const $NM_KEYDOWN = ($NM_FIRST - 15) Global Const $NM_RELEASEDCAPTURE = ($NM_FIRST - 16) Global Const $NM_SETCURSOR = ($NM_FIRST - 17) Global Const $NM_CHAR = ($NM_FIRST - 18) Global Const $NM_TOOLTIPSCREATED = ($NM_FIRST - 19) Global $Dbl_Clicked = False #endregion End Global variables Opt("WinTitleMatchMode", 2) _Main() Func _Main() Local $main_GUI, $btnOK, $Trans_slider, $Transparency, $msg $main_GUI = GUICreate("GuiRegisterMsg Test", 225, 400, 300, 10, BitOR($WS_THICKFRAME, $WS_SIZEBOX)) $btnOK = GUICtrlCreateButton("Test", 5, 40, 75, 25, $BS_DEFPUSHBUTTON) $Event_On_Control = GUICtrlCreateListView("Entry Name|Category", 5, 75, 195, 280, BitOR($LVS_SORTASCENDING, $LVS_SINGLESEL)) ;~ $Event_On_Control = $CodeListView _GUICtrlListViewSetColumnWidth($Event_On_Control, 0, 100) _GUICtrlListViewSetColumnWidth($Event_On_Control, 1, 100) GUICtrlSendMsg($Event_On_Control, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($Event_On_Control, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) $Trans_slider = GUICtrlCreateSlider(203, 75, 20, 280, $TBS_VERT, $WS_EX_CLIENTEDGE) GUICtrlSetLimit($Trans_slider, 255, 62); change min/max value GUICtrlSetData($Trans_slider, 255) $Transparency = Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) GUISetState() ;Register WM_NOTIFY events GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") While 1 $msg = GUIGetMsg() Select ;----------------------------------------------------------------------------------------- ;This case statement exits and updates code if needed Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $btnOK Or $Dbl_Clicked = True $Dbl_Clicked = False ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint ("_PgmEditGUI") ;---------------------------------------------------------------------------------------------- _PgmEditGUI($main_GUI) ;----------------------------------------------------------------------------------------- ;put all the misc. stuff here Case Else If $Transparency <> Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) Then $Transparency = Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) WinSetTrans($main_GUI, "", Int(GUICtrlRead($Trans_slider))) EndIf EndSelect WEnd EndFunc ;==>_Main Func ListView_Click() ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint ("$NM_CLICK") ;---------------------------------------------------------------------------------------------- EndFunc ;==>ListView_Click Func ListView_DoubleClick() ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint ("$NM_DBLCLK") ;---------------------------------------------------------------------------------------------- $Dbl_Clicked = True EndFunc ;==>ListView_DoubleClick ; ; WM_NOTIFY event handler Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID Local $tagNMHDR, $event Switch $wParam Case $Event_On_Control $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Switch $event Case $NM_CHAR If $DebugIt Then ConsoleWrite("-->$NM_CHAR" & @LF) Case $NM_CLICK If $DebugIt Then ConsoleWrite("-->$NM_CLICK" & @LF) Case $NM_CUSTOMDRAW ListView_Click() Case $NM_DBLCLK ListView_DoubleClick() Return 0 Case $NM_HOVER If $DebugIt Then ConsoleWrite("-->$NM_HOVER" & @LF) Case $NM_KILLFOCUS If $DebugIt Then ConsoleWrite("-->$NM_KILLFOCUS" & @LF) Case $NM_KEYDOWN If $DebugIt Then ConsoleWrite("-->$NM_KEYDOWN" & @LF) Case $NM_NCHITTEST If $DebugIt Then ConsoleWrite("-->$NM_NCHITTEST" & @LF) Case $NM_OUTOFMEMORY If $DebugIt Then ConsoleWrite("-->$NM_OUTOFMEMORY" & @LF) Case $NM_RCLICK If $DebugIt Then ConsoleWrite("-->$NM_RCLICK" & @LF) Case $NM_RDBLCLK If $DebugIt Then ConsoleWrite("-->$NM_RDBLCLK" & @LF) Case $NM_RELEASEDCAPTURE If $DebugIt Then ConsoleWrite("-->$NM_RELEASEDCAPTURE" & @LF) Case $NM_RETURN If $DebugIt Then ConsoleWrite("-->$NM_RETURN" & @LF) Case $NM_SETCURSOR If $DebugIt Then ConsoleWrite("-->$NM_SETCURSOR" & @LF) Case $NM_SETFOCUS If $DebugIt Then ConsoleWrite("-->$NM_SETFOCUS" & @LF) Case $NM_TOOLTIPSCREATED If $DebugIt Then ConsoleWrite("-->$NM_TOOLTIPSCREATED" & @LF) EndSwitch EndSwitch $tagNMHDR = 0 ; Proceed the default Autoit3 internal message commands. ; You also can complete let the line out. ; !!! But only 'Return' (without any value) will not proceed ; the default Autoit3-message in the future !!! Return $GUI_RUNDEFMSG EndFunc ;==>WM_Notify_Events ;----------------------------------------------------------------------------------------------------------------------------------------------- Func _PgmEditGUI($main_GUI) Local $sMsg, $frmPgmAdd, $cmbCategory, $txtPgm, $txtVer, $Group1 Local $optFree, $optShareware, $Group2, $optSetup, $optNoSetup Local $txtDescr, $btnOK, $btnCancel ; create the child Program Window $frmPgmAdd = GUICreate("Add Program", 405, 485, 193, 116, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS), 0, $main_GUI) $cmbCategory = GUICtrlCreateCombo("", 80, 16, 145, 21, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $CBS_SORT)) GUICtrlSetState(-1, $GUI_FOCUS) GUICtrlCreateLabel("Category", 24, 24, 46, 17) GUICtrlCreateLabel("Name", 24, 64, 32, 17) $txtPgm = GUICtrlCreateInput("", 80, 56, 313, 21) GUICtrlCreateLabel("Version", 24, 104, 39, 17) $txtVer = GUICtrlCreateInput("", 80, 96, 145, 21) ;License $Group1 = GUICtrlCreateGroup("License", 16, 136, 177, 113) $optFree = GUICtrlCreateRadio("Freeware", 48, 168, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) $optShareware = GUICtrlCreateRadio("Shareware", 48, 208, 113, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) ;Package $Group2 = GUICtrlCreateGroup("Package", 213, 138, 177, 113) $optSetup = GUICtrlCreateRadio("Setup", 245, 170, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) $optNoSetup = GUICtrlCreateRadio("No Setup", 245, 210, 113, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) ;Description $txtDescr = GUICtrlCreateEdit("", 16, 296, 369, 137) GUICtrlSetData(-1, "") GUICtrlCreateLabel("Description:", 16, 272, 60, 17) $btnOK = GUICtrlCreateButton("OK", 224, 448, 75, 25, $BS_DEFPUSHBUTTON) $btnCancel = GUICtrlCreateButton("&Cancel", 312, 448, 75, 25, 0) GUISetState(@SW_SHOW, $frmPgmAdd) While 1 $sMsg = GUIGetMsg() Select Case $sMsg = $GUI_EVENT_CLOSE Or $sMsg = $btnCancel ExitLoop EndSelect WEnd GUIDelete($frmPgmAdd) EndFunc ;==>_PgmEditGUI Func _DebugPrint($s_text) ConsoleWrite( _ "!===========================================================" & @LF & _ "+===========================================================" & @LF & _ "-->" & $s_text & @LF & _ "+===========================================================" & @LF) EndFunc ;==>_DebugPrint Edited August 17, 2006 by gafrost 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...
gcriaco Posted August 17, 2006 Share Posted August 17, 2006 Works fine. Many thanks Gary. 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