Jump to content

Is the TreeView still loading...


 Share

Recommended Posts

How can I see if a TreeView is still loading data?

I was looking at ControlCommand to see if there was command like "IsLoading" or something like that. Only thing i can see was "IsEnabled" and "IsVisible". They both return 1.

Stupid of me to even check of course it enabled and visible... IT'S LOADING!.

#include <File.au3>

Dim $s
Dim $i

Do
  ; check enabled
   $s = ControlCommand ( "MyRules", "text", "TTreeView1", "IsEnabled", "" )
   _FileWriteLog ( "C:\Temp\test_treeview.txt", "IsEnabled = " & $s )
   if $s <> 1 then MsgBox( 1, "TreeView Check", "TreeView is not enabled" )
   
  ; check visible
   $s = ControlCommand ( "MyRules", "text", "TTreeView1", "IsVisible", "" )
   _FileWriteLog ( "C:\Temp\test_treeview.txt", "IsVisible = " & $s )
   if $s <> 1 then MsgBox( 1, "TreeView Check", "TreeView is not Visible")
   
   Sleep( 2000 )
   
Until $i = 1

Any Ideas?

Link to comment
Share on other sites

Theres no way to know this. A tree view isn't in a state of "loading". Each item is added one at a time. Internally, this would be done in a loop. Only the internal code of the application knows how many items need loaded. That internal data isn't available to the outside (Hence it being called internal, obviously).

Link to comment
Share on other sites

If the number of entries in the list does not change for a specified time, often one can assume the loading may be finished.

But i could not find a way to know the number of entries in the list with the AutoIT version 102 i currently have to use. At least with help of DLLCall from the current AutoIT Beta it should be possible to get that information.

Link to comment
Share on other sites

Isn't it possible this way?

$hwnd = ControlGethandle("TheWindow","","ListBox1")
Global $LB_GETCOUNT  =  0x018B
$lbcount =  dllcall("user32.dll","int","SendMessage","hWnd",$hwnd,"int",$LB_GETCOUNT,"int", 0,"int", 0)

<{POST_SNAPBACK}>

Since this is a tree view I would need to use TVM_GETCOUNT. Found the api on MSDN but not the value of TVM_GETCOUNT.
Link to comment
Share on other sites

Sure, if the control you're talking about is a ListBox, but not when we're talking about a TreeView.

<{POST_SNAPBACK}>

:idiot: I mixed that up with something else i was looking for. here is the value from MS-SDK-header file:

#define TV_FIRST                0x1100      // TreeView messages
#define TVM_GETCOUNT            (TV_FIRST + 5)

So this should do it:

$TVM_GETCOUNT  = 0x1105
Link to comment
Share on other sites

Gettin' no luv from this either. :idiot:

I keep getting <null> from the dllcall.

2004-12-17 08:25:02 : $TVM_GETCOUNT_dllcall =

2004-12-17 08:25:04 : $TVM_GETCOUNT_dllcall =

#include <File.au3>

Dim $s
Dim $i
Dim $hwnd
Dim $tvmcount
;Dim $TVM_GETCOUNT  = 0x1100 + 5
Dim $TVM_GETCOUNT  = 0x1105

WinWaitActive ( "Ad Rate Rules" )
Do
 ;wait until i really have the handle
  $hwnd = ControlGetHandle("Ad Rate Rules","","TTreeView1")
Until $hwnd <> ""

MsgBox(1,"",$hwnd)

Do
  $tvmcount =  DllCall("user32.dll","int","SendMessage","hWnd",$hwnd,"int",$TVM_GETCOUNT,"int", 0,"int", 0)
  _FileWriteLog ( "C:\Temp\test_treeview.txt", "$TVM_GETCOUNT_dllcall = " & $tvmcount )

  Sleep( 2000 )
 
Until $i = 1

Could it be that Valik and this-is-me are right?!?! Next thing your going to tell me the Easter bunny isn't real either.

Link to comment
Share on other sites

I can not see why it should not work, if Santa Claus has almost reached the chimney.

Link to TVM_GETCOUNT Search Microsoft with Google

The AutoIt Help for the current Beta describes the return values:

If the function call fails then @error is set to 1. Otherwise an array is returned that contains the function return value and a copy of all the parameters (including parameters that the function may have modified).

$return[0]= function return value

$return[1] = param1

$return[2] = param2

...

$return[n] = paramn

Link to comment
Share on other sites

It worked! Guess I need to RTFM :">

_FileWriteLog ( "C:\tv.txt", "$TVM_GETCOUNT_dllcall_[0] = " & $tvmcount[0] )

2004-12-17 15:01:27 : $TVM_GETCOUNT_dllcall_[0] = 405

2004-12-17 15:02:18 : $TVM_GETCOUNT_dllcall_[0] = 721

Thanks everybody!

Easter Bunny and Santa are real, right? :idiot:

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