Jump to content

Recommended Posts

  • Moderators
Posted

JanZoudlik,

I have also created several buttons as well as list view and once I call _GUIListViewEx_EditItem all the buttons will stop responding

I have just been testing and when you click a control outside the ListView the edit is automatically cancelled and the button fires as normal - so I am at a loss as to quite what you are seeing. Can you please post a simple reproducer script where this does not happen.

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

 

  • Moderators
Posted

JanZoudlik,

Here is a short example script - when I click the buttons, the editing is cancelled and the buttons fire as normal:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

#include "GUIListViewEx.au3"

$hGUI = GUICreate("Test", 500, 500)

$cListView = GUICtrlCreateListView("Column 0|Column 1", 10, 10, 480, 300)
For $i = 9 To 19
    GUICtrlCreateListViewItem("Item " & $i & "-0|Sub " & $i & "-1", $cListView)
Next

Global $aLV_List = _GUIListViewEx_ReadToArray($cListView, 1)
$iLV_Index = _GUIListViewEx_Init($cListView, $aLV_List, 1, 0xFF0000, True, 2)

$cButton_1 = GUICtrlCreateButton("One", 10, 350, 80, 30)
$cButton_2 = GUICtrlCreateButton("Two", 10, 400, 80, 30)

GUISetState()

_GUIListViewEx_MsgRegister()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton_1
            MsgBox($MB_SYSTEMMODAL, "Actioned", "Buttton 1")
        Case $cButton_2
            MsgBox($MB_SYSTEMMODAL, "Actioned", "Buttton 2")
    EndSwitch



    _GUIListViewEx_EditOnClick()

WEnd

What are you doing differently?

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

 

Posted (edited)

Hi there,

didn't have chance to do full testing yet to find out what exactly is causing it...

Anyway all your included examples suffer from same issue > start editing and then hit close button > script will indeed close window however not straight away as it should. 

example number 1 > start editing using buttons and keep changing what you want to edit using buttons(just pressing buttons with mouse) > eventually it will start playing up...

I'll get back to you once I find out(ensure what) root cause and find work around or fix...

Regards

Jan

P.S.: just tested your script which you have posted and it also suffers same issue... further more you did not read my original post correctly as I mentioned issue with _GUIListViewEx_EditItem; you don't use it in posted script at all...

Edited by JanZoudlik
  • Moderators
Posted (edited)

JanZoudlik,

Quote

 I mentioned issue with _GUIListViewEx_EditItem; you don't use it in posted script at all...

You are correct - sorry about that. Which makes it all the more unfortunate that you did not provide a suitable reproducer to begin with.

Quote

start editing using buttons and keep changing what you want to edit using buttons(just pressing buttons with mouse)

So you are editing ListView items using buttons to inset the text? Or do you mean pressing other buttons to edit other elements? You see why a simple reproducer would help - I have no real idea what you might be doing here, which makes it impossible to debug. With a reproducer script and stated procedure to follow to induce the problem then I can do something - merely saying "eventually it will start playing up..." is no use at all.

Please do not take this the wrong way - I want the UDF to be reliable - but alas merely telling me of some random happening is not going to give me many clues. So over to you.

M23

Edit: Here is the example modified to use _GUIListViewEx_EditItem - I cannot make it fail by pressing the various buttons. I do see that the GUI does not close instantly when you click on the [X]. I imagine that the UDF does not recognise the click outside the client area - it might require yet another handler, which means I will have to decide whether it is worth the effort.

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

#include "GUIListViewEx.au3"

$hGUI = GUICreate("Test", 500, 500)

$cListView = GUICtrlCreateListView("Column 0|Column 1", 10, 10, 480, 300)
For $i = 9 To 19
    GUICtrlCreateListViewItem("Item " & $i & "-0|Sub " & $i & "-1", $cListView)
Next

Global $aLV_List = _GUIListViewEx_ReadToArray($cListView, 1)
$iLV_Index = _GUIListViewEx_Init($cListView, $aLV_List, 1, 0xFF0000, True, 2)

