Jump to content

ListBox - need help


Tukata
 Share

Recommended Posts

Hi,

I have three things I don't know how to do in this script:

1. I don't want items to be sorted but to appear in the order I wrote them.

2. I don't want any item to be selected on start.

3. I want to send the item full text to the clipboard "on-select" and not use the button.

And one question:

I have a lot of items, each one is a sentence. Is there a simpler way to load all to listbox then to load one by one ?

All help will be appreciated.

Thank you

Tuk

#include <GUIConstants.au3>
#Include <GuiList.au3>

GUICreate("Caption", 430, 250)
$_List =GUICtrlCreateList ("", 10,10,410,100)

$s_text="One and one are two"
_GUICtrlListAddItem($_List, $s_text)
$s_text="Two and two are four"
_GUICtrlListAddItem($_List, $s_text)
$s_text="Four and three are seven"
_GUICtrlListAddItem($_List, $s_text)

$BTN =GUICtrlCreateButton ("  Copy to Clipboard  ",10,100)

GUISetState () 
Do
    $msg = GUIGetMsg()
    if $msg = $BTN then
       $h=GUICtrlRead($_List)
       ClipPut ($h)
    endif
Until $msg = $GUI_EVENT_CLOSE
Edited by Tukata
Link to comment
Share on other sites

This should at least get you started ...

#include <GUIConstants.au3>
#Include <GuiList.au3>

GUICreate("Caption", 430, 250)
$_List =GUICtrlCreateList ("", 10,10,410,100,$WS_BORDER + $WS_VSCROLL)

$s_text= "One and one are two"
GUICtrlSetData($_List,$s_text,"NO_DEFUALT")
$s_text= "Two and two are four"
GUICtrlSetData($_List,$s_text,"NO_DEFUALT")
$s_text= "Four and three are seven"
GUICtrlSetData($_List,$s_text,"NO_DEFUALT")

$BTN =GUICtrlCreateButton ("  Copy to Clipboard  ",10,100)

GUISetState () 
Do
    $msg = GUIGetMsg()
    if $msg = $BTN then
       $h=GUICtrlRead($_List)
       ClipPut ($h)
    endif
Until $msg = $GUI_EVENT_CLOSE

Hallman

Link to comment
Share on other sites

I have three things I don't know how to do in this script:

1. I don't want items to be sorted but to appear in the order I wrote them.

2. I don't want any item to be selected on start.

3. I want to send the item full text to the clipboard "on-select" and not use the button.

Added #3 to this... #1 appears to be fixed by hallman, 2 should be fine by default

#include <GUIConstants.au3>
#Include <GuiList.au3>

GUICreate("Caption", 430, 250)
$_List =GUICtrlCreateList ("", 10,10,410,100,$WS_BORDER + $WS_VSCROLL)

$s_text= "Two and two are four"
GUICtrlSetData($_List,$s_text,"NO_DEFUALT")
$s_text= "One and one are two"
GUICtrlSetData($_List,$s_text,"NO_DEFUALT")
$s_text= "Four and three are seven"
GUICtrlSetData($_List,$s_text,"NO_DEFUALT")

GUISetState ()
Do
    $msg = GUIGetMsg()
    if $msg = $_List then
       $h=GUICtrlRead($_List)
       ClipPut ($h)
       msgbox(0,"Copied to clipboard",$h)
   endif
Until $msg = $GUI_EVENT_CLOSE
Link to comment
Share on other sites

Many thanks to you both guys.

Now I want to include a Thai Script in my sentences for example:

$s_text= "Dictionary - พจนานุกรม"

GUICtrlSetData($_List,$s_text,"NO_DEFUALT")

Can this be done ?

Thank you

Tuk

Link to comment
Share on other sites

Not sure, I dont think autoit would be made to support foreign character sets, then again it might depend on the font. But then agan, again, Ive never used foreign characters

other than the little ascii symbol things: ¥Ô which seem different on this forum than in warcraft... hmmm :/

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