1. The 3 LV_Modify lines near the bottom do not update the ListView in the main window, but the other 3 LV_Modify lines further up do work.
2. After BidButtonNext is called, the main game window seems to disappear (sinks under other programs' windows) instead of staying at the same level it was before.
Thank you for your time and constructive help
-----------------------------------------
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Num_Players := 2
Player1 := "Harry"
Player2 := "Sally"
Loop , %Num_Players% {
Var := "Player" . A_Index
cols .= "|" . %Var%
Player%A_Index%Score := 0
Player%A_Index%Bid := 0
}
Gui,New, +HwndMyGuiHwnd, Up and Down the River
Gui, %MyGuiHwnd%:Default
Gui,Add,ListView,R14 NoSortHdr Grid ReadOnly w500 vMLV, Deal|Turn#%cols%
Turn1 := 7
Turn2 := 6
Turn3 := 5
Turn4 := 4
Turn5 := 3
Turn6 := 2
Turn7 := 1
Turn8 := 2
Turn9 := 3
Turn10 := 4
Turn11 := 5
Turn12 := 6
Turn13 := 7
Try = 1
Loop, 13 {
; Each row needs Dealer, Turn#, "Player1Bid,Player1Score", "Player2Bid,Player2Score", "Player3Bid,Player3Score" etc
if (Try > Num_Players) {
Try = 1
}
Dealer := SubStr(Player%Try%,1,1)
Try++
LV_Add(AutoHDR,Dealer,Turn%A_Index%,"0 0","0 0","0 0","0 0","0 0","0 0","0 0","0 0")
}
Turn := 1
Player := 1
Bid := 0
Gui Add, Button,y+10 gStartBids, Start Bids
Gui,Show
return
StartBids:
LV_Modify(3,,,,"4 25") ;These 3 lines DO get updated in the ListView
LV_Modify(4,,,,"2 15")
LV_Modify(5,,,,"1 5")
Gui Bid:+owner%MyGuiHwnd% ;set owner to the main window
Gui +Disabled ;disable main window
Gui,Bid:Add,Text,,What is Player%Player%'s bid for Turn %Turn%?
Gui,Bid:Add,Edit,x164 y0 W30 ReadOnly
Gui,Bid:Add,UpDown,Range0-7 vP_Bid, 0
Gui,Bid:Add,Button,x87 y25 w43 h23, Next
Gui,Bid:Show
return
BidButtonNext:
Gui, Bid:Submit
Gui, %MyGuiHwnd%:-Disabled ; Re-enable the main window (must be done prior to the next step).
Gui, Bid:Destroy
MsgBox Bid is %P_Bid%
;LV_Modify(%Turn%,,,%P_Bid% . " score")
LV_Modify(6,,,,"6 55") ;These 3 lines do not get updated in the ListView
LV_Modify(7,,,,"7 15")
LV_Modify(8,,,,"8 5")
;GuiControl, +Redraw, MLV ;no effect
return
GuiClose:
ExitApp