$cButton_1 = GUICtrlCreateButton("One", 10, 350, 80, 30)
$cButton_2 = GUICtrlCreateButton("Two", 10, 400, 80, 30)

GUISetState()

_GUIListViewEx_MsgRegister()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton_1
            ;MsgBox($MB_SYSTEMMODAL, "Actioned", "Buttton 1")
            _GUIListViewEx_EditItem($iLV_Index, 5, 0)
        Case $cButton_2
            ;MsgBox($MB_SYSTEMMODAL, "Actioned", "Buttton 2")
            _GUIListViewEx_EditItem($iLV_Index, 7, 1)
    EndSwitch



    _GUIListViewEx_EditOnClick()

WEnd

Edit 2: I was right - the UDF needs to intercept the $WM_SYSCOMMAND message sent by the [X]. Here is a modified Beta UDF which looks for such events and closes the edit immediately:

 

Edited by Melba23

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

 

Posted (edited)

Hi Melba,

sorry for late reply...

technically editing starts automatically waiting for customers input and GUI buttons which don't work are back, logout and exit which all of them are self explaining. 

I apologies that I did not provide original script. It would never work for you as it is connecting to three different MS SQL databases and strip it down would be very difficult.

Bottom line is that issue it suffered from was basically same issue(similar) as close button did. In my case as script is quite complicated , for some reason, it ignores button press completely. Likely because I am reading array out, changing values within list view etc...

I came up with very simple fix which works great for me. I created global variable $GLVEx_iMsg and added/modified line 2321(the beginning of edit loop within UDF within _GUIListViewEx_EditProcess) so it is as following:

    $GLVEx_iMsg=0
    While 1
           $GLVEx_iMsg=GUIGetMsg()
          if $GLVEx_iMsg<>0 then ExitLoop

then within my script I test for $GLVEx_iMsg as well as standard $iMsg which I fill in at the beginning of my loop($iMsg=GUIGetMsg()). This works perfectly for me apart of actual close button. For that I have used your fix as suggested within modified UDF. 

I um unsure if this will work with combo box or while moving up and down etc as I don't use it.  Might help others possibly facing similar issue within more complex scripts...

Yet again thanks for your great work and very quick response...

Regards

Jan

Edited by JanZoudlik
  • Moderators
Posted

JanZoudlik,

Glad you got it working.  I am still somewhat surprised that you need to add those lines as all my testing shows that clicking other than in the edit itself will immediately end the editing process, but if it works for you then I am delighted. I will now ponder whether it is worth adding the additional code for immediate [X] action to the release UDF.

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

 

Posted (edited)

Hi Melba,

I believe that it doesn't work for me as I am reading listview out using _GUIListViewEx_ReturnArray and changing several values using _GUIListViewEx_ChangeItem. During this I have noticed that listview refreshes. I can only assume that it is a root cause of the issue as it possibly somehow overwrites GUImsg. I haven't test it nor investigated further.

Current resolution works great for me and it is sufficient as all buttons are fully responsive as they should.

Once again I want to thank you for great work and awesome support!

PS: May I ask if your msgbox is waiting for enter/mouse key to be released prior to function return?

Regards

Jan

 

Edited by JanZoudlik
  • 1 month later...
Posted

Hi Melba,

thank you very much for share this project with others.

But it seems like I got 1 or 2 little bugs:'( I'm using about 30 instances of ListView at the same time, some with given array, some without (because they are filled after the GUI starts displaying). But all in all quite default sttings, i guess...

I noticed 2 effects:

1st: If I put an item by drag&drop from a ListView to another position of this ListView, it's sometimes (not always) copied instead of moved, so the resulting array has this Item multiple times

2nd: If I put an item or more by drag&drop drom a ListView to an other ListView, multiple times and again and again mixed up, then sometimes the old one is still shown, but if I give it a try and drag it again, it totally crashes, reporting the following error: "\include\GUIListViewEx.au3" (2056) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.
Also sometimes the error is on 2047, depending on if i dragged multiple items.

