Issue 40890 - Button BackgroundColor (and others) not working with native widget look
Summary: Button BackgroundColor (and others) not working with native widget look
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: OOo 2.0
Hardware: All Windows XP
: P5 (lowest) Trivial with 2 votes (vote)
Target Milestone: AOO Later
Assignee: AOO issues mailing list
QA Contact:
Keywords: regression
Depends on:
Blocks: 71896
  Show dependency tree
Reported: 2005-01-18 12:26 UTC by aidan.butler
Modified: 2017-05-20 11:31 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

ScreenShot of Dialog with one button (13.67 KB, image/jpeg)
2005-01-19 10:40 UTC, aidan.butler
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description aidan.butler 2005-01-18 12:26:58 UTC
UnoControlButtonModel property BackgroundColor does not seem to be working in

See Python code below:
 button = dialogModel.createInstance( "")
 button.PositionX = 4
 button.PositionY =  55
 button.Width = 45
 button.Height = 14
 button.Step   = Step
 button.Name = "Test"
 button.Label = "testagain"
 button.BackgroundColor = 0x00FF00

Result, button is displayed, but the Background color is not set.

I can get and set the Property, but there is no effect in the UI. This used to
Comment 1 aidan.butler 2005-01-18 12:37:13 UTC
Comment 2 dsherwin 2005-01-18 12:51:24 UTC
Adding "regression" keyword as this is a regression from the 1.1.x series
Comment 3 Frank Schönheit 2005-01-18 15:57:16 UTC
Aidan, I have some problems reproducing this - admittedly with Basic, not
Python. If I execute the following script for a dialog model
  button = oDialogModel.createInstance( "")
  button.PositionX = 4
  button.PositionY =  55
  button.Width = 45
  button.Height = 14
  button.Name = "Test"
  button.Label = "testagain"
  button.BackgroundColor = 255 * 256
  oDialogModel.insertByName( button.Name, button )

then this works perfectly.

What I'm missing in your script is an insertion of the button model into the
dialog model - did you just omit this, or is this simply not happening?
Also, what state is your dialog in? Is it currently being displayed/executed?
Comment 4 aidan.butler 2005-01-18 16:11:57 UTC
The dialog displays fine, the only problem is that the button colors are not
being applied. I create the dialog model as follows and insert the button 

dialogModel = smgr.createInstanceWithContext(  \
			"", ctx )
dialogModel.PositionX = -100
dialogModel.PositionY = -100
dialogModel.Width = (105)
dialogModel.Height = (365)
dialogModel.Title = "ToolBar"
dialogModel.Step = 1
. //create and modify button
dialogModel.insertByName("my button", button);

Comment 5 Frank Schönheit 2005-01-19 07:11:09 UTC
which still leaves me clueless about where the dialog is being executed, not to
mention that with the current scripts, you only have a dialog model, not a dialog.

Can you provide a *full*, reproducible script (plus probably instructions how to
use it, since I am not familar with how to use Python in OOo).

When trying to reproduce this in Basic, everything works as expected, so either
this is a UNO binding problem (which I don't really believe), or a problem of us
doing something differently (which I cannot judge, since I still don't know your
complete scenario).
Comment 6 aidan.butler 2005-01-19 10:40:03 UTC
Created attachment 21670 [details]
ScreenShot of Dialog with one button
Comment 7 aidan.butler 2005-01-19 10:42:21 UTC
Ok, I have reproduced the same problem using Star-Basic. Again, this is using
the SRC680_m69 build running on WinXP. Please also see the attached screenshot

REM  *****  BASIC  *****

Sub Main
  dialogModel = CreateUnoService( "" )
  dialogModel.Width =300 
  dialogModel.Height =350
  button = dialogModel.createInstance( "")
  button.PositionX = 4
  button.PositionY =  55
  button.Width = 45
  button.Height = 14
  button.Name = "Test"
  button.Label = "testagain"
  button.BackgroundColor = 255 * 100
  dialogModel.insertByName( button.Name, button )
  oDlg =CreateUnoService("")
  oWindow =CreateUnoService("")
  oDlg.CreatePeer(oWindow, null)
End Sub
Comment 8 Frank Schönheit 2005-01-19 13:12:23 UTC
Your screenshot makes it clear - you are using a native XP theme on your
desktop, don't you? Well, in this case all the controls will have the XP look
taken from the theme - this is a feature, not a bug. The problem is that you
cannot selectively overwrite single aspects of a themed look - most certainly,
the would look weird afterwards.

The only thing which you probably could do is disabling the native look
completely for the dialog as a whole, plus all controls. Unfortunately, this is
currently not implemented ...
Comment 9 Frank Schönheit 2005-01-19 13:15:20 UTC
to be more precise: You can set the "native look" property at a a *peer*, but
not at a model. I am also not sure whether setting it at the dialog peer
automatically propagates this to child controls.
You might want to try adding
  Dim bNativeLook as Boolean
  bNativeLook = TRUE
  oDlg.getPeer().setProperty( "NativeWidgetLook", bNativeLook )
immediately before
Comment 10 aidan.butler 2005-01-19 14:36:09 UTC
Setting the NativeWidgetLook to False did the trick, thanks.

Is this documented anywhere? Also, it might be better if this did not fail
silently, as we have just moved from 1.0 to 2.0 beta, and it seemed as if we
lost some of the functionality between releases. 

thanks again, for the work around.
Comment 11 Frank Schönheit 2005-01-19 15:19:10 UTC
If it wouldn't fail silently, your script would probably break at this position,
which is also not really nice.
I think about making the NativeWidgetLook a public property at the dialog model ...
Comment 12 Frank Schönheit 2005-05-10 13:41:27 UTC
Comment 13 Joost Andrae 2005-11-10 09:56:11 UTC
JA: reset target to 2.0.2 because it is a regression
Comment 14 Frank Schönheit 2005-12-05 12:58:22 UTC
this is no real regression (see comments above), and not really fixable (dito).
=> "OOo Later"
Comment 15 kay.ramme 2007-06-18 11:27:18 UTC
IMHO, this belongs to the framework -> changed component.
Comment 16 Marcus 2017-05-20 11:31:44 UTC
Reset assigne to the default "".