Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Guiwrite - Can It Update List Boxes ?


  • Please log in to reply
10 replies to this topic

#1 steve8tch

steve8tch

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 288 posts

Posted 30 March 2004 - 07:15 AM

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







#2 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 9,626 posts

Posted 30 March 2004 - 07:21 AM

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:

#3 steve8tch

steve8tch

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 288 posts

Posted 30 March 2004 - 11:02 AM

I will try!!
Thanks.

#4 steve8tch

steve8tch

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 288 posts

Posted 02 April 2004 - 12:56 AM

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.



Plain Text         
;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.

#5 Josbe

Josbe

    Infrequent ghost ☺

  • Active Members
  • PipPipPipPipPipPip
  • 1,585 posts

Posted 02 April 2004 - 01:30 AM

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

#6 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 9,626 posts

Posted 02 April 2004 - 04:45 AM

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.

#7 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 9,626 posts

Posted 02 April 2004 - 04:59 AM

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.



Plain Text         
;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.

Plain Text         
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, 02 April 2004 - 09:24 AM.


#8 steve8tch

steve8tch

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 288 posts

Posted 02 April 2004 - 02:42 PM

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.

#9 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 9,626 posts

Posted 02 April 2004 - 05:39 PM

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.

#10 steve8tch

steve8tch

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 288 posts

Posted 02 April 2004 - 09:20 PM

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?

#11 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 9,626 posts

Posted 02 April 2004 - 10:22 PM

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:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users