Sign in to follow this  
Followers 0
MrPinkComputerShrink

Text overwirte problem on tabbed interface

3 posts in this topic

Hello,

Several places in my Tabbed GUI input is overwritten again and again. the problem is that I can't get the old text to go away.  So it overlaps until it is a mixed up line of unreadable black.

In the sample below if you go to TAB4, Enter some text in the input box, click OK.  Thinks look normal.

Go to the input box agaion and change or add more text and click on OK.  Not so Good. 

Thanks!

#include <Array.au3>
;#include <AVIConstants.au3>
#include <Constants.au3>
;#include <Date.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
;#include <IE.au3>
#include <Process.au3>
#include <StaticConstants.au3>
#include <String.au3>
;#include <TreeViewConstants.au3>
#include <ListViewConstants.au3>
#include <ColorConstants.au3>
#include <WinAPI.au3>
;#include <Inet.au3>
#include <Services.au3>
;#include <NetInfo.au3>
#include <WindowsConstants.au3>
;#include <GuiImageList.au3>
Global $g_idListView = 99999 , $DirectSubmitButton, $StatusButton

DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1) ; This disables 32bit applications from being redirected to syswow64 instead of system32 by default ;


ConsoleWrite("Loaded #include Files" & @CRLF)


Global $SSID, $BSSID, $Signal, $Authentication, $Encryption

GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; to allow drag and dropping
ConsoleWrite("Created Variables" & @CRLF)


