qsy666888 发表于 2014-5-10 23:27:12

求请教双击操作弹出gui窗口问题

在ControlListView里面行上双击后弹出gui窗口,弹出后里面的控件全无,并且无法正常运行,求大师指点。

天之骄子 发表于 2014-5-11 09:36:05

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)

$Form1= GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF); will change background color
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$listview = GUICtrlCreateListView ("col1|col2|col3",10,10,200,150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton ("Value?",75,170,70,20)
$item1=GUICtrlCreateListViewItem("item2|col22|col23",$listview)
$item2=GUICtrlCreateListViewItem("item1|col12|col13",$listview)
$item3=GUICtrlCreateListViewItem("item3|col32|col33",$listview)
$input1=GUICtrlCreateInput("",20,200, 150)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)   ; to allow drag and dropping
GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")
GUICtrlSetData($item2,"ITEM1")
GUICtrlSetData($item3,"||COL33")
GUICtrlDelete($item1)
GUISetState(@SW_SHOW)

Do
$msg = GUIGetMsg ()         
   Select          
          Case $msg = $button
         MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)
      Case $msg = $listview
         MsgBox(0,"listview", "clicked="& GUICtrlGetState($listview),2)
   EndSelect
Until $msg = $GUI_EVENT_CLOSE

Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
Local $tagNMHDR, $event, $hwndFrom, $code
$tagNMHDR = DllStructCreate("int;int;int", $lParam)
If @error Then Return
$event = DllStructGetData($tagNMHDR, 3)
If $wParam = $ListView And $event = $NM_DBLCLK Then
xiugai()
EndIf
$tagNMHDR = 0
$event = 0
$lParam = 0
EndFunc

Func xiugai()
GUISetState (@SW_DISABLE, $Form1)
Global $Form2 = GUICreate("Form2", 185, 233, 435, 199)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form2Close")
Global $Input4 = GUICtrlCreateInput("", 32, 24, 121, 21)
Global $Input5 = GUICtrlCreateInput("", 32, 56, 121, 21)
Global $Input6 = GUICtrlCreateInput("", 32, 88, 121, 21)
Global $Input7 = GUICtrlCreateInput("", 32, 120, 121, 21)
Global $Input8 = GUICtrlCreateInput("", 32, 152, 121, 21)
Global $Button2 = GUICtrlCreateButton("修改", 56, 192, 75, 25)
GUISetState(@SW_SHOW)
EndFunc

Func Form1Close()
       Exit                         
EndFunc   ;==>Form1Close

Func Form2Close()
       GUISetState(@SW_HIDE)
           GUISetState (@SW_ENABLE, $Form1)       
           GUISwitch($Form1)                                  
EndFunc   ;==>Form2Close

qsy666888 发表于 2014-5-11 10:01:58

回复 2# 天之骄子


    非常感谢天之骄子大侠的指点

天之骄子 发表于 2014-5-11 12:35:28

我也是菜鸟,大家相互学习,共同进步吧。

qsy666888 发表于 2014-5-12 14:39:57

回复 4# 天之骄子

如果不调用 Opt("GUIOnEventMode", 1) 这个函数能否实现,谢谢
页: [1]
查看完整版本: 求请教双击操作弹出gui窗口问题