Jump to content

Problem with tabbed form


SkiFreak
 Share

Recommended Posts

I am looking for some help on a problem I am having with a tabbed form.

I am calling a function that creates labels on Tab0 when the form is initiated. This works fine. At the moment this is a simple 2 tab form.

I click on a listitem (that is also in Tab0) that updates the data in the labels by calling another function (it reads data from a text file and updates the labels accordingly).

The problem is that when the second function is called the data appears on both Tab0 and Tab1.

How do I get this data to only appear on Tab0? I have tried to hide the data when Tab1 is clicked but this has not worked for me.

I do not want to post the entire app that I am writing but here are snippets of what I have done.

The first function I call (not that I think this is of too much help):

Func _Fillonstart()
    $FirstOpenJob = _GUICtrlListViewGetItemText ($Listview, 0)
    $Sub_Array_0 = stringsplit($FirstOpenJob,"|")
    $FirstOpenJobLine = $Sub_Array_0[1]

    $line = FileReadLine($logFile,$FirstOpenJobLine);Find out which line in the LogFile is to be read/modified
    $Sub_Array_1 = stringsplit($line,"|")
    $itemCount = _GUICtrlListViewGetItemCount ($Listview)
    If $itemCount <> 0  Then
        GUICtrlCreateGroup(" Problem Report Details ", 20, 270, 680, 120)
        $faultLabel1 = GUICtrlCreateLabel("Equipment:   " & $Sub_Array_1[2], 40, 300, 400, 20)
        $faultLabel2 = GUICtrlCreateLabel("Fault:       " & $Sub_Array_1[3], 40, 320, 400, 20)
        $faultLabel3 = GUICtrlCreateLabel("User:        " & $Sub_Array_1[4], 40, 340, 400, 20)
        $faultLabel4 = GUICtrlCreateLabel("Computer:    " & $Sub_Array_1[5], 440, 300, 250, 20)
        $faultLabel5 = GUICtrlCreateLabel("IP Address:  " & $Sub_Array_1[6], 440, 320, 250, 20)
        $faultLabel6 = GUICtrlCreateLabel("Time Reported:   " & $Sub_Array_1[7], 440, 340, 250, 20)
        $faultLabel7 = GUICtrlCreateLabel("Date:        " & $Sub_Array_1[8], 440, 360, 250, 20)
    EndIf
    $FirstRun = 1
EndFunc

The second function I call:

Func ListView_Click()
    $ProblemDescription = ""
    $RepairTime = ""    
    $SupportEngineer = ""
    $FirstRun = 0
    
    For $i = 0 To UBound($Repair_Time)-1                        ;|
        GuiCtrlSetState($Repair_Time[$i], $GUI_UNCHECKED)       ;|
    Next                                                        ;|
    For $i = 0 To UBound($Support_Engineer)-1                   ;|  Used to clear the radio buttons and input box
        GuiCtrlSetState($Support_Engineer[$i], $GUI_UNCHECKED)  ;|
    Next                                                        ;|
    GUICtrlSetData($Problem_Description,"")                     ;|

    $a_Item = _GUICtrlListViewGetItemTextArray ($Listview)
    $s_indices =  _GUICtrlListViewGetSelectedIndices($Listview)
;   MsgBox(0,"",$s_indices)

    $OpenThisJob = _GUICtrlListViewGetItemText ($Listview, $s_indices)
;   MsgBox(0,"",$FirstOpenJob)
    $Sub_Array_0 = stringsplit($OpenThisJob,"|")
    $OpenJobLine = $Sub_Array_0[1]

    $line = FileReadLine($logFile,$OpenJobLine);Find out which line in the LogFile is to be read/modified
;   MsgBox(0,"",$line)
    
    $Sub_Array_1 = stringsplit($line,"|")

    If Not @error Then;Deal with clicking in a blank area of the ListView
        $group = GUICtrlCreateGroup(" Problem Report Details ", 20, 270, 680, 120)
        $faultLabel1 = GUICtrlCreateLabel("Equipment:   " & $Sub_Array_1[2], 40, 300, 400, 20)
        $faultLabel2 = GUICtrlCreateLabel("Fault:       " & $Sub_Array_1[3], 40, 320, 400, 20)
        $faultLabel3 = GUICtrlCreateLabel("User:        " & $Sub_Array_1[4], 40, 340, 400, 20)
        $faultLabel4 = GUICtrlCreateLabel("Computer:    " & $Sub_Array_1[5], 440, 300, 250, 20)
        $faultLabel5 = GUICtrlCreateLabel("IP Address:  " & $Sub_Array_1[6], 440, 320, 250, 20)
        $faultLabel6 = GUICtrlCreateLabel("Time Reported:   " & $Sub_Array_1[7], 440, 340, 250, 20)
        $faultLabel7 = GUICtrlCreateLabel("Date:        " & $Sub_Array_1[8], 440, 360, 250, 20)
    EndIf
    GUICtrlSetState($Problem_Description,$GUI_FOCUS)
EndFunc
Link to comment
Share on other sites

I am looking for some help on a problem I am having with a tabbed form.

In your ListView_Click() I think you should say

GuictrlSetData($faultLabel1,"Equipment: " & $Sub_Array_1[2]) etc

instead of

$faultLabel1 = GuiCtrlCreateLabel(.....

which will create a new label on the last tab page you created.

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

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...