Sign in to follow this  
Followers 0
awrog

GUICtrlCreateList and $LBS_USETABSTOPS

10 posts in this topic

Hi,

I'm using the latest 'unstable' version.

In the following example the instruction Do something is being executed when I select the List

$MyList  = GUICtrlCreateList ("Entry", 25,140,550,265)

While $msg <> $GUI_EVENT_CLOSE
    $msg = GuiGetMsg()
    Select
        Case $msg = $Close
            Exit
        Case $msg = $MyList
            Do something
    EndSelect
Wend

When I add $LBS_USETABSTOPS to the GUICtrlCreateList the instruction Do something is not being executed!

$MyList  = GUICtrlCreateList ("Entry", 25,140,550,265, $LBS_USETABSTOPS )

While $msg <> $GUI_EVENT_CLOSE
    $msg = GuiGetMsg()
    Select
        Case $msg = $Close
            Exit
        Case $msg = $MyList
            Do something
    EndSelect
Wend

Can somebody explain this?

Kind regards.

Share this post


Link to post
Share on other sites



A working example of au3-code below to demonstrate that the use of LBS_USETABSTOPS is changing how this script reacts!

I hope someone can help.

#include <GUIConstants.au3>

GUICreate("URL's", 800, 470, -1, -1)
GUISetFont  (10, 400, 0, "Arial")

;$MyList = GUICtrlCreateList ("", 25, 50, 750, 265)
$MyList = GUICtrlCreateList ("", 25, 50, 750, 265, $LBS_USETABSTOPS )
GUICtrlSetData($MyList, "Site1" & @TAB & "http://www.hiddensoft.com" )
GUICtrlSetData($MyList, "Site2" & @TAB & "http://www.hiddensoft.com/forum" )
GUICtrlSetData($MyList, "Site3" & @TAB & "http://www.free-sheetmusic.org" )

$OpenURL    = GUICtrlCreateButton ("Open", 25, 395, 100, 30, $BS_DEFPUSHBUTTON)
GUICtrlSetState ($OpenURL,$GUI_DISABLE)

$Close      = GUICtrlCreateButton ("Close", 675,395,100,30)

GuiSetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GuiGetMsg()
    Select
        Case $msg = $Close
            Exit
        Case $msg = $MyList
             GUICtrlSetState($OpenURL,$GUI_ENABLE)
             GUICtrlSetFont($OpenURL, 9 ,800)
        Case $msg = $OpenURL
            IF GuiRead($MyList) <> "" Then
               $SelectedURL = StringMid(GuiRead($MyList), StringInStr(GuiRead($MyList), "HTTP") -1, 250 )
               Run(@COMSPEC & " /c Start " & $SelectedURL, "", @SW_HIDE)
            ELSE
               msgbox(0,"No URL selected","No URL selected!")
            ENDIF
    EndSelect
Wend

Share this post


Link to post
Share on other sites

Dont know why a select doesn't trigger a msg anymore but here's a work around that doesn't depend on that: :idiot:

#include <GUIConstants.au3>

GUICreate("URL's", 800, 470, -1, -1)
GUISetFont(10, 400, 0, "Arial")

;$MyList = GUICtrlCreateList ("", 25, 50, 750, 265)

$MyList = GUICtrlCreateList("", 25, 50, 750, 265, $LBS_USETABSTOPS)
GUICtrlSetData($MyList, "Site1" & @TAB & "http://www.hiddensoft.com")
GUICtrlSetData($MyList, "Site2" & @TAB & "http://www.hiddensoft.com/forum")
GUICtrlSetData($MyList, "Site3" & @TAB & "http://www.free-sheetmusic.org")

$OpenURL = GUICtrlCreateButton("Open", 25, 395, 100, 30, $BS_DEFPUSHBUTTON)
GUICtrlSetState($OpenURL, $GUI_DISABLE)

$Close = GUICtrlCreateButton("Close", 675, 395, 100, 30)

GUISetState()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
   $msg = GUIGetMsg()
   If GUICtrlGetState($OpenURL) <> $GUI_ENABLE And GUIRead($MyList) <> "" Then
      GUICtrlSetState($OpenURL, $GUI_ENABLE)
      GUICtrlSetFont($OpenURL, 9, 800)
   EndIf
   Select
      Case $msg = $Close
         Exit
      Case $msg = $MyList
         GUICtrlSetState($OpenURL, $GUI_ENABLE)
         GUICtrlSetFont($OpenURL, 9, 800)
      Case $msg = $OpenURL
         If GUIRead($MyList) <> "" Then
            $SelectedURL = StringMid(GUIRead($MyList), StringInStr(GUIRead($MyList), "HTTP") - 1, 250)
            Run(@ComSpec & " /c Start " & $SelectedURL, "", @SW_HIDE)
         Else
            MsgBox(0, "No URL selected", "No URL selected!")
         EndIf
   EndSelect