Anyone knows this bug? Maybe I did something wrong?

  • Moderators
Posted

Omega19,

Welcome to the AutoIt forums.

I'm using about 30 instances of ListView at the same time

I have never tried to use the UDF with so many ListViews at once, so I cannot really offer much help at the moment. Can you post the code you are using (see here how to do it) and some examples of the data you use to create the initially filled arrays - I will then see if I can reproduce the problem and hopefully fix it.

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

 

Posted

Hi Melba,

Thanks :)

I was about to shorten my code to get just the functionality of the ListViews, but when I was finished I was not able to reproduce one of the errors. Neither in the short code nor in the original untouched code. So I don't know how this bug came in, but it seems like it's gone... Maybe I still have to learn a lot about AutoIt...

I thank you very much for offering your help anyway :)

Right before I posted this in this forum, I updated the GUIListViewEx to the latest version, but still had the issue. Could it be that SciTE needs some time to notice that the include changed? Maybe the update solved the problem then....

 

Omega19

  • Moderators
Posted

Omega19,

This UDF is extremely complex so I am not at all surprised that there is the odd "hiccup" from time to time, particularly if there are lots of drag/drop operations. If you ever do manage to find a reproducible script to demonstrate the bug please let me know.

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

 

Posted (edited)

Okay the problem occured again, and I have an idea why. But first, I need to explain what I am doing in my script:

I display some pdf file names in ListViews, depending on which sub directory they are. These pdf files ore going to be moved out of the directory for further actions, and they are copied into this directories from the script itself (name of the pdf leads to the correct sub directory). The order of moving the files around is given, but not fixed: you can change them by drag and drop them to another list (or to the highway-list, which has priority zero). It's important that the ListViews represent the current state of the directories

I think the error occoures when there is any drag and drop action while an pdf is added or removed from any ListView, because I need to set them active for adding / deleting rows (=pdf names and relative path).

The solution for my script was simple: I just added the buttons "start" and "stop" which start and stop the background checks for the file lists. So whenever someone is about to change the order of moving the pdf he needs to hit stop first and to hit start afterwards.

I don't know if you'd like to change your UDF, because I'm not sure if what I do with it is what it was intended to do with it.

If you're willing to test this, I uploaded the script and some test data. But be warned, the script is still under construction, quite messy and most of the function/variable names are in german ;)

Best regards, Omega19

upload.zip

upload.zip

Edited by Omega19
wrong upload
  • Moderators
Posted

Omega19,

Quote

To test this, please copy it wherever you want and configure the CTP_Relax_Koniguration.ini with directories that exist.
Then copy all test_data into the directory you configured by QuellOrdner_Druckbogen_PDFs

I have no idea what all that means. Which of these CTP_Relax_Koniguration lines need changing - and to what?

;QuellOrdner_Druckbogen_PDFs = \\kim-server\PDF_Ausgabe\an_Belichter_senden
QuellOrdner_Druckbogen_PDFs = E:\an_Belichter_senden

;FehlerOrdner = \\kim-server\PDF_Ausgabe\an_Belichter_senden\Fehler
FehlerOrdner = E:\an_Belichter_senden\Fehler

;ErledigtOrdner = \\kim-server\PDF_Ausgabe\erledigt\an_Belichter_gesendet
ErledigtOrdner = E:\erledigt\an_Belichter_gesendet

;Hotfolder_fuer_Druckbogen_JPEGs = \\xserve\gbd\Powerswitch_IN\PDF_zu_Druckbogenvoransicht_JPEGs_IN
Hotfolder_fuer_Druckbogen_JPEGs = E:\PDF_zu_Druckbogenvoransicht_JPEGs_IN

Do I just create a suitable folder structure and place those folder names in the file?

Next, into which folder should I copy the test data - and what am I supposed to do with the QuellOrdner_Druckbogen file?