DirCreate (@TempDir & "\\SCCTemp")
$SCCTempDir=(@TempDir & "\\SCCTemp\")
ConsoleWrite("Created $SCCTempDir directory at " & $SCCTempDir & @CRLF)

Call("_WifiNetsPrep")
Call("_WifiNets")


$Gooey = GUICreate("Sortable Wifi Tab", 770, 540)

$Tab = GUICtrlCreateTab(10, 0, 755, 530) ; -15 x -10

$Tab1 = GUICtrlCreateTabItem("Tab 1") ;- ==========================================================================  Status
;~ GUISwitch($Gooey, $Tab1)
$font = ("Lucida Console")
GUISetFont(9, 400, 1, $font)
GUICtrlCreateLabel("Data on Tab 1", 30, 60) ; Label, Dist to right, Down
;~ GUICtrlCreateTabItem("")
;~ GUISwitch($Gooey)

$Tab2 = GUICtrlCreateTabItem("Tab 2") ;- ==========================================================================  ARP/UPnP
;~ GUISwitch($Gooey, $Tab2)
$font = ("Lucida Console")
GUISetFont(9, 400, 1, $font)
GUICtrlCreateLabel("Data on Tab 2", 30, 60) ; Label, Dist to right, Down
;~ GUICtrlCreateTabItem("")
;~ GUISwitch($Gooey)

$Tab3 = GUICtrlCreateTabItem("Tab 3") ; =================================================================================== PINGS
;~ GUISwitch($Gooey, $Tab3)
$font = ("MS Sans Serif")
GUISetFont(9, 400, 1, $font)
GUICtrlCreateLabel("Data on Tab 3", 30, 60) ; Label, Dist to right, Down
;~ GUICtrlCreateTabItem("")
;~ GUISwitch($Gooey)

$Tab4 = GUICtrlCreateTabItem("Tab 4") ;- ==========================================================================  s
        GUISwitch($Gooey, $Tab4)

            GUICtrlCreateLabel("Ping: ", 30, 450)  ; Label, Dist to right, Down
            Global $Tab4OK = GUICtrlCreateInput("", 80, 60, 150, 20)
            ;MsgBox(0, "$BrowserDefault", $BrowserDefault)
            $IPButton = GUICtrlCreateButton("OK", 340, 60, 60)
            ;GUICtrlSetState($IPButton, $GUI_DISABLE)
            $DirectSubmitButton = GUICtrlCreateButton("Direct Submit", 340, 90, 85)
            GUICtrlSetState($DirectSubmitButton, $GUI_DISABLE)
            $StatusButton = GUICtrlCreateButton("Status", 340, 120, 60)
            GUICtrlSetState($StatusButton, $GUI_DISABLE)


$Tab5 = GUICtrlCreateTabItem("Wifi") ;- ==========================================================================  Wifi Networks

GUICtrlCreateTabItem("")
_BuildLV()

GUISetState()
While 1

    Switch GUIGetMsg()
        Case $Tab
            Switch GUICtrlRead($Tab)
                Case $Tab
                Case 0
                    ;ConsoleWrite ("1st Tab  " & @CRLF  )  ; Status
                Case 1
                    ;ConsoleWrite ("2nd Tab  " & @CRLF  )  ; ARP/UPnP
                Case 2
                    ;ConsoleWrite ("3rd Tab  "& @CRLF  )    ; Pings
                Case 3
                    ;ConsoleWrite ("4th Tab  " & @CRLF  )   ; s
                Case 4
;~

        EndSwitch

    Case $IPButton
            GUISwitch($Gooey, $Tab4)
            ;MsgBox(0, "this", "This is in SonosIP Button")
            Call ("_Tab4")                                      ; Call to TAB with Overwriet issue
            GUICtrlCreateTabItem("")
            GUISwitch($Gooey)

        Case $GUI_EVENT_CLOSE
            ConsoleWrite("Case $GUI_EVENT_CLOSE in main loop" & @CRLF)
            DirRemove($SCCTempDir)
            Exit
        Case $g_idListView
            _SortBy()
    EndSwitch
WEnd





Func _Tab4() ; ========================================  TAB with Overwrite issue =============================================================================
    GUISwitch($Gooey, $Tab4)

    GUICtrlSetState($DirectSubmitButton, $GUI_ENABLE)
    GUICtrlSetState($StatusButton, $GUI_ENABLE)

$DestinationIP = "192.168.1.34"
$DestinationIP = GUICtrlRead($Tab4OK)

    ;$font = ("Verdana")
    ;GUISetFont(9, 400,1 , $font)
    Global $DS = GUICtrlCreateLabel("http://" & $DestinationIP & "/support/", 30, 90)
    $DirectSubmit = ("http://" & $DestinationIP & "/support/")

    Global $Stat = GUICtrlCreateLabel("http://" & $DestinationIP & "/status", 30, 120)
    $Status = ("http://" & $DestinationIP & "/status")



    GUICtrlCreateTabItem("")
    GUISwitch($Gooey)
EndFunc











































Func _WifiNetsPrep()
    Local $rc = _RunDos("netsh wlan show all > " & $SCCTempDir & "WifiData.txt")
    Global $WifiData2 = $SCCTempDir & "WifiData.txt"
    ConsoleWrite("WIfiTab $$WifiData2  " & $WifiData2)
    Local $WifiNets = FileRead($WifiData2)
    FileOpen($WifiData2, 2)
    Local $Trim1 = StringInStr($WifiNets, "SSID 1")
    $WifiNets = StringTrimLeft($WifiNets, $Trim1 - 6)
    FileWrite($WifiData2, $WifiNets)
    FileClose($WifiData2)
    $WifiNets = FileOpen($WifiData2, 1)
    FileWriteLine($WifiNets, "END")
    FileClose($WifiNets)
EndFunc   ;==>_WifiNetsPrep

Func _WifiNets()
    ConsoleWrite("Called _WifiNets()" & @CRLF)
    $WifiNets = FileOpen($WifiData2, 0)
    Local $WifiNetsParsed = FileOpen($SCCTempDir & "WifiNetsParsed.txt", 2)

    Do
        Local $WifiNetLine = FileReadLine($WifiNets)

        Local $SSIDCheck = StringInStr($WifiNetLine, "SSID")
        If $SSIDCheck <> 0 Then FileWriteLine($WifiNetsParsed, $WifiNetLine)


        Local $AuthenticationCheck = StringInStr($WifiNetLine, "Authentication")
        If $AuthenticationCheck <> 0 Then FileWriteLine($WifiNetsParsed, $WifiNetLine)


        Local $EncryptionCheck = StringInStr($WifiNetLine, "Encryption")
        If $EncryptionCheck <> 0 Then FileWriteLine($WifiNetsParsed, $WifiNetLine)


        Local $SignalCheck = StringInStr($WifiNetLine, "Signal")
        If $SignalCheck <> 0 Then FileWriteLine($WifiNetsParsed, $WifiNetLine)

        Local $ChannelCheck = StringInStr($WifiNetLine, "Channel")
        If $ChannelCheck <> 0 Then FileWriteLine($WifiNetsParsed, $WifiNetLine)
        If $ChannelCheck <> 0 Then FileWriteLine($WifiNetsParsed, " ")

    Until $WifiNetLine = "END"

    FileClose("$WifiData2")
    FileWriteLine($WifiNetsParsed, "END")
    FileClose($WifiNetsParsed)
    $font = ("MS Sans Serif")
    GUISetFont(9, 400, 1, $font)
    Local $iListView = GUICtrlCreateListView("Detected Wifi Networks                                            ", 30, 90, 725, 430)
    _GUICtrlListView_SetColumnWidth($iListView, 0, $LVSCW_AUTOSIZE_USEHEADER)
    $WifiNetsParsed = FileOpen($SCCTempDir & "WifiNetsParsed.txt", 0)

    Do
        $WifiNets = FileReadLine($WifiNetsParsed)

        GUICtrlCreateListViewItem($WifiNets, $iListView)
    Until $WifiNets = "END"

EndFunc   ;==>_WifiNets

Func _BuildLV() ;  Wifi data sort

    ConsoleWrite(@ScriptLineNumber & " Called _BuildLV" & @CRLF)
;~  Global $g_idListView
    Local $hImage, $aIcons[3] = [0, 3, 6]
    Local $iExWindowStyle = BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE)
    Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)

    GUISwitch($Gooey, $Tab5)

    $g_idListView = GUICtrlCreateListView("SSID|BSSID|Channel|Signal|Authentication|Encryption", 20, 25, 730, 500, -1, $iExWindowStyle) ;28, 25, 725, 500

    _GUICtrlListView_SetExtendedListViewStyle($g_idListView, $iExListViewStyle)

    $WifiNets = FileOpen($WifiData2, 0)

    Do
        Global $WifiNetLine = FileReadLine($WifiNets)
        Global $SSIDCheck = StringInStr($WifiNetLine, "SSID")
        Global $AuthenticationCheck = StringInStr($WifiNetLine, "Authentication")
        Global $EncryptionCheck = StringInStr($WifiNetLine, "Encryption")
        Global $BSSIDCheck = StringInStr($WifiNetLine, "BSSID")
        Global $SignalCheck = StringInStr($WifiNetLine, "Signal")
        Global $ChannelCheck = StringInStr($WifiNetLine, "Channel")
        If $SSIDCheck <> 0 And $BSSIDCheck = 0 Then Call("_SSIDTrimmer")
        If $SSIDCheck <> 0 And $BSSIDCheck <> 0 Then Call("_BSSIDTrimmer")
        If $AuthenticationCheck <> 0 Then Call("_AuthenticationTrimmer")
        If $EncryptionCheck <> 0 Then Call("_EncryptionTrimmer")
        If $SignalCheck <> 0 Then Call("_SignalTrimmer")
        If $ChannelCheck <> 0 Then Call("_ChannelTrimmer")

    Until $WifiNetLine = "END"

    GUISetState(@SW_SHOW)

    _GUICtrlListView_RegisterSortCallBack($g_idListView)
    Local $count = 0