Wend

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

You apparently need to add the LBS_NOTIFY sytle back in:

#include <GuiConstants.au3>

Global $LBS_NOTIFY = 0x1
$style = BitOr($LBS_USETABSTOPS, $LBS_NOTIFY)

GuiCreate("Example")
$MyList  = GUICtrlCreateList ("Click_Me", 10,10,100,100, $style )
GuiSetState()

While 1
   $msg = GuiGetMsg()
   Select
       Case $msg = $GUI_EVENT_CLOSE
           Exit
       Case $msg = $MyList
           MsgBox(4096,"do","something")
   EndSelect
Wend

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Dont know why a select doesn't trigger a msg anymore but here's a work around that doesn't depend on that:    :idiot:

#include <GUIConstants.au3>

GUICreate("URL's", 800, 470, -1, -1)
GUISetFont(10, 400, 0, "Arial")

;$MyList = GUICtrlCreateList ("", 25, 50, 750, 265)

$MyList = GUICtrlCreateList("", 25, 50, 750, 265, $LBS_USETABSTOPS)
GUICtrlSetData($MyList, "Site1" & @TAB & "http://www.hiddensoft.com")
GUICtrlSetData($MyList, "Site2" & @TAB & "http://www.hiddensoft.com/forum")
GUICtrlSetData($MyList, "Site3" & @TAB & "http://www.free-sheetmusic.org")

$OpenURL = GUICtrlCreateButton("Open", 25, 395, 100, 30, $BS_DEFPUSHBUTTON)
GUICtrlSetState($OpenURL, $GUI_DISABLE)

$Close = GUICtrlCreateButton("Close", 675, 395, 100, 30)

GUISetState()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
   $msg = GUIGetMsg()
   If GUICtrlGetState($OpenURL) <> $GUI_ENABLE And GUIRead($MyList) <> "" Then
      GUICtrlSetState($OpenURL, $GUI_ENABLE)
      GUICtrlSetFont($OpenURL, 9, 800)
   EndIf
   Select
      Case $msg = $Close
         Exit
      Case $msg = $MyList
         GUICtrlSetState($OpenURL, $GUI_ENABLE)
         GUICtrlSetFont($OpenURL, 9, 800)
      Case $msg = $OpenURL
         If GUIRead($MyList) <> "" Then
            $SelectedURL = StringMid(GUIRead($MyList), StringInStr(GUIRead($MyList), "HTTP") - 1, 250)
            Run(@ComSpec & " /c Start " & $SelectedURL, "", @SW_HIDE)
         Else
            MsgBox(0, "No URL selected", "No URL selected!")
         EndIf
   EndSelect
Wend

<{POST_SNAPBACK}>

Hello JdeB :D I have test your code but wen i start the au3 he gif me this error pick is my gui.au3 to old for using your code exampel=? look pls for my error pick !But wen i rename it to this comand than wörks but he have bug not closed for me!Wat i make wrong?

Posted Image

i have this adde in your code an wörks but not stop the open button from the links 1-3((

Thx for help me :lol:

$msg = 0

While $msg <> $GUI_CLOSE

Edited by DirtyBanditos

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

@DirtyBanditos

Do you have the latest Autoit 1.0.103 beta installed?

Edit: Ensure also, you have #include <GUIConstants.au3> in your script.

Edited by MHz

Share this post


Link to post
Share on other sites

is my gui.au3 to old for using your code exampel=?

<{POST_SNAPBACK}>

Your GUIConstants.au3 is old... download the latest from the Unstable directory and try again.

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Your GUIConstants.au3 is old...  download the latest from the Unstable directory and try again.

<{POST_SNAPBACK}>

Hello have you a link to the Unstable directory download Area sry i have search on his forum not found pls tell me the link thx you :D

I have my gui.au3 from his site is this right=? :idiot:

http://www.autoitscript.com/autoit3/files/unstable/autoit/

Ok thx it wörks nice thx for help me out :lol:

Edited by DirtyBanditos

Share this post


Link to post
Share on other sites

I have my gui.au3 from his site is this right=? :idiot:

http://www.autoitscript.com/autoit3/files/unstable/autoit/

<{POST_SNAPBACK}>

The filename is GUIConstants.AU3... site is correct.

This file does contain :

; Events and messages
Global $GUI_EVENT_CLOSE         = -3

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

The filename is GUIConstants.AU3... site is correct.

This file does contain :

; Events and messages
Global $GUI_EVENT_CLOSE            = -3

<{POST_SNAPBACK}>

:D Thx Jdeb it wörks nice thx for fast help :idiot:

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