[Solved] Check Item in Listbox is selected or not

Creating a macro - Writing a Script - Using the API

[Solved] Check Item in Listbox is selected or not

Postby MINTHETNAUNG » Fri Jun 29, 2018 9:32 am

Hi guys, I have got one Listbox A with several items inside. It is in multi-selection mode. A user can select one or more items from it. When a user does, I want those selected items to appear inside another Listbox B. How can I do that with Macro in Calc Dialog Listbox?
Last edited by MINTHETNAUNG on Mon Jul 09, 2018 9:04 am, edited 1 time in total.
Openoffice 4.1.5 on Windows 10
MINTHETNAUNG
 
Posts: 18
Joined: Mon Jun 18, 2018 3:33 am

Re: Check Item in Listbox is selected or not

Postby Zizi64 » Fri Jun 29, 2018 11:54 am

I have got one Listbox A with several items inside. It is in multi-selection mode.

If I know it exactly, there is not multiselection mode Listbox feature in the Apache OpenOffice and LibreOffice Calc...

Here are a similar topics:
https://forum.openoffice.org/en/forum/v ... 39&t=67677
https://forum.openoffice.org/en/forum/v ... 39&t=24299


Can you upload youe ODF type sample file here?
Last edited by Zizi64 on Fri Jun 29, 2018 12:00 pm, edited 2 times in total.
Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.5; AOO4.1.6
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 8133
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Check Item in Listbox is selected or not

Postby Villeroy » Fri Jun 29, 2018 11:58 am

Install the MRI extension
Point a list box event to macro:My_Macros>MriLib>Module1>Mri

If I know it exactly, there is not multiselection mode Listbox feature in the Apache OpenOffice and LibreOffice Calc...

Listbox have a multi-selection property. You can use it without value binding.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26965
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Check Item in Listbox is selected or not

Postby Zizi64 » Fri Jun 29, 2018 12:04 pm

Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.5; AOO4.1.6
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 8133
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Check Item in Listbox is selected or not

Postby Villeroy » Fri Jun 29, 2018 12:53 pm

Zizi64 wrote:I found a short description:
https://wiki.openoffice.org/wiki/Docume ... I/List_Box

That page describes the model of a lits box.
Calling MRI from the loaded list box object, you get methods get/setSelectedItemsPos and get/setSelectedItems (aka pseudo-properties SelectedItemsPos and SelectedItems)

https://forum.openoffice.org/en/forum/v ... 74&t=49294
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26965
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Check Item in Listbox is selected or not

Postby Zizi64 » Fri Jun 29, 2018 8:57 pm

I learned a useful thing again. Thank you Villeroy.

Listbox.ods
(12.03 KiB) Downloaded 47 times
Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.5; AOO4.1.6
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 8133
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Check Item in Listbox is selected or not

Postby Villeroy » Fri Jun 29, 2018 9:33 pm

Even simpler if you have MRI installed.
Select items and double-click the "Source" line in the MRI window.
Attachments
multiselect.odt
(8.97 KiB) Downloaded 37 times
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26965
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Check Item in Listbox is selected or not

Postby Zizi64 » Fri Jun 29, 2018 9:38 pm

Even simpler if you have MRI installed.

I am using the Xray inspection tool.
Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.5; AOO4.1.6
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 8133
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Check Item in Listbox is selected or not

Postby Villeroy » Sun Jul 01, 2018 2:01 pm

Write a Basic wrapper just like the MRI wrapper.
When I used Xray, I had this one which can inspect the elements of an array:
Code: Select all   Expand viewCollapse view
Sub myXRay(optional v)
Dim i%,obj,x%,sRec$
Static iRec%
if ismissing(v) then v = ThisComponent
   globalscope.basiclibraries.loadlibrary("XrayTool")
   if isarray(v) then
      iRec = iRec +1
      for i = lBound(v) to uBound(v)
         obj = v(i)
         myXRay obj 'recursive for nested arrays
         if (i< uBound(v)) then
            If iRec > 1 then sRec$ = "[Recursion="& iRec &"] " : else sRec =""
            x = msgbox(sRec & i -lBound(v)+2 &" / "& uBound(v) - lBound(v) +1,5,"X-ARRAY")
            if x = 2 then exit for
         endif
      next
      iRec = iRec -1
   else
      xray v
   end if
End Sub
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26965
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 5 guests