Ask Your Question
0

How do i populate a listbox depending on values from another listbox

asked 2021-04-12 11:33:16 +0200

harald@voster.com gravatar image

Hi, I'm working on a calc-project. I would like to create a dialog with two listboxes. Listbox1 is master of Listbox2. Everytime when I click on an element i Listbox 1 I want Listbox 2 to populate with elements belonging to the selected item.

Well my question is who to start this process. The eventhandler of the listbox has some events which I perhaps can use, (there are an event called "Elementstatus endret" (norweginan - something like Elementstate changed (?) ). But still ... If I connect this event to a procedure or function, I have to reach the running dialogbox from thant procedure. Where/how do I find the handle for this dialog? Or perhaps there is a better way...

Regards Harald

edit retag flag offensive close merge delete

Comments

Welcome Harald! Where will your listboxes get data from? From the cells in a sheet? List of constants? Do you want to make sure to do it in a dialogue? It is possible to make an input form directly in the sheet of the spreadsheet - it's a little easier

JohnSUN gravatar imageJohnSUN ( 2021-04-12 17:57:12 +0200 )edit

Hi, yes both get data from cells in two different sheets. I know I can do it another way, but you know... curious :-). I looked at the event object for the listbox but as far as i could see there was no parent-object, or handler to the parent.

harald@voster.com gravatar imageharald@voster.com ( 2021-04-12 21:06:02 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2021-04-12 18:01:43 +0200

Ratslinger gravatar image

Hello,

This can be a large task if you have little to no experience with macros. Dialogs need macros.

There are many samples posted on the Ask site regarding dialogs. With a dialog, the object should be a global variable. With that you can access after creation.

As for the list boxes, yes, Item status changed can work. When activated the module called should read the selected item and the you can fill the second list box based upon that selection.

Here is a link to an answer containing other links regarding dialogs -> how can i set DesktopAsParent for a dialog in a library?

Please understand that this is a question and answer site and not a forum. Your question is very general in nature and needs to be more of a specific nature.

edit flag offensive delete link more

Comments

"Please understand that this is a question and answer site and not a forum." Ok. Sorry.

harald@voster.com gravatar imageharald@voster.com ( 2021-04-12 21:07:23 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2021-04-12 11:33:16 +0200

Seen: 18 times

Last updated: Apr 12