OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Combobox in Form

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
as1234
General User
General User


Joined: 30 Apr 2012
Posts: 12

PostPosted: Mon Jun 18, 2012 12:36 pm    Post subject: Combobox in Form Reply with quote

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
View user's profile Send private message
patel
Power User
Power User


Joined: 14 Apr 2012
Posts: 54
Location: Italy

PostPosted: Wed Jun 20, 2012 3:09 am    Post subject: Reply with quote

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
View user's profile Send private message
as1234
General User
General User


Joined: 30 Apr 2012
Posts: 12

PostPosted: Wed Jun 20, 2012 9:19 am    Post subject: Reply with quote

file.odt
Back to top
View user's profile Send private message
patel
Power User
Power User


Joined: 14 Apr 2012
Posts: 54
Location: Italy

PostPosted: Wed Jun 20, 2012 10:37 am    Post subject: Reply with quote

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
View user's profile Send private message
as1234
General User
General User


Joined: 30 Apr 2012
Posts: 12

PostPosted: Wed Jun 20, 2012 7:31 pm    Post subject: Reply with quote

Mmm ...there are two ComboBox in form - XXX and ZZZ .
Back to top
View user's profile Send private message
Arineckaig
OOo Advocate
OOo Advocate


Joined: 01 Mar 2004
Posts: 358

PostPosted: Thu Jun 21, 2012 3:54 am    Post subject: Reply with quote

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
View user's profile Send private message
as1234
General User
General User


Joined: 30 Apr 2012
Posts: 12

PostPosted: Thu Jun 21, 2012 6:28 am    Post subject: Reply with quote

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
View user's profile Send private message
Arineckaig
OOo Advocate
OOo Advocate


Joined: 01 Mar 2004
Posts: 358

PostPosted: Thu Jun 21, 2012 7:43 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group