Jump to content

$LBS_SORT acts strange


Helge
 Share

Recommended Posts

This is just something I found out while testing something the other day.

There might be something logical about it, anyway check this out :

$LBS_SORT = 0x0002
$GUI_EVENT_CLOSE = -3

GUICreate("Strange",200,200)
$list = GUICtrlCreateList("",10,10,180,150,- $LBS_SORT)
$btn  = GUICtrlCreateButton("Button",10,170,180,20)
GUISetState()

AdlibEnable("_close",10)

While 1   
    GUICtrlSetData($list,"line 1|line 2|line 3|line 4")
    Sleep(1000)
    
    If GUICtrlRead($btn) = "line 1|line 2|line 3|line 4" Then
       GUICtrlSetData($btn,"Fuck off !")
       Sleep(1000)
    EndIf
Wend

Func _close()
   $msg = GUIGetMsg()
   If $msg = -3 Then Exit
EndFunc

Note the use of "- $LBS_SORT"...

Edited by Helge
Link to comment
Share on other sites

Maybe a couple of more lines may help? :idiot:

$LBS_SORT = 0x0002
$GUI_EVENT_CLOSE = -3

GUICreate("Strange",200,200)
$list = GUICtrlCreateList("",10,10,180,150,- $LBS_SORT)
$btn  = GUICtrlCreateButton("Button",10,170,180,20)
GUISetState()

AdlibEnable("_close",10)

While 1   
   GUICtrlSetData($list,"line 1|line 2|line 3|line 4")
   Sleep(1000)
   
   If GUICtrlRead($btn) = "line 1|line 2|line 3|line 4" Then
      GUICtrlSetData($btn,"Fuck off !")
      Sleep(1000)
      GUICtrlSetData($btn,"Should I say that ?")
      Sleep(1000)
   EndIf
Wend

Func _close()
  $msg = GUIGetMsg()
  If $msg = -3 Then Exit
EndFunc
Link to comment
Share on other sites

  • Developers

Nah, strange enough that didn't work. Hmm.. :idiot:

<{POST_SNAPBACK}>

It is not that strange. "- $LBS_SORT" is invalid and the Handle returned by GUICtrlCreateList() = -1.

Then GUICtrlSetData($List...) refers to the Last control (-1) , which is the Button, it updates the Button text.

Maybe this needs to be checked or the Helpfile updated, since that states that the returned handle will be 0 on error.

demo:

$LBS_SORT = 0x0002
$GUI_EVENT_CLOSE = -3

GUICreate("Strange",200,200)
$list = GUICtrlCreateList("",10,10,180,150,- $LBS_SORT)
If $list = -1 then msgbox(0,'','you coded the command wrong !!')
$btn  = GUICtrlCreateButton("Button",10,170,180,20)
GUISetState()

AdlibEnable("_close",10)

While 1   
   GUICtrlSetData($list,"line 1|line 2|line 3|line 4")
   Sleep(1000)
   
   If GUICtrlRead($btn) = "line 1|line 2|line 3|line 4" Then
      GUICtrlSetData($btn,"Fuck off !")
      Sleep(1000)
   EndIf
Wend

Func _close()
  $msg = GUIGetMsg()
  If $msg = -3 Then Exit
EndFunc

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

And JdeB, do you really think that I was serious when I thought that

the additions that MHz did could fix it ?  :idiot:

<{POST_SNAPBACK}>

Nope, just explaining the reason why it goes wrong and to point out the fact that the function is returning a -1 ...which is not what the helpfile says. so either the Function is returning the wong value or the Helpfile needs updating... :D

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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