Sign in to follow this  
Followers 0
Reekod

How to display a wait cursor during a loop for next... ?

3 posts in this topic

#1 ·  Posted (edited)

Hello all

i do some SQL request and i wish to :

- display a wait icon of hourglass

- disable mouse left click during the listview building.

i tried with GUICtrlSetCursor(-1, 15) without any sucess... :)

is someone can have already a solution ?

regards.

Example of a loop like i want to do my cursor changing.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("test loop", 633, 454, 192, 114)
$ListView1 = GUICtrlCreateListView("", 48, 48, 538, 382)
$Go = GUICtrlCreateButton("Go", 280, 8, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Go
go()
EndSwitch
WEnd
Func Go()
_GUICtrlListView_Destroy($ListView1)
$ListView1 = GUICtrlCreateListView("", 48, 48, 538, 382)
_GUICtrlListView_InsertColumn($ListView1, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($ListView1, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($ListView1, 2, "Column 3", 100)
$i = 1
For $dropcols = 1 To 32768


    If $i = 1 Then
        $iIndex = _GUICtrlListView_AddItem($ListView1, $dropcols)
    Else
        If $i > 3 Then
            $i = 0
        Else
sleep(10)
            _GUICtrlListView_AddSubItem($ListView1, $iIndex, $dropcols, $i - 1)
        EndIf
    EndIf
    $i = $i + 1
Next
EndFunc
Edited by Reekod

Share this post


Link to post
Share on other sites



Try this:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("test loop", 633, 454, 192, 114)
$ListView1 = GUICtrlCreateListView("", 48, 48, 538, 382)
$Go = GUICtrlCreateButton("Go", 280, 8, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Go
$old_cursor = MouseGetCursor()
GUISetCursor(15, 1, $Form1)
go()
GUISetCursor($old_cursor, 1, $Form1)
EndSwitch
WEnd
Func Go()
_GUICtrlListView_Destroy($ListView1)
$ListView1 = GUICtrlCreateListView("", 48, 48, 538, 382)
_GUICtrlListView_InsertColumn($ListView1, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($ListView1, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($ListView1, 2, "Column 3", 100)
$i = 1
For $dropcols = 1 To 32768


    If $i = 1 Then
        $iIndex = _GUICtrlListView_AddItem($ListView1, $dropcols)
    Else
        If $i > 3 Then
            $i = 0
        Else
sleep(10)
            _GUICtrlListView_AddSubItem($ListView1, $iIndex, $dropcols, $i - 1)
        EndIf
    EndIf
    $i = $i + 1
Next
EndFunc

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Thx a lot !

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