EndFunc   ;==>_BuildLV
Func _SortBy()
    ConsoleWrite( @ScriptLineNumber & " _SortBy" & @CRLF)
    $Column = GUICtrlGetState($g_idListView)
    _GUICtrlListView_SortItems($g_idListView, $Column)
EndFunc   ;==>_SortBy

Func _SSIDTrimmer()
    ;ConsoleWrite( @ScriptLineNumber & " Called _SSIDTrimmer()" & @CRLF)
    ;msgbox (0, "Func _SSIDTrimmer()", "We're Here Now")
    Local $Colon = StringInStr($WifiNetLine, ":")
    $SSID = StringTrimLeft($WifiNetLine, $Colon)
    ;Local $BSSID_WAP = 0
    ;msgbox (0, "$SSID ", $SSID)
EndFunc   ;==>_SSIDTrimmer

Func _BSSIDTrimmer()
    ;ConsoleWrite( @ScriptLineNumber & " Called _BSSIDTrimmer()" & @CRLF)
    ;msgbox (0, "Func _BSSIDTrimmer()", "We're Here Now")
    Local $Colon = StringInStr($WifiNetLine, ":")
    $BSSID = StringTrimLeft($WifiNetLine, $Colon)
    ;Local $BSSID_WAP = 1
    ;msgbox (0, "$BSSID ", $BSSID)
