-----Original Message-----
From: wx-users...@lists.wxwidgets.org
[mailto:wx-users...@lists.wxwidgets.org] On Behalf Of Leto Atreides
Sent: Sunday, February 15, 2009 2:32 PM
To: wx-u...@lists.wxwidgets.org
Subject: wxMac cosmetic oddities?
I have noticed two things in wxMac that make my UI look ugly and was
wondering if anyone has better suggestions to work around these.
Firstly is the wxColourPicker widget. Normally on wxGTK and wxMSW,
this is a button with a rectangle on it that shows the current
selected color. In wxMac its a button, with an ugly colored rectangle
background (see picture).
Second is when I change the background color of a wxTextField it wont
change it immediately (not talking about RTF styles, just background
color), it only changes it if I give the text field focus, or if I
append text to it. The append text method (which is my current work
around), still leaves a small portion of the wxTextfield the original
color (until it gets focus)
I have attached images showing the both oddities, now in the second
case, I dont need a wxTextfield, I need more like a label with a
border that I can change the background and text color, but the label
widget from what I have seen doesnt work with the border flags, any
ideas?
*** eSafe scanned this email for malicious content ***
*** IMPORTANT: Do not open attachments from unrecognized senders ***
> I have attached images showing the both oddities, now in the second
> case, I dont need a wxTextfield, I need more like a label with a
> border that I can change the background and text color, but the label
> widget from what I have seen doesnt work with the border flags, any
> ideas?
you mean you currently call SetBackgroundColour, then you could call a
Refresh after, this should fix the missing update
and wxStaticText does not show borders for you ? on OSX only ?
Best,
Stefan
> About the color picker, there's no carbon-specific implementation; on
> Mac, the generic implementation is used, and is indeed ugly. We wrote
> our own implementation for Carbon, I'll be happy to share it as is
Couldn't you just put the raw code as a "nearly-a-patch" on Trac?
Robert
Firstly is the wxColourPicker widget. Normally on wxGTK and wxMSW,
this is a button with a rectangle on it that shows the current
selected color. In wxMac its a button, with an ugly colored rectangle
background (see picture).
Second is when I change the background color of a wxTextField it wont
change it immediately (not talking about RTF styles, just background
color), it only changes it if I give the text field focus, or if I
append text to it. The append text method (which is my current work
around), still leaves a small portion of the wxTextfield the original
color (until it gets focus)
I have attached images showing the both oddities, now in the second
Yoav Gonen wrote:
Robert
_______________________________________________
wx-users mailing list
wx-u...@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wx-users
ok, reproduced, under 10.4 things work as expected (when using the system
option mac.textcontrol-use-mlte is set aas 1, as otherwise the unicode
textcontrol is used which doesn't support background colour), but under 10.5
there is a stuck refresh somewhere in the system, as event when the toplevel
window is moved it gets refreshed correctly, I'll try to find a workaround)
Thanks,
Stefan
using a 10.4+ API with weak reference works for me, change in textctrl.cpp
the wxMacMLTEHIViewControl::SetBackground to:
void wxMacMLTEHIViewControl::SetBackground( const wxBrush &brush )
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OSX_VERSION_10_4
if (HITextViewSetBackgroundColor != NULL)
{
RGBColor col = MAC_WXCOLORREF(brush.GetColour().GetPixel()) ;
float component[4] ;
component[0] = col.red / 65536.0 ;
component[1] = col.green / 65536.0 ;
component[2] = col.blue / 65536.0 ;
component[3] = 1.0 ; // alpha
CGColorRef color = CGColorCreate( wxMacGetGenericRGBColorSpace() ,
component );
HITextViewSetBackgroundColor( m_textView , color );
}
else
#endif
{
wxMacMLTEControl::SetBackground( brush ) ;
}
}
Thanks,
Stefan
> CGColorRef color = CGColorCreate( wxMacGetGenericRGBColorSpace() ,
> component );
> HITextViewSetBackgroundColor( m_textView , color );
add a
CGColorRelease(color);
please, HITextViewSetBackgroundColor retains the color
Thanks,
Stefan
I do refresh and it works on wxMSW and wxGTK but not on wxMac.
>> and wxStaticText does not show borders for you ? on OSX only ?
They dont on wxGTK for me, I havent tried on wxMac, since I need a
fairly universal solution.
On Sun, Feb 15, 2009 at 12:55 PM, Stefan Csomor
<cso...@advancedconcepts.ch> wrote:
> Hi Leto
>
>> I have attached images showing the both oddities, now in the second
>> case, I dont need a wxTextfield, I need more like a label with a
>> border that I can change the background and text color, but the label
>> widget from what I have seen doesnt work with the border flags, any
>> ideas?
>
>
> and wxStaticText does not show borders for you ? on OSX only ?
>
> Best,
>
> Stefan
>
>
>
> _______________________________________________
> wx-users mailing list
> wx-u...@lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wx-users
>
--
If you make something that any idiot can use, only idiots will use it.
When it should have been
MAC_OS_X_VERSION_10_4
Other than that, it works great.
Is there anyway you can get the color picker code from Yoav Gonen and
integrate it into wxMac?
On 16.02.09 19:34, "Leto Atreides" <thedevi...@gmail.com> wrote:
> Thank you that works perfectly, though you had a typo in the posted
> code, you said
> MAC_OSX_VERSION_10_4
>
> When it should have been
> MAC_OS_X_VERSION_10_4
oops, sorry and thanks for spotting it ...
> Is there anyway you can get the color picker code from Yoav Gonen and
> integrate it into wxMac?
as I assume other platforms might get into similar problems (native controls
not allowing background change), I'll try to add an option to the generic
control picker, this option would derive from a bitmap button instead of a
button and carries the colour + label as a bitmap
Best,
Stefan
As it wouldnt compile with that typo, I am sure you already noticed
it, otherwise you wouldnt have known the fix worked, I just wanted
anyone searching the lists to be aware of that small typo so they can
get it to work too.
> as I assume other platforms might get into similar problems (native
> controls
> not allowing background change), I'll try to add an option to the
> generic
> control picker, this option would derive from a bitmap button
> instead of a
> button and carries the colour + label as a bitmap
That would be the ideal solution, thanks. If you manage it without
too many modifications to the existing code, if you would post the
changes here so that I can retro fit 2.8.9, as you have done with your
other fixes, that would be appreciated. If it becomes too complex,
then I can just wait for the 2.8.10 release, since its not a critical
need.
>> Is there anyway you can get the color picker code from Yoav Gonen and
>> integrate it into wxMac?
>
> as I assume other platforms might get into similar problems (native controls
> not allowing background change), I'll try to add an option to the generic
> control picker, this option would derive from a bitmap button instead of a
> button and carries the colour + label as a bitmap
I've committed a variant to clrpickerg.cpp and .h, as r58967 to use a bitmap
button set
wxCLRBTN_USES_BMP_BUTTON to 1 when building
Best,
Stefan
On 17.02.09 09:39, "Leto Atreides" <thedevi...@gmail.com> wrote:
>> oops, sorry and thanks for spotting it ...
>
> As it wouldnt compile with that typo, I am sure you already noticed
> it, otherwise you wouldnt have known the fix worked, I just wanted
> anyone searching the lists to be aware of that small typo so they can
> get it to work too.
it just compiled fine using xcode for me, resolved to empty, and thus the
condition still triggered, only when building against 10.3 SDK (where it
still would trigger) it would have lead to a compile error, as there the
function wouldn't be known.. it isn't the first time such a preproc problem
has happened to me, but last time it took me a long time staring at the code
until I realized what was really happening
Best,
Stefan