| View previous topic :: View next topic |
| Author |
Message |
as1234 General User

Joined: 30 Apr 2012 Posts: 12
|
Posted: Mon Jun 18, 2012 12:36 pm Post subject: Combobox in Form |
|
|
There are two Combobox . The first is a list of surnames ( "Madik" and "Radyy"). The second is a list of names( "Ivan" and "Jack") . How make , if I choos "Madik" of the first list , in the second list will be "Ivan"
Madik Ivan
Raddy Jack |
|
| Back to top |
|
 |
patel Power User

Joined: 14 Apr 2012 Posts: 54 Location: Italy
|
Posted: Wed Jun 20, 2012 3:09 am Post subject: |
|
|
can you attach the file ? _________________ If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button). |
|
| Back to top |
|
 |
as1234 General User

Joined: 30 Apr 2012 Posts: 12
|
Posted: Wed Jun 20, 2012 9:19 am Post subject: |
|
|
| file.odt |
|
| Back to top |
|
 |
patel Power User

Joined: 14 Apr 2012 Posts: 54 Location: Italy
|
Posted: Wed Jun 20, 2012 10:37 am Post subject: |
|
|
I'm sorry, I don't see any combo box _________________ If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button). |
|
| Back to top |
|
 |
as1234 General User

Joined: 30 Apr 2012 Posts: 12
|
Posted: Wed Jun 20, 2012 7:31 pm Post subject: |
|
|
| Mmm ...there are two ComboBox in form - XXX and ZZZ . |
|
| Back to top |
|
 |
Arineckaig OOo Advocate

Joined: 01 Mar 2004 Posts: 331
|
Posted: Thu Jun 21, 2012 3:54 am Post subject: |
|
|
| Quote: | | How make , if I choos "Madik" of the first list , in the second list will be "Ivan" |
I do not doubt that there are macro-free ways of achieving what you want, and normally I would recommend them.
As you have chosen the macro route, you might wish to consider using this method. If the two combo boxes in your dialog make use of ordered valuelists, you could use code to read the position in the list of the item selected in the first combo box and use that position to set the matching item from the list for the second combo box. _________________ When this issue has been resolved, it helps other users of the forum if you add the word [Solved] to the Subject line of your 1st post (edit button top right).
OOo 3.4.1 and MySQL on MS Windows XP and Ubuntu |
|
| Back to top |
|
 |
as1234 General User

Joined: 30 Apr 2012 Posts: 12
|
Posted: Thu Jun 21, 2012 6:28 am Post subject: |
|
|
As a result, it is done with a macro? I understood correctly?
| Quote: | | you could use code to read the position in the list of the item selected in the first combo box and use that position to set the matching item from the list for the second combo box. |
Do you know this code?))) |
|
| Back to top |
|
 |
Arineckaig OOo Advocate

Joined: 01 Mar 2004 Posts: 331
|
Posted: Thu Jun 21, 2012 7:43 am Post subject: |
|
|
I suggest the key source for information about the Dialog Combo box is the Developers Guide at:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/GUI/Combo_Box
Without knowing what you are aiming to do, it is both meaningless and an invitation for errors to suggest code, but as you ask something like the following could be included in the macro triggered by an event in the first combo box:
| Code: | oCbo1 = oEvent.source
for j = 0 to oCbo1.getItemCount-1
If oCbo1.getText() = oCbo1.getItem(j) then
iPos = j : exit for
end if
Next |
Then use 'iPos' to access the text in that position in the list of the second combo box. _________________ When this issue has been resolved, it helps other users of the forum if you add the word [Solved] to the Subject line of your 1st post (edit button top right).
OOo 3.4.1 and MySQL on MS Windows XP and Ubuntu |
|
| Back to top |
|
 |
|