Jump to content

Labels showing on tab when they shouldnt


furrycow
 Share

Recommended Posts

could we see the section of code that updates the labels possibly ?

Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Link to comment
Share on other sites

could we see the section of code that updates the labels possibly ?

Sure, well, first of all, heres what the other tab looks like:

Posted Image

Then the code, of which i have taken all the unnecessary stuff to the labels...ive also taken out the code of the Progress bars, as they dont show through even when on a different tab and the original tab is updating.

$LBLUpdateAttemptResult = GUICtrlCreateLabel($updateattempt, 456, 248, 10, 17)
GUICtrlSetBkColor ($LBLUpdateAttemptResult, "0xf6f4f1") 



While $replaceterms < $numofreplaceterms

$termstringinstr=StringInStr ($searchterms, $termreplacer,2)

        If $termstringinstr=0 Then
        Else
           $LBLInvalidTermResult = GUICtrlCreateLabel($lastterm, 456, 280, 180, 17)
           GUICtrlSetBkColor ($LBLInvalidTermResult, "0xf6f4f1") 
           $LBLInvalidTermCountResult = GUICtrlCreateLabel($termcount, 456, 312, 7, 17)
           GUICtrlSetBkColor ($LBLInvalidTermCountResult, "0xf6f4f1") 
        EndIf
WEnd

No labels show through that arent being created on different tabs. And even if the label has been created on the tab you are looking at, and then finishes updating, then if i go to a new tab, the label is still visible on that tab too, even though it is not being created anymore.

Many Thanks

Instant Lockerz Invite - www.instantlockerzinvite.co.uk
Link to comment
Share on other sites

You haven't shown the code but I would guess you have forgotten to end the tab definitions with GuiCtrlCreateTab(""). Otherwise you might have created labels which are not in tabs but in the area used by the tab.

EDIT: I might have (probably did) misunderstood the problem. If you are adding components to a tab after yiou have originally created the tab and closed it then I think it is a problem. Maybe you have to create all the required labels first then set the data for them and change their visibilty say when you update rather than try to create them.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

You haven't shown the code but I would guess you have forgotten to end the tab definitions with GuiCtrlCreateTab(""). Otherwise you might have created labels which are not in tabs but in the area used by the tab.

Sorry, i wasnt sure what code was needed, but, as i am a noob i used the Koda FormDesigner, for the basic design of the form before doing any coding of my own. The GuiCtrlCreateTab("") is there right at the end of the all my form design. Although this will look VERY messy, its how the Koda FormDesigner set it out, i've added a few little things in since, but its pretty much how i was given it by Koda. These are all the design settings of the form.

Opt("GUIOnEventMode", 1)
$MySearch = GUICreate("", 666, 458, 281, 147)
$TABAll = GUICtrlCreateTab(8, 32, 650, 409)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUISetOnEvent($GUI_EVENT_CLOSE, "ExitProg")
;=========================================
;Search TAB
;=========================================
$TABSearch = GUICtrlCreateTabItem("Search")

