Jump to content

Guiwrite - Can It Update List Boxes ?


Recommended Posts

GUIWrite - can it update list boxes and combo boxes?

Can it just update GUIControl names or can it be made to also update GUIControl data.

An example of this would be:

If button 1 is clicked - FileOpenDialog would open and allow you to select a file.

I would like to be able to add this file name to a list displayed in listbox 2.

Any thoughts. :whistle:

I think you/we/I could get round this by adding data to a variable and completely restarting the GUI again - but if the GUIWrite could do it in the same way as it updates control names then......

Thanks for any help.

This GUI stuff is brilliant...

Link to comment
Share on other sites

GUIWrite - can it update list boxes and combo boxes?

Can it just update GUIControl names or can it be made to also update GUIControl data.

An example of this would be:

If button 1 is clicked - FileOpenDialog would open and allow you to select a file.

I would like to be able to add this file name to a list displayed in listbox 2.

Any thoughts. B)

I think you/we/I could get round this by adding data to a variable and completely restarting the GUI again - but if the GUIWrite could do it in the same way as it updates control names then......

Thanks for any help.

This GUI stuff is brilliant...

As I try to explain in the doc GuiSetControlEx and GuiSetControlData can be use in a GuiMsg() loop so that's the way to manage Combo/List control value :whistle:
Link to comment
Share on other sites

I have tried (and tried) and got nowhere.

I am trying to write a test script. I have 2 buttons - called button1 and button2.

When I click on button1 - I am trying to add an entry into a list box saying "you clicked button1". When I click on these buttons - successive entries will be entered into the text box (and hopefully updated by the GUI).

I have looked hard at all the examples given - and - well - I just can't work it out!!

Is someoneable to add the appropriate lines to make it work.

;Test script to try and get a list box information updated
;by clicking on a button

GLOBAL $MESSAGE = "The following buttons have been clicked"
GUICreate("My GUI") ; will create a dialog box that when displayed is centered

GUISetControl("button", "Button1", 64,32,75,25)
GUISetControlNotify()
GUISetControl("button", "Button2", 64,72,75,25)
GUISetControlNotify()
GUISetControl("list", "buttons that have been clicked", 176,32,121,97)
GUISetControlEx(3,16,-1,-1,200)
GUISetControlData(3,$MESSAGE)
GUISetControlNotify()
GUISetControl("button", "my closing button", 64,160,175,25)
GUISetControlNotify()  ; the focus is on this button and Click will close the GUI

While GUIMsg() > 0      ; will display a dialog box with 2 buttons
      If GUIMsg() = 1 Then $MESSAGE = $MESSAGE & "|" & "You clicked button No1"
      If GUIMsg() = 2 Then $MESSAGE = $MESSAGE & "|" & "You clicked button No2"
      If GUIMsg() = 4 Then
         MsgBox(0,"", "the closing button has been clicked")
         Exit
      EndIf
Wend

Thanks for any help

I was also trying to configure the list box to display a horizontal slide bar to that you can see all the text if the line of text is too long for the width of the list box.

Link to comment
Share on other sites

And what about the Label color (updating)?  :whistle:

As mention in the doc the GuiSetControlEx can be used during the GuiMsg loop so it should work. I don't want to add to many parameters to GuiWrite.

Just report if not.

At the beginning Guiwrite was just for state and text. Now we add styles.

It could be more cleaner if GuiWrite was updating just GuiSetControl. But as not so many will use the GuiSetControlEx in a loop I prefer to stay as it is now.

Link to comment
Share on other sites

I have tried (and tried) and got nowhere.

I am trying to write a test script. I have 2 buttons - called button1 and button2.

When I click on button1 - I am trying to add an entry into a list box saying "you clicked button1". When I click on these buttons - successive entries will be entered into the text box (and hopefully updated by the GUI).

I have looked hard at all the examples given - and - well - I just can't work it out!!

Is someoneable to  add the appropriate lines to make it work.

;Test script to try and get a list box information updated
;by clicking on a button

GLOBAL $MESSAGE = "The following buttons have been clicked"
GUICreate("My GUI"); will create a dialog box that when displayed is centered

GUISetControl("button", "Button1", 64,32,75,25)
GUISetControlNotify()
GUISetControl("button", "Button2", 64,72,75,25)
GUISetControlNotify()
GUISetControl("list", "buttons that have been clicked", 176,32,121,97)
GUISetControlEx(3,16,-1,-1,200)
GUISetControlData(3,$MESSAGE)
GUISetControlNotify()
GUISetControl("button", "my closing button", 64,160,175,25)
GUISetControlNotify()  ; the focus is on this button and Click will close the GUI

