Jump to content

List Problems


Recommended Posts

If I have like 3 buttons they each add something different to the list.

Case $btn1
GUICtrlSetData($lstControl, "you clicked button 1|") 
Case $btn2
GUICtrlSetData($lstControl, "you clicked button 2|")

How can I add them from top to bottom?

Link to comment
Share on other sites

Shouldn't you GUICtrlSend your various data to different listitems? If you don't know which is populated (users may hit buttons out of order), you need to GuiCtrlGetData first to check which one to use.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Sorry, I don't understand.

Here is the script that will create the problem. If you clicked button 1, button 2, button 1.

The list will look like.

You clicked button 1
You clicked button 1
You clicked button 2

I want it to look like.

You clicked button 1
You clicked button 2
You clicked button 1

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 384, 216, 192, 114)
$Button1 = GUICtrlCreateButton("Button1", 8, 184, 187, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Button2", 192, 184, 187, 25, $WS_GROUP)
$List1 = GUICtrlCreateList("", 8, 8, 369, 175)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            GUICtrlSetData($List1, "You clicked button 1|")
        Case $Button2
            GUICtrlSetData($List1, "You clicked button 2|")
    EndSwitch
WEnd
Edited by FinalVersion
Link to comment
Share on other sites

Sorry, I read listview instead of list. My bad.

If I now understand you better, you wish to have list items added by pressing , say, 3 buttons.

Is the item text fixed or predictable? If so you can first read the control and search the control content to determine if you must add a new item (put it somewhere into the list) or if it's already there (user pressed twice the same button) so you don't add it again.

Edit:

I see your own edit and code. The thing is that the control has $LBS_SORT by default. Create the control with just the style(s) you need but without $LBS_SORT and it won't change the order anymore.

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Sorry, I read listview instead of list. My bad.

If I now understand you better, you wish to have list items added by pressing , say, 3 buttons.

Is the item text fixed or predictable? If so you can first read the control and search the control content to determine if you must add a new item (put it somewhere into the list) or if it's already there (user pressed twice the same button) so you don't add it again.

Don't worry, I'm just going to use a edit box, nice and simple.

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