AutoWidth / AutoSize ListBox ???

Creating a macro - Writing a Script - Using the API

AutoWidth / AutoSize ListBox ???

Postby deeno » Mon Jan 14, 2008 11:40 pm

hello everybody!
first of all, i do not know if this is the right forum, but i'll try, as i havent found anything about my problem in other forums or inside the documentation... if i am wrong in here, please move this thread into the right forum!

the problem
i am starting my first steps with base and i want to accomplish the following:

i created a writer.document and inserted a ListBox element inside a text,
linked this element to the small DB i created with base, in order to be able to select
names of customers from this DB to be inserted inside this document (which happens to be an invoice),
exporting it as a PDF and sending it to them. SO FAR IT ALL WORKS GREAT!
...but!
yeah, there is always a "but"...
i have set the size of this ListBox to lets say 5 cm, "but" selecting a name with only a smal size of lets say 3 cm leaves a big gap after the name on the exported PDF, which is kind of "ugly"... (see attached file)

AutoSizeListBox.jpg


the question
is it possible to AutoSize the width of this ListBox after selecting a name, so its size is adjusted according to the length of this name?
maybe some kind of macro initiated on the "Changed" Event?

or maybe there is another, much simpler solution to this, i havent come accorss yet...

any help will be appreciated!!!

many thanks in advance!
deeno
deeno
 
Posts: 3
Joined: Mon Jan 14, 2008 11:02 pm

Re: AutoWidth / AutoSize ListBox ???

Postby Villeroy » Tue Jan 15, 2008 7:08 am

http://api.openoffice.org/docs/common/r ... rains.html

getMinimumSize returns the minimum size for this component.
getPreferredSize returns the preferred size for this component.
calcAdjustedSize(size) calculates the adjusted size for a given maximum size.

All methods return a struct com.sun.star.awt.Size with elements Width and Height.
http://api.openoffice.org/docs/common/r ... /Size.html
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: 26983
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: AutoWidth / AutoSize ListBox ???

Postby deeno » Tue Jan 15, 2008 12:40 pm

thanks villeroy,

trouble is, i aint got no clue what to do with those infos...
do i need to program a macro? in what language? can i do that? how easy is it?
(i am skilled in actionscript, javascript, php, html...)
any tutorial on this?
i would then need also the length of the chars in the listbox i selected...
or even better the width of all selected chars together?

i never did any programming for openoffice, isnt there a different way to solve this problem?
deeno
 
Posts: 3
Joined: Mon Jan 14, 2008 11:02 pm

Re: AutoWidth / AutoSize ListBox ???

Postby deeno » Sun Jan 20, 2008 10:35 pm

hm, seems that villeroy is on vacations...
anybody else on my questions?
deeno
 
Posts: 3
Joined: Mon Jan 14, 2008 11:02 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 5 guests