While GUIMsg() > 0      ; will display a dialog box with 2 buttons
      If GUIRead() = 1 Then $MESSAGE = $MESSAGE & "|" & "You clicked button No1"
      If GUIRead() = 2 Then $MESSAGE = $MESSAGE & "|" & "You clicked button No2"
      If GUIRead() = 4 Then
         MsgBox(0,"", "the closing button has been clicked")
         Exit
      EndIf
Wend

Thanks for any help

I was also trying to configure the list box to display a horizontal slide bar to that you can see all the text if the line of text is too long for the width of the list box.

here is an update version of your code.

Have a look.

I discover in my current version that the first click need to be type twice.

I will look at that but you get the basic idea of how to write a GUI.

Depending what you intend to do with the list an edit control may be more appropriate.

GLOBAL $MESSAGE = "The following buttons have been clicked"
GUICreate("My GUI"); will create a dialog box that when displayed is centered

$button1=GUISetControl("button", "Button1", 64,32,75,25)
GUISetControlNotify()
$button2=GUISetControl("button", "Button2", 64,72,75,25)
GUISetControlNotify()
$mylist=GUISetControl("list", "buttons that have been clicked", 176,32,121,97)
GUISetControlEx(-1,16,-1,-1,200)
GUISetControlData(-1,$MESSAGE)
GUISetControlNotify()
$close=GUISetControl("button", "my closing button", 64,160,175,25)
GUISetControlNotify(); the focus is on this button and Click will close the GUI

While GUIMsg() > 0    ; will display a dialog box with 2 buttons
     If GUIRead() = $button1 Then GuiSetControlData($mylist,"You clicked button No1")
     If GUIRead() = $button2 Then GuiSetControlData($mylist,"You clicked button No2")
     If GUIRead() = $close Then
        MsgBox(0,"", "the closing button has been clicked")
        Exit
     EndIf
Wend

EDIT : For those which have read this message before I edit it, I make a mistake in the loop calling GuiMsg instead of GuiRead. That's was the reason of the twice click problem

Sorry for the trouble

Edited by jpm
Link to comment
Share on other sites

Thankyou, again for your time.

I think that adding the above example to the helpfile would help illustrate how updating list boxes work.

I am sorry to trouble you further but...

In you picture your gui.jpg you showed a list box with a horizontal scroll bar.

How can I enable it in the above script.

I have read your documentation (honest) and haven't yet been able to make it work.

Thanks again for your help.

Link to comment
Share on other sites

Thankyou, again for your time.

I think that adding the above example to the helpfile would help illustrate how updating list boxes work.

I am sorry to trouble you further but...

In you picture your gui.jpg you showed a list box with a horizontal scroll bar.

How can I enable it in the above script.

I have read your documentation (honest) and haven't yet been able to make it work.

Thanks again for your help.

If you are refering to "My test GUI2.JPG" there is listbox with only an horizontal scroll bar but an edit control which has horizontal and vertical scroll bar which are grayed because the control enable them when needed.

Put here the example you want in the doc. I want to be sure the one you are referring.

Link to comment
Share on other sites

Thankyou again for your reply.

I was refering to the example above/below.

The control refered to by ..

...
...
$mylist=GUISetControl("list", "buttons that have been clicked", 176,32,121,97)
GUISetControlEx(-1,16,-1,-1,200)
GUISetControlData(-1,$MESSAGE)
GUISetControlNotify()
...
...

I deliberately made the first line displayed in the list box too long so that it didn't fit in the list box. I was hoping learn how to enable the horizontal scroll bar in order to see all the text.

Thanks again for your help.

I was going to ask another question - but as I haven't yet looked at it myself I thought it would be 'cheating ' abit to ask you first. On second thoughts - I will ask the question - just in case it can't be done. :whistle:

You have showed us how to add data to a list box and update the list control using GUIMsg and GUIRead.

Can you also select a line from a text box and delete it using the same sort of procedures?

Link to comment
Share on other sites

Can you also select a line from a text box and delete it using the same sort of procedures?

It is certainly possible with the Control... functions. I am not the expert on this part. :angry: Larry is. B) I hope he can give you some advise

Just a small precision regarding your statement

You have showed us how to add data to a list box and update the list control using GUIMsg and GUIRead.

To be precise the updating of a list is done with GuiSetControlData. Guiread as ne name say just read.

Good luck with AutoIt GUI functions :whistle:

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