Jump to content
Sign in to follow this  
SlimShady

Listbox, Guimsg

Recommended Posts

SlimShady

Why does a listbox not tell me when a user has clicked in it?

See following example script.

Opt ("GUINotifyMode", 1)
   $Width = (@DesktopWidth / 4) * 3
   $Height = (@DesktopHeight / 4) * 3
   GUICreate("File & Dir Compare", $Width, $Height, -1, -1, BitOR(0x00010000, 0x00020000))

   Global $List_width
   $List_width = $Width / 2 - 30
   GUISetControl("label", "...", 15, 80, $List_width, 15)
   GUISetControlEx(-1, 0, 512 + 32, "", 0x000000, 0xffffff)
   
   GUISetControl("label", "...", $List_width + 40, 80, $List_width, 15)
   GUISetControlEx(-1, 0, 512 + 32, "", 0x000000, 0xffffff)
   
   $list_left = GUISetControl("list", "ListLeft", 15, 100, $List_width, $Height - 160, BitOR(0x0080, 0x1000))
   GUISetControlData(-1, "List left - item 1|List left - item 2|List left - item 3")
   
   $list_right = GUISetControl("list", "ListRight", $List_width + 40, 100, $List_width, $Height - 160, BitOR(0x0080, 0x1000))
   GUISetControlData(-1, "List right - item 1|List right - item 2|List right - item 3")

   $OK_btn = GUISetControl("button", "OK", $Width / 2 - 80, $Height - 55, 70, 20)
   $Exit_Btn = GUISetControl("button", "Exit", $Width / 2 + 10, $Height - 55, 70, 20)

   GUIShow()
   
   While 1
      $msg = GUIMsg() 
      Select
         Case $msg = -3 OR $msg = $Exit_Btn
            GUIDelete()
            Exit
         Case $msg > 0
            MsgBox(0, "", "You clicked on control ref number: " & $msg)
      EndSelect
      Sleep(100)   
   WEnd
   MsgBox(0, "", "You clicked on control ref number: " & $msg)

Share this post


Link to post
Share on other sites
Jos

You will have to add LBS_NOTIFY (0x0001) value to the listbox ControlStyle.... (think this one in not documented..)

$list_left = GUISetControl("list", "ListLeft", 15, 100, $List_width, $Height - 160, BitOR(0x0001, 0x0080, 0x1000))

:ph34r:


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

Share this post


Link to post
Share on other sites
Josbe

You will have to add LBS_NOTIFY (0x0001) value to the listbox ControlStyle.... (think this one in not documented..)

$list_left = GUISetControl("list", "ListLeft", 15, 100, $List_width, $Height - 160, BitOR(0x0001, 0x0080, 0x1000))

:ph34r:

<{POST_SNAPBACK}>

Yeah, when you override the default styles for a control, you need add notify value(in some cases), like JdeB said.(although "notify mode" is activated)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.