Vindicator209 Posted September 8, 2006 Posted September 8, 2006 Ive got this: $List_2 = GuiCtrlCreateList("-Character Number-", 110, 30, 170, 71) GuiCtrlSetData($List_2,'Character 1') GuiCtrlSetData($List_2,'Character 2') GuiCtrlSetData($List_2,'Character 3') GuiCtrlSetData($List_2,'Character 4') $G=("LOADING:") & GUICtrlRead($List_2) I have a msgbox to display $G but it always comes out as "LOADING: -Character Number-" instead of what they had chosen... whats am i doing wrong? [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]
Valuater Posted September 8, 2006 Posted September 8, 2006 maybe... #include <GUIConstants.au3> GUICreate("my gui") $List_2 = GuiCtrlCreateList("-Character Number-", 110, 30, 170, 71) GuiCtrlSetData($List_2,'Character 1') GuiCtrlSetData($List_2,'Character 2') GuiCtrlSetData($List_2,'Character 3') GuiCtrlSetData($List_2,'Character 4') $button = GUICtrlCreateButton( "Test", 110, 150, 120, 30) GUISetState() While 1 $MSG = GUIGetMsg() If $MSG = $button Then $G=("LOADING:") & GUICtrlRead($List_2) MsgBox(64, "test", $G) EndIf WEnd 8)
GaryFrost Posted September 8, 2006 Posted September 8, 2006 (edited) BTW: It's a ListBox not a ListView or expandcollapse popup#include <GuiConstants.au3> #include <GuiStatusBar.au3> Global Const $DebugIt = 1 Global Const $WM_COMMAND = 0x0111 $GUI = GUICreate("MyGUI", 460, 260, -1, -1) $List_2 = GUICtrlCreateList("-Character Number-", 110, 30, 170, 71) GUICtrlSetData($List_2, 'Character 1') GUICtrlSetData($List_2, 'Character 2') GUICtrlSetData($List_2, 'Character 3') GUICtrlSetData($List_2, 'Character 4') $StatusBar = _GuiCtrlStatusBarCreate($GUI, -1, "") GUISetState() GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit Func List_SelChange() ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("$LBN_SELCHANGE") ;---------------------------------------------------------------------------------------------- $G= ("LOADING:") & GUICtrlRead($List_2) _GuiCtrlStatusBarSetText($StatusBar, $G, 0) EndFunc ;==>List_SelChange Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam) Local $nNotifyCode = _HiWord($wParam) Local $nID = _LoWord($wParam) Local $hCtrl = $lParam Local Const $LBN_ERRSPACE = (-2); Local Const $LBN_SELCHANGE = 1; Local Const $LBN_DBLCLK = 2; Local Const $LBN_SELCANCEL = 3; Local Const $LBN_SETFOCUS = 4; Local Const $LBN_KILLFOCUS = 5; Switch $nID Case $List_2 Switch $nNotifyCode Case $LBN_ERRSPACE ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("$LBN_ERRSPACE") ;---------------------------------------------------------------------------------------------- Case $LBN_SELCHANGE List_SelChange() Case $LBN_SELCANCEL ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("$LBN_SELCANCEL") ;---------------------------------------------------------------------------------------------- Case $LBN_SETFOCUS ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("$LBN_SETFOCUS") ;---------------------------------------------------------------------------------------------- Case $LBN_KILLFOCUS ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("$LBN_KILLFOCUS") ;---------------------------------------------------------------------------------------------- Case $LBN_DBLCLK ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("$LBN_DBLCLK") ;---------------------------------------------------------------------------------------------- EndSwitch EndSwitch ; 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 ;==>MY_WM_COMMAND Func _DebugPrint($s_text) ConsoleWrite( _ "!===========================================================" & @LF & _ "+===========================================================" & @LF & _ "-->" & $s_text & @LF & _ "+===========================================================" & @LF) EndFunc ;==>_DebugPrint Func _HiWord($x) Return BitShift($x, 16) EndFunc ;==>_HiWord Func _LoWord($x) Return BitAND($x, 0xFFFF) EndFunc ;==>_LoWord Edited September 8, 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.
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