Sorry to sound dense, but for this to work I need to get the files into the correct places and at the moment I am struggling to understand quite how to do that.

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

 

Posted

M23,

these 5 paths are all directories. Just create them anywhere but the directory 

@ScriptDir & "\Temp"

The pdf are moved into the TempDir by the script, and they are sorted into various sub directories. Each sub directory has it's own ListView, and the ListView is displayed when there is at least one pdf in it (max 5 per "Drucker").

I'll explain what the directories in the configuration ini are good for:

QuellOrdner_Druckbogen_PDFs leads to the source directory where the script recieve the pdf data, so please copy all pdf files from "test_data" into the one you configered here

FehlerOrdner leads to the "failure" output directoy where pdf files are moved if they are not properly formatted

ErledigtOrdner leads to the "done" output directoy where every pdf is saved after the end of it's life time in the script

Hotfolder_fuer_Druckbogen_JPEGs leads to the output directory where a copy is saved after it's moved out of the source directory. This is somehow important for further actions

Hotfolder_Belichter leads to the output directory where the files are moved for other further actions, and the sub directories are close to the temp directory

I hope this answers your questions, if not, just send a message

Omega19

Posted (edited)

I guess what I need is a function where I can delete or insert data into given ListViewEx, not into the active one. I'm assuming that the command _GUIListViewEx_SetActive is not very good when an user is dragging or dropping something simultaneously.

And yes I am aware of _GUICtrlListView_AddItem, but I think this will destroy the management via ListViewEx

Edited by Omega19
  • Moderators
Posted

Omega19,

Looking at the code before running I can see why one of your problems might be occurring:

Quote

 If I put an item by drag&drop from a ListView to another position of this ListView, it's sometimes (not always) copied instead of moved, so the resulting array has this Item multiple times

I believe that happens because you are not setting the correct drag/drop codes into the $iAdded parameter when intiialising the ListViews. For example, take these lines:

$iLV_Fuji = _GUIListViewEx_Init($cLV_Fuji, $Array_Fuji, 0, 0, True) ; No external drag, will accept drop
$iLV_Heidelberg = _GUIListViewEx_Init($cLV_Heidelberg, $Array_Heidelberg, 0, 0, True) ; External drag & drop - items deleted on drag

Although you are state that the drag/drop behaviour of these 2 ListViews is different, you are not coding anything to make it so.  In the _GUIListViewEx_Init function header it states:

$iAdded  - 0     - No added features (default).  To get added features add the following
[...]
;                             + 64  - No external drag
;                             + 128 - No external drop
;                             + 256 - No delete on external drag/drop

So although the second of your initiation lines  is correct (default drag/drop with deletion of the dragged items), the first should read:

$iLV_Fuji = _GUIListViewEx_Init($cLV_Fuji, $Array_Fuji, 0, 0, True, 64) ; No external drag, will accept drop

to prevent dragging.

I am now off to try and run the script.

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

 

Posted

M23,

Quote

Although you are state that the drag/drop behaviour of these 2 ListViews is different, you are not coding anything to make it so.  In the _GUIListViewEx_Init function header it states:

I'm affraid this is an comment error, because all ListViews should allow to drag and the Items should be deleted on drag. In the future there should be drag rules, like ListViews should only accept drop from some ListViews, but for instance every ListView should accept every drag and drop. The comment is not up to date, sorry about that.

Omega19

  • Moderators
Posted

Omega19,

1 hour ago, Omega19 said:

I guess what I need is a function where I can delete or insert data into given ListViewEx, not into the active one. I'm assuming that the command _GUIListViewEx_SetActive is not very good when an user is dragging or dropping something simultaneously

If the user is carrying out drag/drop operations at the same time as the script is busy adding items to the ListViews then I am not at all surprised that you are having problems.  Adding/deleting/moving items within a ListView does indeed required you to set the active ListView - which works quite well:

#include <GUIConstantsEx.au3>

#include "GUIListViewEx.au3"

$hGUI = GUICreate("Test", 500, 500)

