Sign in to follow this  
Followers 0
retaly

problem with listbox, double click, then set text in edit box

12 posts in this topic

Hy dear autoit users,

i've got one small problem what i cant fixing.

i've made one gui, with one edit, and one list box,

how does it work?

-when i click 1x to one text in listbox, its appear in edit, but if i click to one more text in list, its remove the first text in edit.

and i'd like to do the next:

-its appear in edit when i click 2x, and dont rewrite each other,i want under each other.

sorry for my bad english, i guess some1 can help me.

regards.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <file.au3>
#include <GuiEdit.au3>
#include <Constants.au3>
#include <GUIListBox.au3>
;local $msg
Local $msg, $mylist, $Edit1


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
;GUISetState(@SW_SHOW)
$Edit1 = GUICtrlCreateEdit("", 30, 72, 445, 265)
GUISetState()
GUICtrlSetColor(-1, 0x00C2FF)
;GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetData(-1, "")
GUICtrlSetState(-1, $GUI_DISABLE)
$mylist = GUICtrlCreateList("", 480, 72, 121, 265)
GUICtrlSetLimit(-1, 200)
GUICtrlSetData(-1, "Test1|Test2|Test3")
$button = GUICtrlCreateButton("Exit", 280, 368, 75, 25)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###



While 1
$msg = GUIGetMsg()



If $msg = $mylist Then
GUICtrlSetData($Edit1, GUICtrlRead($mylist))
EndIf

If $msg = $GUI_EVENT_CLOSE Then
ExitLoop
Endif


If $msg = $button Then ; If button is pushed, exit without saving to text file
ExitLoop
EndIf




WEnd

GUIDelete()

Share this post


Link to post
Share on other sites



retaly,

Does this do what you want: :huh:

#include <GUIConstantsEx.au3>

$sData = ""

$Form1 = GUICreate("Form1", 615, 438, 192, 124)

$Edit1 = GUICtrlCreateEdit("", 30, 72, 445, 265, $ES_READONLY)

$mylist = GUICtrlCreateList("", 480, 72, 121, 265)
GUICtrlSetData(-1, "Test1|Test2|Test3")

$button = GUICtrlCreateButton("Exit", 280, 368, 75, 25)

GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $mylist
            $sData &= GUICtrlRead($mylist) & @CRLF
            GUICtrlSetData($Edit1, $sData)
        Case $GUI_EVENT_CLOSE, $button
            Exit
    EndSwitch
WEnd

All clear? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

oh, its working well, thank you very much!!!

one bit question,

i'd like to do with double click, i mean it paste texts in edit when i clicked double to text, and do nothing for one click

Share this post


Link to post
Share on other sites

retaly,

paste texts in edit when i clicked double to text, and do nothing for one click

Some people are really picky! :D

This should do it: ;)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $sData = ""

$Form1 = GUICreate("Form1", 615, 438, 192, 124)

$Edit1 = GUICtrlCreateEdit("", 30, 72, 445, 265, $ES_READONLY)

$mylist = GUICtrlCreateList("", 480, 72, 121, 265)
GUICtrlSetData(-1, "Test1|Test2|Test3")

$button = GUICtrlCreateButton("Exit", 280, 368, 75, 25)

GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $button
            Exit
    EndSwitch

WEnd

Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)

    #forceref $hWnd, $iMsg, $lParam

    $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word
    $iCode = BitShift($wParam, 16) ; Hi Word

    Switch $iCode
        Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box
            Switch $iIDFrom
                Case $mylist
                    $sData &= GUICtrlRead($mylist) & @CRLF
                    GUICtrlSetData($Edit1, $sData)
            EndSwitch
    EndSwitch

EndFunc

And does it? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

fuu, it seems n1 but got this problem:

Case $LBN_DBLCLK

Case ^ ERROR

thank you for your hep, u are rly helpfull man.

Share this post


Link to post
Share on other sites

retaly,

My apologies, I deleted too many unnecessary includes. :>

You need these ones:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <ListBoxConstants.au3>

Sorry about that. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

nothing,

working well

thank you very much again,

u helped me a lot now!!

Share this post


Link to post
Share on other sites

hy again,

i'd like to ask about one more thing,

if u click 2x to Test 1,send in edit box as: Test1 ""

because it doesnt work in this form:

GUICtrlSetData(-1, "Test1 ""|Test2|Test3")

and i dont have idea for it ://

Share this post


Link to post
Share on other sites

got one problem too, if i write in edit box then click to some text it delet what i wrote in edit. :/ help me in that 2 thing if its possible, then im rdy

Share this post


Link to post
Share on other sites

retaly,

I think this should solve those 2 problems - look for the <<<<<<<< lines as usual. :)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <ListBoxConstants.au3>

$Form1 = GUICreate("Form1", 615, 438, 192, 124)

$Edit1 = GUICtrlCreateEdit("", 30, 72, 445, 265)

$mylist = GUICtrlCreateList("", 480, 72, 121, 265)
GUICtrlSetData(-1, 'Test1 ""|Test2|Test3') ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

$button = GUICtrlCreateButton("Exit", 280, 368, 75, 25)

GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $button
            Exit
    EndSwitch

WEnd

Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)

    #forceref $hWnd, $iMsg, $lParam

    $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word
    $iCode = BitShift($wParam, 16) ; Hi Word

    Switch $iCode
        Case $LBN_DBLCLK
            Switch $iIDFrom
                Case $mylist
                    ; Read current content
                    $sData = GUICtrlRead($Edit1) ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                    ; What are we adding
                    $sAdd = GUICtrlRead($mylist)
                    ; As long as we clicked on a list item
                    If $sAdd Then
                        ; Add the clicke4ed item
                        $sData &= GUICtrlRead($mylist) & @CRLF
                        ; Reset the edit content
                        GUICtrlSetData($Edit1, $sData)
                    EndIf
            EndSwitch
    EndSwitch

EndFunc

Is that how you want it? :huh:

M23

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

i wanted that!!

ooh, thank you very much, fuuu, u are a god :DDD

<3 tyty

Share this post


Link to post
Share on other sites

retaly,

Glad I could help. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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