Gene Posted October 24, 2005 Posted October 24, 2005 (edited) In the GUI I'm working on I have a tabitem with 5 active controls (two combo boxes, three buttons) and 3 labels too. Two of the active controls (a combo box and a button) work perfectly. The other three either don't work at all or in an erratic manner. Both combos were copied from another location on the untabbed part of the GUI with corresponding changes to X & Y coords and the handle variable changed. The three buttons were also copied from elsewhere coords, captions & handle vars were changed. All the new handles were placed in the GuiGetMsg() Select Case statement. The code is below, I would appreciate suggestions & Id of errors. $TabDeletions = GUICtrlCreateTabItem("Deletions") $DelNameLabel = GUICtrlCreateLabel("Select a Name:", 278, 185, 95, 25, $SS_CENTERIMAGE) $DelNamesBox = GUICtrlCreateCombo("", 368, 185, 145, 101, BitOR($CBS_SORT, $CBS_DROPDOWN, $WS_VSCROLL)) GUICtrlSetData($DelNamesBox, "") GUICtrlSetData($DelNamesBox, $sNameList) $DelNameBtn = GUICtrlCreateButton("Delete Name", 516, 185, 89, 25) $DelNameLabel2 = GUICtrlCreateLabel("Deleting a Name deletes all the activities associated with the name. ", 278, 209, 325, 50, $SS_LEFT) $dReloadBtn = GUICtrlCreateButton("Reload", 380, 235, 89, 25) $DelActLabel = GUICtrlCreateLabel("To delete an activity, select a name above, then select an Activity associated with the name", 278, 270, 325, 50, $SS_LEFT) $DelActivityBox = GUICtrlCreateCombo("", 300, 305, 170, 101, BitOR($CBS_SORT, $CBS_DROPDOWN, $WS_VSCROLL)) GUICtrlSetData($DelActivityBox, "") GUICtrlSetData($DelActivityBox, $sActivityList) $DelActBtn = GUICtrlCreateButton("Delete Activity", 480, 305, 115, 25) $DelNamesBox and $DelNameBtn work perfectly. The $dReloadBtn button doesn't respond on the screen or any where else. $DelActivityBox and $DelActBtn do occasionally dropdown and show being clicked respectively on the screen. Nothing happens in the case tree. The Case tree code is below. expandcollapse popupCase $msg = $TabDeletions MsgBox(0, "Information", "TabDeletions") Case $msg = $DelNamesBox $sDelName = "" If $DelNamesBox <> "" Then If $DelNamesBox > 0 Then $sDelName = GUICtrlRead($DelNamesBox) EndIf EndIf ;MsgBox(0,"Information","$DelNamesBox") $var = IniReadSectionNames($sDataPath & $sDelName & ".INI") If @error Then If Not FileExists($sDataPath & $sDelName & ".INI") Then MsgBox(4096, "Error 980", "Error occured, due to INI file not found " & $sDataPath & $sDelName & ".INI" & " file.") If FileExists($sDataPath & $sDelName & ".INI") Then MsgBox(4096, "Error 982", "Error occured, INI file found, expected section or keys not found " & $sDataPath & $sDelName & ".INI" & " file.") ;MsgBox(4096, "INI Error 897", "Error occured, probably new, empty INI file. Press ENTER or click OK to continue.") Else $sTemp = "" For $i = 1 To $var[0] If (Not StringInStr($var[$i], "Name")) And (Not StringInStr($var[$i], "Style_Location")) Then ;If $var[$i] <> "Name" And $var[$i] <> "Style_Location" Then $sTemp = $sTemp & "|" & $var[$i] EndIf Next $sTemp = StringTrimLeft($sTemp, 1) $sActivityList = $sTemp GUICtrlSetData($ActivitiesBox, "") GUICtrlSetData($ActivitiesBox, $sActivityList) GUICtrlSetData($DelActivityBox, "") GUICtrlSetData($DelActivityBox, $sActivityList) EndIf Case $msg = $DelNameBtn If $DelNamesBox <> "" Then If $DelNamesBox > 0 Then $sDelName = GUICtrlRead($DelNamesBox) Else $sDelName = "" EndIf Else $sDelName = "" EndIf If StringInStr($sNameList, $sDelName) Then If FileExists($sDataPath & $sDelName & ".INI") Then $iResponse = MsgBox(1, "Confirm Name Deletion", " The name chosen " & $sDelName & " will be deleted!") If $iResponse = 2 Then MsgBox(0, "Information", "By your choice the name was not deleted.") EndIf If $iResponse = 1 Then ;MsgBox(0,"information", "1") $iError = FileDelete($sDataPath & $sDelName & ".INI") If $iError = 1 Then $sVar = $sNameList $sVar = StringReplace($sVar, $sDelName, "") $sVar = StringReplace($sVar, "||", "|") $sNameList = $sVar IniWrite($sSLT_INI_FullFilePath, "Names", "NameList", $sNameList) $sNameList = IniRead($sSLT_INI_FullFilePath, "Names", "NameList", "") GUICtrlSetData($DelNamesBox, "") GUICtrlSetData($NamesBox, "") GUICtrlSetData($DelNamesBox, $sNameList) GUICtrlSetData($NamesBox, $sNameList) Else MsgBox(0, "Error 927", "The data file " & $sDataPath & $sDelName & ".INI" & " for that name was not deleted.") EndIf EndIf Else MsgBox(0, "Information", "The data file for that name doesn't exist.") EndIf EndIf Case $msg = $dReloadBtn $sDelNameList = IniRead($sSLT_INI_FullFilePath, "Names", "NameList", "") GUICtrlSetData($DelNamesBox, "") GUICtrlSetData($DelNamesBox, $sDelNameList) MsgBox(0, "Information", "$dReloadBtn") Case $msg = $DelActivityBox MsgBox(0, "Information", "$DelActivityBox") $sDelActivity = "" If $DelActivityBox <> "" Then If $DelActivityBox > 0 Then $sDelActivity = GUICtrlRead($DelActivityBox) EndIf EndIf Case $msg = $DelActBtn If $DelNamesBox <> "" Then If $DelNamesBox > 0 Then $sDelName = GUICtrlRead($DelNamesBox) Else $sDelName = "" EndIf Else $sDelName = "" EndIf $sDelActivity = "" If $DelActivityBox <> "" Then If $DelActivityBox > 0 Then $sDelActivity = GUICtrlRead($DelActivityBox) Else $sDelActivity = "" EndIf Else $sDelActivity = "" EndIf If FileExists($sDataPath & $sDelName & ".INI") Then $iResponse = MsgBox(1, "Confirm Activity Deletion", " The activity chosen " & $sDelActivity & " in the " & $sDelName & " data file will be deleted!") If $iResponse = 2 Then MsgBox(0, "Information", "By your choice the activity was not deleted.") EndIf If $iResponse = 1 Then ;MsgBox(0,"information", "1") IniDelete($sDataPath & $sDelName & ".INI", $sDelActivity) $var = IniReadSectionNames($sDataPath & $sDelName & ".INI") If @error Then If Not FileExists($sDataPath & $sDelName & ".INI") Then MsgBox(4096, "Error 980", "Error occured, due to INI file not found " & $sDataPath & $sDelName & ".INI" & " file.") If FileExists($sDataPath & $sDelName & ".INI") Then MsgBox(4096, "Error 982", "Error occured, INI file found, expected section or keys not found " & $sDataPath & $sDelName & ".INI" & " file.") ;MsgBox(4096, "INI Error 897", "Error occured, probably new, empty INI file. Press ENTER or click OK to continue.") Else $sTemp = "" For $i = 1 To $var[0] If (Not StringInStr($var[$i], "Name")) And (Not StringInStr($var[$i], "Style_Location")) Then ;If $var[$i] <> "Name" And $var[$i] <> "Style_Location" Then $sTemp = $sTemp & "|" & $var[$i] EndIf Next $sTemp = StringTrimLeft($sTemp, 1) $sActivityList = $sTemp GUICtrlSetData($ActivitiesBox, "") GUICtrlSetData($ActivitiesBox, $sActivityList) GUICtrlSetData($DelActivityBox, "") GUICtrlSetData($DelActivityBox, $sActivityList) EndIf EndIf EndIf Also, I can't find any references either way... Case $msg = $TabDeletions MsgBox(0, "Information", "TabDeletions") When I click on the Deletions TAB, should I expect the MsgBox to be displayed? Gene Edited for spelling and clarity Edited October 24, 2005 by Gene [font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...
MHz Posted October 24, 2005 Posted October 24, 2005 Hi Gene, I noticed your gui control creation is not from top to bottom but any sequence. I have had problems in the past by not keeping a sequence (especially with combo's). I have reshuffled them to see if they are better then before. Erratic control response can also be overlapping controls. Simple color the controls background in a temporary manner can help to see any overlaps. See if that helps. $TabDeletions = GUICtrlCreateTabItem("Deletions") $DelNameLabel = GUICtrlCreateLabel("Select a Name:", 278, 185, 95, 25, $SS_CENTERIMAGE) $DelNameLabel2 = GUICtrlCreateLabel("Deleting a Name deletes all the activities associated with the name. ", 278, 209, 325, 50, $SS_LEFT) $DelActLabel = GUICtrlCreateLabel("To delete an activity, select a name above, then select an Activity associated with the name", 278, 270, 325, 50, $SS_LEFT) $DelActivityBox = GUICtrlCreateCombo("", 300, 305, 170, 101, BitOR($CBS_SORT, $CBS_DROPDOWN, $WS_VSCROLL)) GUICtrlSetData($DelActivityBox, "") GUICtrlSetData($DelActivityBox, $sActivityList) $DelNamesBox = GUICtrlCreateCombo("", 368, 185, 145, 101, BitOR($CBS_SORT, $CBS_DROPDOWN, $WS_VSCROLL)) GUICtrlSetData($DelNamesBox, "") GUICtrlSetData($DelNamesBox, $sNameList) $dReloadBtn = GUICtrlCreateButton("Reload", 380, 235, 89, 25) $DelActBtn = GUICtrlCreateButton("Delete Activity", 480, 305, 115, 25) $DelNameBtn = GUICtrlCreateButton("Delete Name", 516, 185, 89, 25)
Gene Posted October 24, 2005 Author Posted October 24, 2005 (edited) Hi Gene,I noticed your gui control creation is not from top to bottom but any sequence. I have had problems in the past by not keeping a sequence (especially with combo's). I have reshuffled them to see if they are better then before. Erratic control response can also be overlapping controls. Simple color the controls background in a temporary manner can help to see any overlaps. See if that helps.$TabDeletions = GUICtrlCreateTabItem("Deletions") $DelNameLabel = GUICtrlCreateLabel("Select a Name:", 278, 185, 95, 25, $SS_CENTERIMAGE) $DelNameLabel2 = GUICtrlCreateLabel("Deleting a Name deletes all the activities associated with the name. ", 278, 209, 325, 50, $SS_LEFT) $DelActLabel = GUICtrlCreateLabel("To delete an activity, select a name above, then select an Activity associated with the name", 278, 270, 325, 50, $SS_LEFT) $DelActivityBox = GUICtrlCreateCombo("", 300, 305, 170, 101, BitOR($CBS_SORT, $CBS_DROPDOWN, $WS_VSCROLL)) GUICtrlSetData($DelActivityBox, "") GUICtrlSetData($DelActivityBox, $sActivityList) $DelNamesBox = GUICtrlCreateCombo("", 368, 185, 145, 101, BitOR($CBS_SORT, $CBS_DROPDOWN, $WS_VSCROLL)) GUICtrlSetData($DelNamesBox, "") GUICtrlSetData($DelNamesBox, $sNameList) $dReloadBtn = GUICtrlCreateButton("Reload", 380, 235, 89, 25) $DelActBtn = GUICtrlCreateButton("Delete Activity", 480, 305, 115, 25) $DelNameBtn = GUICtrlCreateButton("Delete Name", 516, 185, 89, 25)Thank you for the response. This is my first GUI, but I've been using AutoIt since about 2.4 or 2.5. I had no idea that order was important in the way you show. I'll try that today. Since none of the rest of the code is in other than modular order, I suspect the problem is overlap. The tabitem area is a little crowded, but the three nonworking controls appear no more crowded than the working ones. Coloring the controls is a good idea and I'll do that today too.GeneEdited typosActually each screen and tabitem area controls are arranged in in tab order duplicating the phsyical order on the screen area or tab area. Edieted an update.Thanks again, it was the overlap.Gene Edited October 24, 2005 by Gene [font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...
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