Propgrid PropertiesToNames
BlitzMax Forums/Brucey's Modules/Propgrid PropertiesToNames
| ||
After doing..propgrid.PropertiesToNames(pnames, pprops) both pnames and pprops are null. I previously filled the propgrid with properties and they show up in my frame, is this function just not implemented? |
| ||
That's quite likely, as there's a bit of the API still to implement - it's a big control ! |
| ||
Ok.. I've changed the API a little, to make it more useful.Method NamesToProperties:wxPGProperty[](names:String[]) Method PropertiesToNames:String[](properties:wxPGProperty[]) both require an array as param, and return one. Also implemented GetPropertiesWithFlag() which can be used to retrieve an array of wxPGProperty. example : Local props:wxPGProperty[] = pg.GetPropertiesWithFlag(0) Local names:String[] = pg.PropertiesToNames(props) DebugLog names.length For Local s:String = EachIn names DebugLog s Next There are probably quite a lot of things still to do in there. Hopefully not so many of those three, which required a good chunk of C++ and calls back into BlitzMax... :o) |
| ||
Another, propgrid.Disable() and Enable() do not grey/ungrey the propgrid.' EDIT: Another.. if I create a category, and fill with properties, appending it to a propgrid does not show any of the category properties. Local cat_gadget:wxPropertyCategory = wxPropertyCategory(New wxPropertyCategory.Create("category", wxPG_LABEL)) '..create a prop and add it to the category Local prop:wxPGProperty = wxPGProperty(New(wxIntProperty.Create("propname", wxPG_LABEL, 0))) cat_gadget.AddChild(prop) 'add the category to the propgrid propgrid.Append(cat_gadget) 'nothing shows except the category and a plus sign (which does nothing) EDIT: And again.. wxEVT_PG_CHANGED nor wxEVT_PG_CHANGING are being emitted when I change values on a property (connecting via the propgrid and using the propgrid id). |
| ||
Categories...' nested categories Local cat_gadget:wxPropertyCategory = New wxPropertyCategory.Create("category", wxPG_LABEL) Local cat_gadget2:wxPropertyCategory = New wxPropertyCategory.Create("category2", wxPG_LABEL) '..create a prop and add it to the category Local prop1:wxPGProperty = wxPGProperty(New wxIntProperty.Create("propnameA", wxPG_LABEL, 0)) pg.AppendIn(cat_gadget, prop1) pg.AppendIn(cat_gadget, cat_gadget2) pg.AppendIn(cat_gadget2, wxPGProperty(New wxIntProperty.Create("propnameB", wxPG_LABEL, 0))) 'add the category to the propgrid pg.Append(cat_gadget) :-) |
| ||
Plash, I just added debuglog to the propgrid sample, for the Change and Changing events :Function OnPropertyGridChange( event:wxEvent ) DebugLog "Change!" End Function Function OnPropertyGridChanging( event:wxEvent ) DebugLog "Changing!" End Function and it outputs DebugLog:Changing! DebugLog:Change! when I try to focus out of a property I've edited. |
| ||
Yay! svn working fine now.. except the events, here's my code (I never receive any DebugLog messages, obviously): Type GadgetPropGrid Extends wxPropertyGrid Const ID_PropGrid:Int = 23052 '... Connect(ID_PropGrid, wxEVT_PG_CHANGED, _OnPropertyGridChanged) Connect(ID_PropGrid, wxEVT_PG_CHANGING, _OnPropertyGridChanging) 'The receiving methods.. Method OnPropertyGridChanging(event:wxPropertyGridEvent) DebugLog "prop changing" End Method Method OnPropertyGridChanged(event:wxPropertyGridEvent) DebugLog "prop changed" End Method 'Functions to make things simpler (while being complicated :P) Function _OnPropertyGridChanged(event:wxEvent) GadgetPropGrid(event.sink).OnPropertyGridChanged(wxPropertyGridEvent(event)) End Function Function _OnPropertyGridChanging(event:wxEvent) GadgetPropGrid(event.sink).OnPropertyGridChanging(wxPropertyGridEvent(event)) End Function I can't see why it wont work, EDIT: Get the debug messages just fine in the sample.. using enter and lost focus. |
| ||
Even connecting the events in my frame doesn't work (trying to copy the sample as much as possible).Connect(GadgetPropGrid.ID_PropGrid, wxEVT_PG_CHANGED, GadgetPropGrid._OnPropertyGridChanged) Connect(GadgetPropGrid.ID_PropGrid, wxEVT_PG_CHANGING, GadgetPropGrid._OnPropertyGridChanging) |
| ||
Would it change anything to connect via:Method OnInit() Connect(ID_PropGrid, wxEVT_PG_CHANGED, OnPropertyGridChanged) Connect(ID_PropGrid, wxEVT_PG_CHANGING, OnPropertyGridChanging) end Method instead of: Connect(GadgetPropGrid.ID_PropGrid, wxEVT_PG_CHANGED, GadgetPropGrid._OnPropertyGridChanged) Connect(GadgetPropGrid.ID_PropGrid, wxEVT_PG_CHANGING, GadgetPropGrid._OnPropertyGridChanging) Also, and more importantly: Function _OnPropertyGridChanging(event:wxEvent) GadgetPropGrid(event.sink).OnPropertyGridChanging(wxPropertyGridEvent(event)) End Function to Function _OnPropertyGridChanging(event:wxEvent) GadgetPropGrid(event.parent).OnPropertyGridChanging(wxPropertyGridEvent(event)) End Function event.sink -> event.parent? No clue whether that will help, but it's how i've done it and I haven't run into event problems like that. If it's not that, the only thing I could see causing the events to not show up is that you are not creating the grid with the id of 23052. You should have absolutely no problems if you use ConnectAny as well. |
| ||
Of course I was connecting the events in my OnInit method, I just wanted to keep things small in the post. I just used the event.sink thing from what wxCodeGen outputs (copied and changed, as it uses function->method). If it's not that, the only thing I could see causing the events to not show up is that you are not creating the grid with the id of 23052. Ah.. that's it! I got my adaption of ideas mixed up, citing the obvious sometimes helps! Thanks :) |
| ||
Yeah, again wxmax is amazing, but it's so so so so easy to screw something simple like that up. I keep running into similar mistakes too =P |
| ||
I think with better, smaller examples focused on specific issues it will be easier to see what's going on, and therefore be harder to head off down the wrong road. Btw, you should see the internals of the event handling stuff (that which glues the c++ with max)... makes my head spin. :-) |