Jump to content

EDIT Box slow to import


Recommended Posts

Greetings, I was wondering if anyone had any thoughts on this issue... I am working on a GUI that will perform various AD changes.. I stripped down the program big time to test this edit box issue I am having. 

PROBLEM:

When importing a large list from any data source, as the data is filling in an edit box, the edit box scrolls the vertical bar for each item. As the list grows larger, the import slows down ALOT because of the scrolling. Here is a working example of the butchered GUI:

( THIS IS ALSO ATTACHED )

#include <APIConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <file.au3>
#include <StaticConstants.au3>
#include <GUIListViewEx.au3>

global $a = 1, $b = 1, $i = 1


HotKeySet("{ESC}", "Terminate")

Func Terminate()
ProcessClose ( "autoit3.exe" )
    Exit 0
EndFunc   ;==>Terminate


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 827, 585, -1, -1)
$sourcebox = _GUICtrlListView_Create($Form1, "User name", 8, 32, 321, 545, BitOR($LVS_DEFAULT, $WS_BORDER, $LVS_EDITLABELS))
_GUICtrlListView_SetColumnWidth($sourcebox, 0, 200)
$importlistdata = _GUIListViewEx_Init($sourcebox, "", 0, 0x00FF00)
;GUICtrlSetLimit(-1, 9900000)
$sucbo = GUICtrlCreateEdit("", 560, 272, 249, 201)
$failbox = GUICtrlCreateEdit("", 560, 32, 249, 201)
;$Combo1 = GUICtrlCreateCombo("Combo1", 352, 80, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
;$L_option1 = GUICtrlCreateLabel("Option 1", 352, 56, 44, 17)
;$Combo2 = GUICtrlCreateCombo("Combo1", 352, 136, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
;$L_option2 = GUICtrlCreateLabel("Option 1", 352, 112, 44, 17)
;$Combo3 = GUICtrlCreateCombo("Combo1", 352, 192, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
;$L_option3 = GUICtrlCreateLabel("Option 1", 352, 168, 44, 17)
;$Combo4 = GUICtrlCreateCombo("Combo1", 352, 248, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
;$L_option4 = GUICtrlCreateLabel("Option 1", 352, 224, 44, 17)
$oldhome = GUICtrlCreateInput("", 352, 312, 121, 21)
$L_option5 = GUICtrlCreateLabel("Old Home", 352, 288, 100, 17)
$newhome = GUICtrlCreateInput("Input1", 352, 368, 121, 21)
$L_option7 = GUICtrlCreateLabel("New Home", 352, 344, 100, 17)
$B_Verify = GUICtrlCreateButton("Verify", 640, 520, 75, 57)
$B_start = GUICtrlCreateButton("S T A R T", 728, 520, 75, 57)
$Label_lable = GUICtrlCreateLabel("Paste list here", 8, 8, 70, 17)
$Label_Success = GUICtrlCreateLabel("Success", 560, 248, 45, 17)
$Label_Failed = GUICtrlCreateLabel("Failed", 560, 8, 32, 17)
$Group1 = GUICtrlCreateGroup("Options", 344, 32, 185, 377)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Status", 344, 424, 185, 145)
$stat1 = GUICtrlCreateLabel("READY", 352, 440, 166, 56, $SS_CENTER)
GUICtrlSetFont(-1, 32, 400, 0, "Arial Narrow")
$stat2 = GUICtrlCreateLabel($a & "/" & $b, 352, 504, 166, 56, $SS_CENTER)
GUICtrlSetFont(-1, 32, 400, 0, "Arial Narrow")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$import = GUICtrlCreateButton("import", 552, 520, 75, 57)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
global $MuhVal
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $import
            import()

    EndSwitch
WEnd


Func import()
local $zInput
    Local $var = FileOpenDialog("Select only one file.", @ScriptDir & "\", "Files (*.txt)", 1)
    If @error Then
        Return
    Else
        _FileReadToArray($var, $zInput)
        For $i = 1 To UBound($zInput) - 1
            _GUIListViewEx_Insert($zInput[$i])
            GUICtrlSetData($stat2, 1 & "/" & $i)
        Next
    EndIf
EndFunc   ;==>import

The only button I have set up is Import. I have Esc set up as a hot key to kill the app if you need it.

I am also including a demo file with 3200 lines..

Use the program to import the file, and you will see it slow down badly when it goes over 100 lines.

Does anyone have any tips or tricks how to get past this?

myfile.txt

list processor.au3

 

C0d3 is P0etry( ͡° ͜ʖ ͡°)

Link to post
Share on other sites
  • Moderators

Kovacic,

Why are you reading the file into an array and then adding it to the edit line by line? Why not just read the file into a single variable with FileRead and then put it into the edit in one go? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to post
Share on other sites

Kovacic,

Why are you reading the file into an array and then adding it to the edit line by line? Why not just read the file into a single variable with FileRead and then put it into the edit in one go? :huh:

M23

 

One thing I will be doing is importing usernames from AD into the list based on attribute which I will pull using the AD.au3 UDF, which is pretty fast, but then I want to add those values to that edit box... Is there a simpler way?

C0d3 is P0etry( ͡° ͜ʖ ͡°)

Link to post
Share on other sites
  • Moderators

Kovacic,

In the code you posted, the data is read from a file - placing the file content into the edit in one single command will be considerably faster. I do not use the AD UDF - are you now saying that you are not reading from a file in the full script but only obtaining the information line by line and adding it as it is gathered? :huh:

If so, then I strongly suggest you add it to a variable rather than add it to the edit so that you end up with one single large variable to add to the edit control. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to post
Share on other sites
  • Moderators

Kovacic,

Fine - the logic is the same and I have suggested how you might do it in both cases. Have you tried using a single data insertion yet? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to post
Share on other sites

I have been looking around on how to do this with no luck  :

I was hoping it would be as simple as using GUCtrlsetdata to send the data directly to the box but it didnt work..

_FileReadToArray($var, $zInput)
GUCtrlSetData($sourcebox, $zInput)

Im sure this is ridiculously easy, im just not getting it...  :ermm:

C0d3 is P0etry( ͡° ͜ʖ ͡°)

Link to post
Share on other sites
  • Moderators

Kovacic,

Do you actually read the replies I post? :huh:

 

Why are you reading the file into an array and then adding it to the edit line by line? Why not just read the file into a single variable with FileRead and then put it into the edit in one go?

Something like this should work: ;)

Func import()
    Local $var = FileOpenDialog("Select only one file.", @ScriptDir & "\", "Files (*.txt)", 1)
    If @error Then
        Return
    Else
        GUICtrlSetData($stat2, FileRead($var))
    EndIf
EndFunc   ;==>import
M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to post
Share on other sites

Kovacic,

Do you actually read the replies I post? :huh:

 

Something like this should work: ;)

Func import()
    Local $var = FileOpenDialog("Select only one file.", @ScriptDir & "\", "Files (*.txt)", 1)
    If @error Then
        Return
    Else
        GUICtrlSetData($stat2, FileRead($var))
    EndIf
EndFunc   ;==>import
M23

 

 

That doesn't seem to be working, and I wonder if its because I am using functions from GUIListViewEx.au3 instead of a normal edit box...

C0d3 is P0etry( ͡° ͜ʖ ͡°)

Link to post
Share on other sites
  • Moderators

Kovacic,

You started off this thread by saying you were entering text into an EDIT control - why are we now talking about my GUIListViewEx UDF and entering data into a ListView? How on earth do you expect to get any sensible help if you cannot even explain what it is you are trying to do? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to post
Share on other sites

The GUIListViewEx was in there from the beginning but no worries. Im going to rewrite it using the edit box instead. I called it an edit box because I figured it was an edit box housing a list view. 

I wanted to keep the GUIListViewEx aspect but I might give up and just use a plane ole edit box because its easier to handle. I liked how I had better control of the list, but its not a huge deal.. I'm just going to rewrite it and try it. 

Thank you for the input!  :thumbsup: 

C0d3 is P0etry( ͡° ͜ʖ ͡°)

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Mo0C0w
      Hey guys!
      I just started working with the GUI yesterday and it has only brought more fun to the Autoit adventure  
      Basically I have a GUI windows that opens and based on the selection of the combo box the button will do something different. This specific scenario I am talking about the Client Update Verification  combo selection. When selected and the button is pressed my second gui window opens. As of now if I only paste comp1 or comp2 by itself it works correctly, but if I paste both, it has a fit.
      What would the correct way to do this be? Any help or examples, would be greatly appreciated! Thank you in advance
       
      #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Client_List.au3> #Region ### START Koda GUI section ### Form=c:\users\dnoble\pictures\plexiibox v4.kxf Global $Form1_1 = GUICreate("Plexii", 336, 419, 1548, 586) GUISetBkColor(0xFFFFFF) Global $Pic1 = GUICtrlCreatePic("C:\Users\dnoble\Pictures\plexii.jpg", 41, 0, 252, 268, BitOR($GUI_SS_DEFAULT_PIC,$SS_CENTERIMAGE)) Global $Label2 = GUICtrlCreateLabel("Select Test", 125, 280, 95, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") Global $Combo2 = GUICtrlCreateCombo("Select Test", 39, 312, 257, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Client Update Verification|Bids") GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Proceed", 111, 352, 129, 33) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If GUICtrlRead($Combo2) = "Client Update Verification" Then _Form2() ;clientupdateverification() EndSwitch WEnd Func _Form2() #Region ### START Koda GUI section ### Form=c:\users\dnoble\pictures\plexiiboxclientupdate verification.kxf $Form1_1 = GUICreate("Plexii", 336, 521, 866, 454) GUISetBkColor(0xFFFFFF) $Edit1 = GUICtrlCreateEdit("", 57, 72, 241, 345) GUICtrlSetData(-1, "Edit1") $Button1 = GUICtrlCreateButton("Execute", 95, 440, 145, 41) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If GUICtrlRead($Edit1) = "comp1" Then comp1() If GUICtrlRead($Edit1) = "comp2" Then comp2() EndSwitch WEnd EndFunc  

    • By mike1950r
      Hi,
      I have a problem with the scrollbar in edit control.
      In my case I use richedit, but it appears also in the "normal" editcontrol.
      The problem ONLY appears, when working with my program (including editcontrol) and another program like notpad on the other screen.
      It appears when using the scrollbar of notepad, then my scroll bar and so on ... (vertical scrollbars only)
      and then suddenly the area behind my scrollbar gets highlighted (black) like selected, above and below,
      if i move the mouse to the left during pressing, the whole area behind the scrollbar gets highlighted in black.
      When my program is loaded alone the problem NEVER happens.
      I have made two screenshots, 1st one when the problem appears, and the second one showing when moving to the left.
      I really have no idea and there is nothing special in my editcontrol.
      I would be really thankful, if someone could help me further to get this issue solved.
      thanks in advance
      cheers mike


       
    • By rudi
      Hello,
      very propably this has been asked before, well, I miss the thread(s) ...
      Is there a command line switch to tell the SciTE setup EXE to install silently ("/S") *AND* to end up with "edit" (instead of "run") as system wide default action for *.au3 files?
       

       
      As it can be done with the config tool:
      https://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/SciTEConfigb1.PNG
       
      Regards, Rudi.
    • By nacerbaaziz
      Hi dears
      How are you?
      I have a question, to you please.
      How do I create an edit box for numbers only and does not accept letters? using autoit
      greetings to all
      I hope you help ME
      Thanks to all in advance
    • By Simpel
      Hi,
      I'm trying to create a console reader. All is working but I have a problem with the look. I want the line numbers with another backgroundcolor in silver. I made this with a small silver label. The edit control over the label has a transparent background.
      But if I start the prog then i can see how the line numbers wipe the silver background off. And if I click into the Edit then the silver label disappears completely.
      #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <StaticConstants.au3> #include <GuiEdit.au3> Opt("GUIOnEventMode", 1) Global $g_iZaehler = 0 Global $g_hGUI = GUICreate("Console: StdoutRead" , 800, 800, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPCHILDREN, $WS_EX_ACCEPTFILES) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Global $text = GUICtrlCreateEdit("",10,30,780,760, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY + $ES_NOHIDESEL) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $g_LaZeilen = GUICtrlCreateLabel("Zeilen: " & StringFormat("% 5d", $g_iZaehler), 680, 10, 100, 9, $SS_LEFTNOWORDWRAP) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKSIZE) Global $g_hCbFreeze = GUICtrlCreateCheckbox("&Freeze", 13, 5, 90) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlCreateLabel("", 11, 31, 42, 758) ; soll die Ziffern andersfarbig hinterlegen GUICtrlSetBkColor(-1, $COLOR_SILVER) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUISetState(@SW_SHOW) Global $sText = StringFormat("% 5d", $g_iZaehler) & @CRLF _GUICtrlEdit_AppendText($text, $sText) While 1 Sleep(200) $g_iZaehler += 1 $sText = StringFormat("% 5d", $g_iZaehler) & @CRLF _GUICtrlEdit_AppendText($text, $sText) WEnd Func _Exit() Exit EndFunc Do you have any suggestions.
      Regards, Conrad
×
×
  • Create New...