$cLV_1 = GUICtrlCreateListView("LH ListView", 10, 10, 230, 200)
$iIndex_1 = _GUIListViewEx_Init($cLV_1)

$cLV_2 = GUICtrlCreateListView("RH ListView", 260, 10, 230, 200)
$iIndex_2 = _GUIListViewEx_Init($cLV_2)

$cAdd_1 = GUICtrlCreateButton("Add To LH", 10, 250, 80, 30)

$cAdd_2 = GUICtrlCreateButton("Add To RH", 260, 250, 80, 30)

GUISetState()

_GUIListViewEx_MsgRegister()

$iCount_1 = 0
$iCount_2 = 0

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cAdd_1
            _GUIListViewEx_SetActive($iIndex_1)
            _GUIListViewEx_Insert("LH Item " & $iCount_1)
            $iCount_1 += 1
        Case $cAdd_2
            _GUIListViewEx_SetActive($iIndex_2)
            _GUIListViewEx_Insert("RH Item " & $iCount_2)
            $iCount_2 += 1
    EndSwitch

WEnd

Sequential adding and drag/drop operations seem to work just fine when I test that script.

Why do you need to have simultaneous operations? Why does the script need t move things at the same time as the user?

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

 

Posted

M23,

4 minutes ago, Melba23 said:

Why do you need to have simultaneous operations? Why does the script need t move things at the same time as the user?

Because most of the time the script should just do it's work. But sometimes something goes wrong with the machines and the workers need to improvise. In this case the order of the output of this script has to be changed in an easy way, that's how a coworker came up with the ListViews and drag & drop.

The only option I see for myself is to stop & start the background processes until the user put in all his changes. This way these actions are never at the same time. I posted my problem here just in case someone has a better solution, like automaticly stop the background processes while there is a drag/drop action.

Thanks for your time,

Omega19

  • Moderators
Posted

Omega19,

I quite understand the requirement, but I think it is a bit beyond this UDF to incorporate it.

You can quite easily detect a drag/drop operation - Just add a small wrapper function to the UDF (I have added it just after the include here) and watch the console when you drag:

#include <GUIConstantsEx.au3>

#include "GUIListViewEx.au3"
; Added function <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Func _GUIListViewEx_Drag()
    If $iGLVEx_Dragging Then
        Return True
    EndIf
    Return False
EndFunc

$hGUI = GUICreate("Test", 500, 500)

$cLV_1 = GUICtrlCreateListView("LH ListView", 10, 10, 230, 200)
$iIndex_1 = _GUIListViewEx_Init($cLV_1)

$cLV_2 = GUICtrlCreateListView("RH ListView", 260, 10, 230, 200)
$iIndex_2 = _GUIListViewEx_Init($cLV_2)

$cAdd_1 = GUICtrlCreateButton("Add To LH", 10, 250, 80, 30)

$cAdd_2 = GUICtrlCreateButton("Add To RH", 260, 250, 80, 30)

GUISetState()

_GUIListViewEx_MsgRegister()

$iCount_1 = 0
$iCount_2 = 0
$bDragging = False

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cAdd_1
            _GUIListViewEx_SetActive($iIndex_1)
            _GUIListViewEx_Insert("LH Item " & $iCount_1)
            $iCount_1 += 1
        Case $cAdd_2
            _GUIListViewEx_SetActive($iIndex_2)
            _GUIListViewEx_Insert("RH Item " & $iCount_2)
            $iCount_2 += 1
    EndSwitch

    If  _GUIListViewEx_Drag() And $bDragging = False Then
        ConsoleWrite("Dragging started" & @CRLF)
        $bDragging = True
    ElseIf Not( _GUIListViewEx_Drag()) And $bDragging = True Then
        ConsoleWrite("Dragging ended" & @CRLF)
        $bDragging = False
    EndIf

WEnd

However, I think your suggestion of using a "Stop/Restart" command when user intervention is required is the better solution - it removes all possibility of confusion.

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

 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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