Discussion:
How can I copy an object
(too old to reply)
rolf
2006-09-07 18:45:40 UTC
Permalink
Hi your GAMBAS fighter,

I'm still fighting with objects and a question raises to me.

I need a combobox with 5 or 6 entries more then once and have to setup an
array to manage them. Collect and access the comboboxes in the array is no
problem, but can I create a "sample combobox" with all the wanted entries and
copy this box, of course with a different name and a different position into
the array as offen as needed?

Many thanks for your help.
Rolf
Timothy Marshal-Nichols
2006-09-08 08:40:44 UTC
Permalink
-----Original Message-----
Sent: Thursday, 07 September 2006 19:46
To: mailing list for gambas users
Subject: [Gambas-user] How can I copy an object
Hi your GAMBAS fighter,
I'm still fighting with objects and a question raises to me.
I need a combobox with 5 or 6 entries more then once and have to setup an
array to manage them. Collect and access the comboboxes in the
array is no
problem, but can I create a "sample combobox" with all the wanted
entries and
copy this box, of course with a different name and a different
position into
the array as offen as needed?
Many thanks for your help.
Rolf
Why swap over complete objects. The ComboBox (like the ListBox) has a List
property that can easily be used to get or update the ComboBox content.

In older versions of Gambas this was a string with each item separated by a
new line. In the latest version of Gambas it is a string array. (There is no
explanation for the change.)

So a better answer is to use the list property. For example:

Place 3 buttons on a form.
Give the buttons the tags of 0, 1 and 2 and the group name of
ButtonContent.
Add a ComboBox and call it ComboBoxContent

Try this code. The first bit just creates the string arrays for the items.
Then swapping over the content is one line.

PRIVATE comboContent AS Object[]

PUBLIC SUB Form_Open()
DIM i AS Integer
DIM content AS String[]
comboContent = NEW Object[3]
' Create 3 string arrays for the combo box content
' This is for button 1
content = NEW String[10]
FOR i = 0 TO content.Count - 1
content[i] = "Button 1 content " & i
NEXT
comboContent[0] = content
' This is for button 2
content = NEW String[24]
FOR i = 0 TO content.Count - 1
content[i] = "Button 2 item number " & i
NEXT
comboContent[1] = content
' This is for button 3
content = NEW String[4]
FOR i = 0 TO content.Count - 1
content[i] = "No much in button 3 # " & i
NEXT
comboContent[2] = content
' Set the conbo box to button 1 items
ComboBoxContent.List = comboContent[0]
END

PUBLIC SUB ButtonContent_Click()
ComboBoxContent.List = comboContent[LAST.Tag]
END

I have attached Gambas projects for versions 1 and 2 of Gambas.

Thanks

8-{)} Timothy Marshal-Nichols
<mailto: timothy.marshal-***@ntlworld.com>
rolf
2006-09-08 11:01:23 UTC
Permalink
Hello Timothy
Post by Timothy Marshal-Nichols
Post by rolf
I need a combobox with 5 or 6 entries more then once and have to setup an
array to manage them. Collect and access the comboboxes in the
array is no problem, but can I create a "sample combobox" with all the
wanted entries and copy this box, of course with a different name and a
different position into the array as offen as needed?
Why swap over complete objects. The ComboBox (like the ListBox) has a List
property that can easily be used to get or update the ComboBox content.
In older versions of Gambas this was a string with each item separated by a
new line. In the latest version of Gambas it is a string array. (There is
no explanation for the change.)
Place 3 buttons on a form.
Give the buttons the tags of 0, 1 and 2 and the group name of
ButtonContent.
Add a ComboBox and call it ComboBoxContent
Try this code. The first bit just creates the string arrays for the items.
Then swapping over the content is one line.
PRIVATE comboContent AS Object[]
PUBLIC SUB Form_Open()
DIM i AS Integer
DIM content AS String[]
comboContent = NEW Object[3]
' Create 3 string arrays for the combo box content
' This is for button 1
content = NEW String[10]
FOR i = 0 TO content.Count - 1
content[i] = "Button 1 content " & i
NEXT
comboContent[0] = content
' This is for button 2
content = NEW String[24]
FOR i = 0 TO content.Count - 1
content[i] = "Button 2 item number " & i
NEXT
comboContent[1] = content
' This is for button 3
content = NEW String[4]
FOR i = 0 TO content.Count - 1
content[i] = "No much in button 3 # " & i
NEXT
comboContent[2] = content
' Set the conbo box to button 1 items
ComboBoxContent.List = comboContent[0]
END
PUBLIC SUB ButtonContent_Click()
ComboBoxContent.List = comboContent[LAST.Tag]
END
I will test the code - if I know, why I get in a listbox_click event allways
the previous (if exists) and the current item under GAMBAS 1.9.39

