https://bugs.documentfoundation.org/show_bug.cgi?id=129437

--- Comment #5 from [email protected] ---
> Exactly what corresponding Basic and Java code does not exhibit this issue?
I was half wrong.

If this basic code rases no error:

Sub any_enum_test():
    button_model = createUnoService("com.sun.star.awt.UnoControlButtonModel")
    button_types = com.sun.star.awt.PushButtonType
    button_model.setPropertyValue("PushButtonType", button_types.OK)
    print button_model.PushButtonType 'PushButtonType = 1
End Sub


Java does indeed need conversion, as shown by this (not tested) snippet from
the Developpers's Guide, that helped me for the python code:

public XButton insertButton(XActionListener _xActionListener, int _nPosX, int
_nPosY, int _nWidth, String _sLabel, short _nPushButtonType){
  XButton xButton = null;
  try{
    [...]
    xButtonMPSet.setPropertyValues(
      new String[] {"Height", "Label", "Name", "PositionX", "PositionY",
"PushButtonType", "Width" } ,
      new Object[] {new Integer(14), _sLabel, sName, new Integer(_nPosX), new
Integer(_nPosY), new Short(_nPushButtonType), new Integer(_nWidth)});
    [...]

I totally forgot the "Short" type conversion. So you were right, this could be
the expected behaviour, and the correct Python translation should be something
like this (that works):

    uno.invoke(button_model, "setPropertyValue", ("PushButtonType",
uno.Any("short", OK)))

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to