Cell range selection control on a dialog

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
sipiatti
Posts: 5
Joined: Thu Feb 18, 2010 8:31 pm

Cell range selection control on a dialog

Post by sipiatti »

How to put a cellrange selector control on a dialog? Like in the function wizard, or in the dialog where you select the print areas... I use openoffice basic (or I try to...)
OpenOffice.org 3.1.1 on LinuxMint 8
ms777
Volunteer
Posts: 177
Joined: Mon Oct 08, 2007 1:33 am

Re: Cell range selection control on a dialog

Post by ms777 »

Hi,

see http://wiki.services.openoffice.org/wik ... _Selection

I remember having seen an OOBasic example using this service, but I did not find it again ...

ms777
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Cell range selection control on a dialog

Post by Villeroy »

This is the thing you've got to implement: http://api.openoffice.org/docs/common/r ... ction.html
Since you can not implement any classes in Basic you need some work-arounds with

Code: Select all

do
wait 500
loop until global_Var=True

do_stuff(myEvent.RangeDescriptor)
waiting that a listener routine sets a global variable to end the loop.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
sipiatti
Posts: 5
Joined: Thu Feb 18, 2010 8:31 pm

Re: Cell range selection control on a dialog

Post by sipiatti »

Thanks guys. It seems I am not on the level to implement this mechanism :( and I have a strict deadline. I think I will make a simple dialog with inputboxes where the user types in the range coords for now. If it will work, temporary will be enough, and later I will try to go through this. I am not a developer so without useful examples I could not make a solution.
The lack of usable examples of OOBASIC is the biggest disadvantage of use ooo in a real office environment :( With Excel VBA the user can adjust the spreadsheet to his special needs. I see that OOBasic is capable, but I could not get enough info to use it as easy as VBA. And that's an issue when your boss asks for the results :S
But that's another story, thanks again guys.
OpenOffice.org 3.1.1 on LinuxMint 8
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Cell range selection control on a dialog

Post by Villeroy »

If you would simply google for the keywords we provided you would find plenty of examples:
This one used to work for me: http://www.oooforum.org/forum/viewtopic.phtml?t=38775
Copy the first code section into a module and call the function. Unfortunately it returns an address struct which can be resolved to a range object as shown in the second snippet.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
sipiatti
Posts: 5
Joined: Thu Feb 18, 2010 8:31 pm

Re: Cell range selection control on a dialog

Post by sipiatti »

Thank you for the link, quite useful. Anyway I did searches but my search terms was not the best I think. I found mainly java and python posts. I know a bit python but no java, another hand I have to solve this with ooobasic :) This complete UNO structure and logic is like an alien (by Ridley Scott) for me :) I want to learn it but looks without java knowledge it will be very hard for me. I made several solutions with MS Excel and Access VBA at my workplace, but I would prefer OpenOffice if I could use ooBasic as productive as VBA
OpenOffice.org 3.1.1 on LinuxMint 8
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Cell range selection control on a dialog

Post by Villeroy »

This has nothing to do with VBA or Java. You can talk to the API in almost any language. It's always the same UNO thing no matter which language you use. Yes, it is complicated indeed.
You could access UNO from within Excel's VBA if you have both programs installed, but even in VBA you have to deliver your orders at the correct UNO services.
It's the same when you write firefox add-ons or compose GUIs from a set of widgets. You've got to know the thing you are hacking upon. A general problem with many spreadsheet macros is that the developers don't know much about spreadsheets and consequently re-invent wheels or hack against the application design.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
sipiatti
Posts: 5
Joined: Thu Feb 18, 2010 8:31 pm

Re: Cell range selection control on a dialog

Post by sipiatti »

Sure you are absolutely right, but as long as the examples are in java at api.openoffice.org and the most of the services are introduced only with their properties and methods without practical examples how one could use it in ooobasic the VBA will be an office successor. It is a pain for anyone like me with VBA knowledge to improve himself in macro programming of ooo. But this is only a notice from me I like ooo much better then e.g. MSO2007 with its intuitive (??) ribbon interface what I will never like.
OpenOffice.org 3.1.1 on LinuxMint 8
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Cell range selection control on a dialog

Post by Villeroy »

MS Office is a very, very different collection of applications for the Windows operating system.
This office suite is one application for all platforms. It is an independent application since 1985 when StarWriter started. It has been developed with a completely different philosophy and financial resources far behind what MS is able to spend for their products. This can not be API compatible like Corel Draw can not be run by Photoshop macros. If you want a better IDE use Java with the Netbeans suite and an OpenOffice.org plug-in. If you want to learn the API, install some object inspector and read the documentation. It's always the same challenge with any complex API you start hacking upon.
If the Ribbon is the main reason to switch, I would recommend to familiarize yourself with that user interface and keep all your VBA code instead of switching from one vendor lock-in into another. There are far better reasons for a change.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply