wxColour - Getting details from a named colour
BlitzMax Forums/Brucey's Modules/wxColour - Getting details from a named colour
| ||
Local tp:wxColour = New wxColour.Create( 0, 0, 0 ) tp.SetAsNamedColour( "GREY" ) Print tp.Red() Print tp.GetAsString( wxC2S_HTML_SYNTAX ) End I'm trying to retrieve the component r,g,b values from the "GREY" named colour, but am getting back nothing. I tried this as well: Local tp:wxColour = New wxColour.CreateNamedColour( "GREY" ) Print tp.Red() print tp.GetAsString( wxC2S_HTML_SYNTAX ) End Still nothing... What am I doing wrong here? |
| ||
Hmmm. This works - but there's not a wxGrey() defined so I guess that's no help!Local tp:wxColour = wxRED() Print tp.Red() Print tp.Green() Print tp.Blue() [edit] but there is a wxLIGHT_GREY()! |
| ||
Thanks for the help. The wxRED() works as you said, but when I tried the wxLIGHT_GREY() instead of wxRED() that returns 0's. Theoretically this should work as I use the following line in my program: AuiManager.GetArtProvider().SetColour( wxAUI_DOCKART_BACKGROUND_COLOUR, New wxColour.CreateNamedColour( "LIGHT GREY" ) ) and this sets the colour to "LIGHT GREY" correctly. I can't seem to get the r,g,b values of this "LIGHT GREY" though, no matter what I try. I'm probably screeching at the monitor and pounding the keyboard with bananas again though. |
| ||
Really? When I do this:Print wxLIGHT_GREY().Red() Print wxLIGHT_GREY().Green() Print wxLIGHT_GREY().Blue() I get: 192 192 192 |
| ||
This works : SuperStrict Framework wx.wxApp Import BRL.StandardIO New MyApp.Run() Type MyApp Extends wxApp Method OnInit:Int() Local tp:wxColour = New wxColour.CreateNamedColour( "GREY" ) Print "ok : " + tp.IsOK() Print tp.Red() Print tp.Green() Print tp.Blue() Return False End Method End Type This doesn't : Framework wx.wxApp Import BRL.StandardIO Local tp:wxColour = New wxColour.CreateNamedColour( "GREY" ) Print "ok : " + tp.IsOK() Print tp.Red() Print tp.Green() Print tp.Blue() wxWidgets requires to be initialised properly, which is usually done through the wxApp instance. It's a bit like how, under-the-hood, BlitzMax kicks off with it's own internal initialization routines - which you don't usually see unless you are hacking with the modules. |
| ||
Okay, thx Brucey. That works. I understand now. Thanks for all the help DavidDC. I gotta get another coffee. |
| ||
When wxApp OnInit() returns True, you are actually running inside wxWidget's main-loop. At this point, your wxMax application is completely event-driven. There is a sample for running your on main-loop, which requires more management on your end (like ensuring events are passed through etc). |
| ||
I am using the wxApp OnInit() in my program, but I was doing this test at the beginning outside of that loop. I'll remember next time. Thx:) |