Help for widget UI conversion

Caolán McNamara caolanm at redhat.com
Wed Jun 26 07:08:29 PDT 2013


On Wed, 2013-06-26 at 11:30 +0000, Manal M. Alhassoun wrote:
> Hi,
>  
> I'm trying to convert FontTypeDialog into .ui format
> However, I get the following error: 
> warn:vcl.layout:14483:1:include/vcl/builder.hxx:255: .ui widget
> "variableCB" needs to correspond to vcl type 17SmFontPickListBox
> 
> 
> what type of GTK should I use ? or How I can fix this error ?

These "custom" widgets need to have an entry point exposed so they can
be used from the .ui format.

e.g. see cui/source/dialogs/thesdlg.cxx and

extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL
makeLookUpComboBox(Window *pParent, VclBuilder::stringmap &)
{
    return new LookUpComboBox(pParent);
}

its got to be this pattern, then in the .ui (in this case
cui/uiconfig/ui/thesaurus.ui) you make the object of class
"cuilo-LookUpComboBox" i.e. "libraryname"-"widgetname" and the method is
called "make"widgetname. 

To make it easy to manipulate them in glade you can edit
extras/source/glade/libreoffice-catalog.xml.in and add an entry in there
for the new widget, search for cuilo-LookUpComboBox in that file for an
example

The libraryname-widgetname scheme is because there are cross-platform
differences in how strict or lenient various platforms are for finding
the symbol name in the requested library or not. i.e. Linux will return
the symbol if it finds it in a different library, while windows need to
know the library. If you are working under Linux and add a custom widget
to a .ui, then running ./bin/verify-custom-widgets-libs from the source
root will verify if that .ui will or will not crash under windows (i.e.
you got the wrong library name)

Its a bit painful I admit. I had rather thought there would be a handful
of custom widgets, but the list has grown to an alarming size. At some
future point I might rework this a bit to avoid exposing so many dlsymed
entry points. But for the moment this is the way to get custom widgets
working.

If you've got some code that otherwise works and the above doesn't help
then feel free to push it to gerrit, give it a -1 vote from yourself to
block it from getting integrated, and put me on cc and I'll help fix it
up.

C.




More information about the LibreOffice mailing list