Fine regards
Rolf
Ron Onstenk
2006-09-08 16:28:35 UTC
Permalink
Post by rolf
I will test the code - if I know, why I get in a listbox_click event allways
the previous (if exists) and the current item under GAMBAS 1.9.39
Fine regards
Rolf
The MouseDown give the previous entry
The MouseUp give the current selected.
The Click give the current selected.

I had the "problem" too but it is correct on mouse down.
May be there must be a action done on the previous selected
before the new is activated as "Selected".

Ron
rolf
2006-09-09 08:25:42 UTC
Permalink
Hi Ron
Post by Ron Onstenk
Post by rolf
I will test the code - if I know, why I get in a listbox_click event
allways the previous (if exists) and the current item under GAMBAS 1.9.39
The MouseDown give the previous entry
The MouseUp give the current selected.
The Click give the current selected.
I had the "problem" too but it is correct on mouse down.
May be there must be a action done on the previous selected
before the new is activated as "Selected".
The mouse up event does what I expect. Many thanks for your help.

Rolf
Benoit Minisini
2006-09-08 15:34:34 UTC
Permalink
Post by Timothy Marshal-Nichols
-----Original Message-----
Sent: Thursday, 07 September 2006 19:46
To: mailing list for gambas users
Subject: [Gambas-user] How can I copy an object
Hi your GAMBAS fighter,
I'm still fighting with objects and a question raises to me.
I need a combobox with 5 or 6 entries more then once and have to setup an
array to manage them. Collect and access the comboboxes in the
array is no
problem, but can I create a "sample combobox" with all the wanted
entries and
copy this box, of course with a different name and a different
position into
the array as offen as needed?
Many thanks for your help.
Rolf
Why swap over complete objects. The ComboBox (like the ListBox) has a List
property that can easily be used to get or update the ComboBox content.
In older versions of Gambas this was a string with each item separated by a
new line. In the latest version of Gambas it is a string array. (There is
no explanation for the change.)
I can give you. :-)

- Why not using a String array? It is more logical.

- With a string array, you have only the real list entries to translate. You
dont have to translate a string with all entries separated with '\n', which
can break the program if the translator forgets a '\n'.

Regards,
--
Benoit Minisini
c***@linux.it
2006-09-08 23:06:04 UTC
Permalink
Hi,
is there a way to set the Message caption ?
thanks :)
carlo






_______________________________________________

* GPG/PGP public key-id: 0xB703A9E2
* rfc.altervista.org aspetta il tuo contributo
* USE=-brain emerge win
* "Sulla confezione c'era scritto: necessita' di
win9x, winXP o superiore..
...cosi' ho installato linux"
_______________________________________________
Charlie Reinl
2006-09-10 19:01:02 UTC
Permalink
Post by c***@linux.it
Hi,
is there a way to set the Message caption ?
thanks :)
carlo
Salut,

in both versions, I haven't seen the possibility to set a caption to
Message.

So there is no way to set the caption.

Amicalment
Charlie
Daniel Campos
2006-09-10 20:39:43 UTC
Permalink
I think not at this moment

Daniel
Post by Charlie Reinl
Post by c***@linux.it
Hi,
is there a way to set the Message caption ?
thanks :)
carlo
Salut,
in both versions, I haven't seen the possibility to set a caption to
Message.
So there is no way to set the caption.
Amicalment
Charlie
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
Continue reading on narkive:
Loading...