EndFunc   ;==>_BSSIDTrimmer

Func _AuthenticationTrimmer()
    ;msgbox (0, "_SignalTrimmer()", "We're Here Now")
    Local $Colon = StringInStr($WifiNetLine, ":")
    $Authentication = StringTrimLeft($WifiNetLine, $Colon)
    ;msgbox (0, "$Authentication ", $Authentication)
EndFunc   ;==>_AuthenticationTrimmer

Func _EncryptionTrimmer()
    ;msgbox (0, "_SignalTrimmer()", "We're Here Now")
    Local $Colon = StringInStr($WifiNetLine, ":")
    $Encryption = StringTrimLeft($WifiNetLine, $Colon)
    ;msgbox (0, "$Encryption ", $Encryption)
EndFunc   ;==>_EncryptionTrimmer

Func _SignalTrimmer()
    ;msgbox (0, "_SignalTrimmer()", "We're Here Now")
    Local $Colon = StringInStr($WifiNetLine, ":")
    $Signal = StringTrimLeft($WifiNetLine, $Colon)
    ;msgbox (0, "$Signal ", $Signal)
EndFunc   ;==>_SignalTrimmer

Func _ChannelTrimmer()
    ConsoleWrite(@ScriptLineNumber & " Called _ChannelTrimmer" & @CRLF)
    Local $Colon = StringInStr($WifiNetLine, ":")
    $Channel = StringTrimLeft($WifiNetLine, $Colon)
    $bChannel = Number($Channel)
    ;msgbox (0, "$bChannel ", $bChannel)

    _AddRow($g_idListView, $SSID & "|" & $BSSID & "|" & $bChannel & "|" & $Signal & "|" & $Authentication & "|" & $Encryption) ; Passing Data to AddRow
    ;$SSID = ""
    $BSSID = ""
    $Authentication = ""
    $Encryption = ""
    $Channel = ""
    $Signal = ""
EndFunc   ;==>_ChannelTrimmer

Func _AddRow($hWnd, $sItem, $iPlus = 0)
    ConsoleWrite(@ScriptLineNumber & " Called _AddRow" & @CRLF)
    Local $aItem = StringSplit($sItem, "|")
    Local $iIndex = _GUICtrlListView_AddItem($hWnd, $aItem[1], +$iPlus, _GUICtrlListView_GetItemCount($hWnd) + 9999)
    _GUICtrlListView_SetColumnWidth($hWnd, 0, $LVSCW_AUTOSIZE_USEHEADER)

    For $x = 2 To $aItem[0]
        _GUICtrlListView_AddSubItem($hWnd, $iIndex, $aItem[$x], $x - 1, $iPlus)
        _GUICtrlListView_SetColumnWidth($hWnd, $x - 1, $LVSCW_AUTOSIZE)
    Next
    ConsoleWrite(@ScriptLineNumber & " Return from _AddRow" & @CRLF)
EndFunc   ;==>_AddRow



Func _CleanUp()

    FileClose($SCCTempDir & "WifiNetsParsed.txt")
    FileClose($SCCTempDir & "WifiChannel.txt")

    Sleep(500)

    FileDelete($SCCTempDir & "WifiNetsParsed.txt")
    FileDelete($SCCTempDir & "WifiChannel.txt")

EndFunc   ;==>_CleanUp

test overwrite on tabs.au3

Share this post


Link to post
Share on other sites



MrPinkComputerShrink,

Create the labels $DS & $Stat when you create the tab - then just update them with GUICtrlSetData when you run the _Tab4 function. At the moment you are creating new labels each time which overlay the existing ones and cause the problem you are seeing. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

@M23,

Thank you Thank you and thank you.