$GRPBOXSearchStats = GUICtrlCreateGroup("Search Statistics", 24, 64, 353, 361)
$LBLLastTermSearched = GUICtrlCreateLabel("Last Term Searched", 32, 96, 100, 17)
$LBLLastTermSearchedResult = GUICtrlCreateLabel("-", 152, 96, 7, 17)
$LBLNextSearchTime = GUICtrlCreateLabel("Next Search (Secs)", 32, 192, 96, 17)
$LBLNextSearchTimeResult = GUICtrlCreateLabel("-", 152, 192, 7, 17)
$LBLNextUpdate = GUICtrlCreateLabel("Next Update (Secs)", 32, 240, 97, 17)
$LBLNextUpdateResult = GUICtrlCreateLabel("-", 152, 240, 7, 17)
$LBLLinkType = GUICtrlCreateLabel("Link Followed", 32, 128, 69, 17)
$LBLLinkTypeResult = GUICtrlCreateLabel("-", 152, 128, 7, 17)
$LBLSearchEngine = GUICtrlCreateLabel("Search Engine", 32, 160, 74, 17)
$LBLSearchEngineResult = GUICtrlCreateLabel("-", 152, 160, 7, 17)
$LBLEstimateFinish = GUICtrlCreateLabel("Estimated End Time", 32, 320, 98, 17)
$LBLEstimatedFinishTime = GUICtrlCreateLabel("-", 152, 320, 7, 17)
$LBLStartTime = GUICtrlCreateLabel("Start Time", 32, 288, 52, 17)
$LBLStartTimeResult = GUICtrlCreateLabel("-", 152, 288, 7, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GRPBOXControlPanel = GUICtrlCreateGroup("Control Panel", 384, 64, 257, 361)
$BUTStart = GUICtrlCreateButton("Start", 464, 256, 105, 25, 0)
;GUICtrlSetOnEvent($BUTStart, "Start")
$LBLMonitor = GUICtrlCreateLabel("Program Monitor", 400, 96, 81, 17)
$LBLMonitorResult = GUICtrlCreateLabel("-", 504, 96, 7, 17)
$LBLIE = GUICtrlCreateLabel("Internet Explorer", 400, 128, 81, 17)
$LBLIEResult = GUICtrlCreateLabel("-", 504, 128, 7, 17)
$LBLSoftwareUpdate = GUICtrlCreateLabel("Software Updater", 400, 160, 87, 17)
$LBLSoftwareUpdateResult = GUICtrlCreateLabel("-", 504, 160, 7, 17)
$PROCtrlPanelLoad = GUICtrlCreateProgress(400, 200, 225, 25)
$BUTPause = GUICtrlCreateButton("Pause", 464, 296, 105, 25, 0)
GUICtrlSetOnEvent($BUTPause, "Pause")
$BUTExit = GUICtrlCreateButton("Exit", 464, 376, 105, 25, 0)
GUICtrlSetOnEvent($BUTExit, "ExitProg")
$BUTRestart = GUICtrlCreateButton("Restart", 464, 336, 105, 25, 0)
GUICtrlSetOnEvent($BUTRestart, "Restart")
GUICtrlCreateGroup("", -99, -99, 1, 1)
;=========================================
;Wordlist TAB
;=========================================
$TABWordlist = GUICtrlCreateTabItem("Wordlist")

$GRPBOXUpdateList = GUICtrlCreateGroup("Update", 312, 64, 329, 361)
$LBLFinding = GUICtrlCreateLabel("Finding Search Terms", 320, 96, 107, 17)
$LBLWriting = GUICtrlCreateLabel("Writing Search Terms", 320, 128, 106, 17)
$LBLCleaning = GUICtrlCreateLabel("Cleaning Search Terms", 320, 160, 114, 17)
$LBLReplacing = GUICtrlCreateLabel("Replacing Search Terms", 320, 192, 121, 17)
$PROFinding = GUICtrlCreateProgress(456, 96, 137, 17)
$PROWriting = GUICtrlCreateProgress(456, 128, 137, 17)
$PROCleaning = GUICtrlCreateProgress(456, 160, 137, 17)
$PROReplacing = GUICtrlCreateProgress(456, 192, 137, 17)
$BUTUpdate = GUICtrlCreateButton("Update", 352, 376, 105, 25, 0)
GUICtrlSetOnEvent($BUTupdate, "Update")

$BUTUpdateCancel = GUICtrlCreateButton("Cancel", 496, 376, 105, 25, 0)
$LBLUpdateAttempt = GUICtrlCreateLabel("Update Attempt", 320, 248, 78, 17)
$LBLUpdateAttemptResult = GUICtrlCreateLabel("-", 456, 248, 7, 17)
$LBLInvalidTerm = GUICtrlCreateLabel("Last Invalid Term", 320, 280, 85, 17)
$LBLInvalidTermResult = GUICtrlCreateLabel("-", 456, 280, 7, 17)
$LBLInvalidTermCount = GUICtrlCreateLabel("Invalid Term Count", 320, 312, 93, 17)
$LBLInvalidTermCountResult = GUICtrlCreateLabel("-", 456, 312, 7, 17)
$LBLUpdateNote = GUICtrlCreateLabel("", 320, 344, 4, 4)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GRPBOXList = GUICtrlCreateGroup("Term List", 24, 64, 273, 161)
$LSTWordList = GUICtrlCreateList("", 40, 88, 241, 84)
$BUTRefresh = GUICtrlCreateButton("Refresh", 104, 184, 105, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GRPBOXCleaning = GUICtrlCreateGroup("Term Filter", 24, 232, 273, 193)
$LBLAddFilterTerm = GUICtrlCreateLabel("Add Term", 32, 259, 50, 17)
$IPTermFilter = GUICtrlCreateInput("", 96, 256, 185, 21)
$LSTTermFilter = GUICtrlCreateList("", 40, 320, 241, 84)
$BUTAddTerm = GUICtrlCreateButton("Add Term", 104, 288, 105, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
;=========================================
;Statistics TAB
;=========================================
$TABStats = GUICtrlCreateTabItem("Statistics")

$GRPBOXIndivStats = GUICtrlCreateGroup("Search Engine", 24, 64, 313, 361)
$LSTPerEngineStats = GUICtrlCreateList("", 40, 120, 273, 279)
$LBLEngine = GUICtrlCreateLabel("Engine", 40, 96, 37, 17)
$LBLEngineSearches = GUICtrlCreateLabel("Searches", 128, 96, 49, 17)
$LBLRatio = GUICtrlCreateLabel("Click/Search Ratio", 216, 96, 94, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GRPBOXGeneralStats = GUICtrlCreateGroup("", 352, 248, 289, 177)
$LBLTodayTotalSearches = GUICtrlCreateLabel("Today's Total Searches", 360, 272, 116, 17)
$LBLTodayTotalSearchesResult = GUICtrlCreateLabel("-", 512, 272, 7, 17)
$LBLTodayRatio = GUICtrlCreateLabel("Today's Click/Search Ratio", 360, 304, 134, 17)
$LBLTodayRatioResult = GUICtrlCreateLabel("-", 512, 304, 7, 17)
$LBLSearchPerEngine = GUICtrlCreateLabel("Today's Searches Per Engine", 360, 336, 144, 17)
$LBLSearchPerEngineResult = GUICtrlCreateLabel("-", 512, 336, 7, 17)
$LBLTotalSearches = GUICtrlCreateLabel("Total Searches", 360, 392, 76, 17)
$LBLTotalSearchesResult = GUICtrlCreateLabel("-", 512, 392, 7, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$CALStats = GUICtrlCreateMonthCal("2008/10/10", 352, 72, 289, 169)
;=========================================
;Settings TAB
;=========================================
$TABSettings = GUICtrlCreateTabItem("Settings")

GUICtrlSetState(-1,$GUI_SHOW)
$GRPBOXEngine = GUICtrlCreateGroup("Search Engine", 400, 64, 241, 145)
$LBLAddSearchEngine = GUICtrlCreateLabel("Add Search Engine", 408, 91, 96, 17)
$IPAddSearchEngine = GUICtrlCreateInput("", 512, 88, 113, 21)
$LSTAddSearchEngine = GUICtrlCreateList("", 411, 152, 217, 45)
$BUTAddEngine = GUICtrlCreateButton("Add", 408, 120, 105, 25, 0)
$BUTDeleteEngine = GUICtrlCreateButton("Delete", 520, 120, 105, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GRPBOXSettingsTime = GUICtrlCreateGroup("Search", 400, 216, 241, 209)
$LBLClickSearch = GUICtrlCreateLabel("Click/Search Ratio", 416, 251, 94, 17)
$LBLClickSearchResult = GUICtrlCreateLabel("-", 528, 251, 7, 17)
$IPClickSearch = GUICtrlCreateInput("", 576, 248, 49, 21)
$BUTClickSearchChange = GUICtrlCreateButton("Update", 464, 288, 105, 25, 0)
$LBLUpdateTime = GUICtrlCreateLabel("Update Time (Secs)", 416, 331, 98, 17)
$LBLUpdateTimeResult = GUICtrlCreateLabel("-", 528, 331, 7, 17)
$IPUpdateTime = GUICtrlCreateInput("", 576, 328, 49, 21)
$BUTUpdateTimeChange = GUICtrlCreateButton("Update", 464, 368, 105, 25, 0)

GUICtrlCreateGroup("", -99, -99, 1, 1)
$GRPBOXWordlist = GUICtrlCreateGroup("Replacement Wordlist", 24, 224, 369, 201)
$LSTReplaceTerm = GUICtrlCreateList("", 35, 312, 345, 97)
$LBLAddReplaceTerm = GUICtrlCreateLabel("Add Search Term", 32, 251, 87, 17)
$IPAddReplaceTerm = GUICtrlCreateInput("", 136, 248, 241, 21)
$BUTAddReplaceTerm = GUICtrlCreateButton("Add", 152, 280, 105, 25, 0)

GUICtrlCreateGroup("", -99, -99, 1, 1)
$GRPBOXGeneral = GUICtrlCreateGroup("General", 24, 64, 369, 153)
$RADToolTip = GUICtrlCreateRadio("Tooltip", 64, 120, 113, 17)
$RADTrayTip = GUICtrlCreateRadio("Traytip", 64, 144, 113, 17)
$CHKBOXTooltipVisible = GUICtrlCreateCheckbox("Show Tips", 40, 96, 97, 17)
$TipVisCheck=IniRead("Settings.ini","GUISettings","TipVis","1")
    If $TipVisCheck=1 Then
        GUICtrlSetState(-1, $GUI_CHECKED)
        GUICtrlSetState($RADToolTip,$GUI_ENABLE)
        GUICtrlSetState($RADTrayTip,$GUI_ENABLE)
    Else
        GUICtrlSetState(-1, $GUI_UNCHECKED)
        GUICtrlSetState($RADToolTip,$GUI_DISABLE)
        GUICtrlSetState($RADTrayTip,$GUI_DISABLE)
    EndIf
GUICtrlSetOnEvent($CHKBOXTooltipVisible,"TooltipVis")



$CHKBOXIE = GUICtrlCreateCheckbox("Show Internet Explorer", 40, 176, 129, 17)
$IEVisCheck=IniRead("Settings.ini","GUISettings","IEVis","1")
    If $IEVisCheck=1 Then
        GUICtrlSetState(-1, $GUI_CHECKED)
;GUICtrlGetState($CHKBOXIE)
    Else
        GUICtrlSetState(-1, $GUI_UNCHECKED)
;GUICtrlGetState($CHKBOXIE)
    EndIf

$BUTOpenFile = GUICtrlCreateButton("Settings File", 248, 104, 105, 25, 0)
GUICtrlSetOnEvent($BUTOpenFile, "OpenFile")
$BUTHistory = GUICtrlCreateButton("View History", 248, 152, 105, 25, 0)
GUICtrlSetOnEvent($BUTHistory, "History")
;=========================================
;About TAB
;=========================================
$TABAbout = GUICtrlCreateTabItem("About")

$GRPBOXSoftware = GUICtrlCreateGroup("Software", 24, 64, 233, 153)
$BUTSoftUpdate = GUICtrlCreateButton("Update", 88, 168, 105, 25, 0)
$LBLVersion = GUICtrlCreateLabel("Version", 48, 88, 39, 17)
$LBLVersionResult = GUICtrlCreateLabel("-", 112, 88, 7, 17)
$CHK = GUICtrlCreateCheckbox("Check for updates on startup", 48, 136, 193, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$GRPBOXKeyboard = GUICtrlCreateGroup("Keyboard Shortcuts", 24, 224, 233, 201)
$LBLKeyPause = GUICtrlCreateLabel("Pause", 40, 264, 34, 17)
$LBLKeyUpdateTerms = GUICtrlCreateLabel("Update Terms", 40, 288, 71, 17)
$LBLKeyRestart = GUICtrlCreateLabel("Restart", 40, 360, 38, 17)
$LBLKeyQuit = GUICtrlCreateLabel("Quit", 40, 384, 23, 17)
$LBLKeyPauseResult = GUICtrlCreateLabel("PAUSE", 128, 264, 40, 17)
$LBLKeyUpdateTermsResult = GUICtrlCreateLabel("F10", 128, 288, 22, 17)
$LBLKeyShowIE = GUICtrlCreateLabel("Show IE", 40, 312, 44, 17)
$LBLKeyHideIE = GUICtrlCreateLabel("Hide IE", 40, 336, 39, 17)
$LBLKeyShowIEResult = GUICtrlCreateLabel("F7", 128, 312, 16, 17)
$LBLKeyHideIEResult = GUICtrlCreateLabel("F8", 128, 336, 16, 17)
$LBLKeyRestartResult = GUICtrlCreateLabel("F6", 128, 360, 16, 17)
$LBLKeyQuitResult = GUICtrlCreateLabel("F9", 128, 384, 16, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$PICAbout = GUICtrlCreatePic("", 272, 72, 369, 145, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlCreateTabItem("")
;=========================================
;Main Form
;=========================================
$LBLStatus = GUICtrlCreateLabel("Current Status:", 8, 8, 74, 17)
$LBLStatusResult = GUICtrlCreateLabel("-", 88, 8, 7, 17)
GUISetState(@SW_SHOW)

Thank you

Edited by furrycow
Instant Lockerz Invite - www.instantlockerzinvite.co.uk
Link to comment
Share on other sites

if you use the GUICtrlSetData(controlID, data [, default ]) command then it simply updates controls on the form, it is a better way to use your controlls and i recommend you use it for all of them, take a look at this example, tabs 1,2 and 3 all have a label on, tab 1 has a button, if you click the button it changes the data of the label on tab 2 and it does not show on either of the other forms.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
;

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\F@T3oYCG\Desktop\Blank.kxf
$Main = GUICreate("Main", 633, 447, 312, 189)
$Tab1 = GUICtrlCreateTab(8, 8, 617, 433)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$Label1 = GUICtrlCreateLabel("Label1", 48, 40, 100, 100)
$Button1 = GUICtrlCreateButton("Button1", 48, 96, 249, 89, 0)
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
$Label2 = GUICtrlCreateLabel("Label2", 168, 104, 100, 100)
$TabSheet3 = GUICtrlCreateTabItem("TabSheet3")
$Label3 = GUICtrlCreateLabel("Label3", 200, 112, 100, 100)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            GUICtrlSetData($Label2, "changed data and label doesnt show on next form")
    EndSwitch
WEnd


;GUICtrlSetData(controlID, data [, default ])

so create the labels at the top of your code where your gui section is and use that command to modify them something like this

$LBLUpdateAttemptResult = GUICtrlCreateLabel($updateattempt, 456, 248, 10, 17)
GUICtrlSetBkColor ($LBLUpdateAttemptResult, "0xf6f4f1")
$LBLInvalidTermResult = GUICtrlCreateLabel("", 456, 280, 180, 17);I assume you would want these two labels to be blank unless they need to be modified
GUICtrlSetBkColor ($LBLInvalidTermResult, "0xf6f4f1")
$LBLInvalidTermCountResult = GUICtrlCreateLabel("", 456, 312, 7, 17);this is the second label they both have blank strings as their contents
GUICtrlSetBkColor ($LBLInvalidTermCountResult, "0xf6f4f1")

While $replaceterms < $numofreplaceterms

    $termstringinstr = StringInStr($searchterms, $termreplacer, 2)

    If $termstringinstr <> 0 Then;same as saying "if $termstringinstr = 0 then, else"
        GUICtrlSetData(controlID, $lastterm);set new data
        GUICtrlSetData(controlID, $termcount);set new data
    EndIf
WEnd

EDIT: i started to explain before the previous two posts, martin is correct and this is the solution, you really didnt need to post all of the code.

Edited by FaT3oYCG

Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...