Edited by MrPinkComputerShrink

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • kawliga751
      By kawliga751
      I am trying to script the opening of multiple tabs in IE with each tab having a separate login/password. I have been able to make a successful script that will open 3 separate IE sessions with the correct webpage and login or a script that will open 3 tabs in one session (which I want) but will not login. I have tried _IECreate, IEAttach etc. This is the script I am currently using . 
      #include <IE.au3> Const $navOpenInNewTab = 0x0800 Dim $oIE = _IECreate('http://asag.xxxxxxx.com/AAAA/index.htm') ;$o_IE.Navigate2('http://asag.xxxxxxx.com/apps/yyyyyyy/LogInSAG/login.asp', $navOpenInNewTab) ;$o_IE.Navigate2('http://asag.xxxxxxx.com/apps/yyyyyyy/LogInSAG/login.asp', $navOpenInNewTab) Call ("YYYYYYYSignIn") Func YYYYYYYSignIn () Local $username = _IEGetObjByName ($oIE,"uname") Local $password = _IEGetObjByName ($oIE,"pword") $oIE.Navigate2('http://asag.xxxxxxx.com/apps/xxxxxxx/LogInSAG/login.asp',2048) _IEFormElementSetValue ($username, "xxxxxxx") _IEFormElementSetValue ($password, "xxxxxxx") Send('{Enter}') EndFunc Call ("xxxxxxxSignIn") Func xxxxxxxSignIn () __IENavigate($oIE, "https://soa1gui.xxxxxxx.biz/gateway/NFServlet;jsessionid=1E3B8F6520DE0A1EC914A8ABB7E86341?NFH_MessageId=&NFH_Page=%2fpages%2fsearch%2fsearch.jsp", 1, 0x800) Local $domain = _IEGetObjByName ($oIE,"NF_CustomerID") Local $User_Name = _IEGetObjByName ($oIE,"NF_UserName") Local $Password = _IEGetObjByName ($oIE,"NF_Password") _IEFormElementSetValue ($domain, xxxxxxx") _IEFormElementSetValue ($User_Name, "xxxxxxx") _IEFormElementSetValue ($Password, "xxxxxxx") ;Send('{Enter}') EndFunc  
    • Skeletor
      By Skeletor
      Hi Guys,
      I've been reading this post ...
      When I came accross the examples, non of them had what I was looking for.
      I basically want to "snapshot" my GUI's multiple tabs and send them into the pdf.
      A little nudge from you guys would be great.
      Im really stuck with this one, therefore I have no code.
      Lets discuss or point me in a right direction... thanks alot
       

    • jvds
      By jvds
      I'm trying to display a Unicode character on a label but get an rectangle instead
      is it possible to successfully display all Unicode characters on GUI on labels buttons etc?
      the one i'm trying to display is ChrW(11034) which is ⬚
      $square = GUICtrlCreateLabel(ChrW(11034),10,20, 10, 15)  
    • fopetesl
      By fopetesl
      OK, still learning SOLVED! $WS_EX_COMPOSITED hides buttons?
      I've read, run examples but cannot show action buttons in tabs in a GUI.
      I've run the GUICtrlCreateTabItem function example and, of course, it works.
      Mine doesn't:
      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <MenuConstants.au3> #include <TabConstants.au3> #include <ColorConstants.au3> $hGUI = GUICreate("My GUI Tab", @DesktopWidth * 1, @DesktopHeight * 1, 0, 0,-1, $WS_EX_COMPOSITED) $hTab = GUICtrlCreateTab(10, 10, 640, 480,$TCS_HOTTRACK) ; Create tabitems ;For $i = 0 To 2 GUICtrlCreateTabItem(" Scan Sample ") ; $idButton1 = GUICtrlCreateButton("Button " & 0, 20 + (0 * 100), 40 + (0 * 50), 80, 30) ; $idButton1 = GUICtrlCreateButton("00", 20, 50, 80, 30) GUICtrlCreateLabel("label0", 30, 80, 50, 20) GUICtrlCreateButton("OK0", 20, 50, 50, 20) GUICtrlCreateInput("default", 80, 50, 70, 20) GUICtrlCreateTabItem(" Database ") GUICtrlCreateButton("Button " & 1, 20 + (1 * 100), 40 + (1 * 50), 80, 30) GUICtrlCreateTabItem(" Software ") GUICtrlCreateButton("Button " & 2, 20 + (2 * 100), 40 + (2 * 50), 80, 30) ;Next ; Close Tab definiton GUICtrlCreateTabItem("") ; Set the color of the label control. ; GUICtrlSetColor($idButton1, 0x002E7A) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd It just shows:
      whatever I try.  So I've missed, again?, that I do not have the focus?
       
    • Miliardsto
      By Miliardsto
      Hello I got problem with my form cause i got some buttons, labels, inputs and now i want organize this in tabs.
      There is a problem, when i put new tab this tab is on bottom and this is above my buttons or button is show on whole form , not only in one tab.
      How to deal with it