I'm using SetAttributeString, SetAttributeBool, SetAttributeInt etc.. inside a type extended from wxPGProperty, doing 'SetAttribute...()' does nothing:
And the main usage of the SetValue method:
Also neither wxColourProperty.SetPropertyValueColour() nor wxColourProperty.GetValueAsColour() exist; but their type counterparts (Boolean, String, Integer, Double/Float) do exist.
Simple problem, just not implemented?
If you want to see it in action (or rather, not in action ;) run guitest.exe, click 'New Project' (from the menu or the toolbar), and select a gadget or panel.
Notice how only the color, in the property grid, changes according to the gadget/panel you select, that is because I am setting the value in the property grid (because wxColourProperty.GetValueAsColour() does not exist; if it did I would have a SetValue method for wxColourPropertyField), see above: Method UpdateProps()
http://files.filefront.com/wxdesigner+7+9+08+pre+azip/;10996491;/fileinfo.html
EDIT: Oh ya, I have a workaround for wxColourProperty.GetValueAsColour(); the second line in wxColourPropertyField.SetFieldValue:
EDIT: It wxPropertyGrid.Disable() and .Enable() work, but do not gray-out the area where the propertygrid is.. is that the correct behavior?
Type wxIntPropertyField Extends wxIntProperty Field m_PropertyField:TPropertyField Method SetValue(Gadget:fry_TGadget) SetAttributeInt("", m_PropertyField.m_Field.GetInt(Gadget)) End Method Method SetFieldValue(Gadget:fry_TGadget, Value:Int = -65535) If Value = -65535 Then Value = GetValueAsInt() m_PropertyField.m_Field.SetInt(Gadget, Value) End Method Function CreateProp:wxIntPropertyField(label:String = Null, Name:String = Null, Value:Int = 0, propfield:TPropertyField = Null) Local prop:wxIntPropertyField = wxIntPropertyField(New wxIntPropertyField.Create(label, Name, Value)) prop.m_PropertyField = propfield Return prop End Function End Type Type wxFloatPropertyField Extends wxDoubleProperty Field m_PropertyField:TPropertyField Method SetValue(Gadget:fry_TGadget) SetAttributeDouble("", m_PropertyField.m_Field.GetFloat(Gadget)) End Method Method SetFieldValue(Gadget:fry_TGadget, Value:Float = -65535.0) If Value = -65535.0 Then Value = Float(GetValueAsDouble()) m_PropertyField.m_Field.SetFloat(Gadget, Value) End Method Method AffixiateValue:Int(mn:Float, mx:Float) Local Value:Float = Float(GetValueAsDouble()), changed:Int = False If Value > mx Then Value = mx; changed = True If Value < mn Then Value = mn; changed = True If changed = True SetAttributeDouble("", Value) End If Return changed End Method Function CreateProp:wxFloatPropertyField(label:String = Null, Name:String = Null, Value:Double = 0, propfield:TPropertyField = Null) Local prop:wxFloatPropertyField = wxFloatPropertyField(New wxFloatPropertyField.Create(label, Name, Value)) prop.m_PropertyField = propfield Return prop End Function End Type Type wxColourPropertyField Extends wxColourProperty Field m_PropertyField:TPropertyField 'Method SetValue() 'End Method Method SetFieldValue(Gadget:fry_TGadget, Value:wxColour = Null) If Value = Null Then Value = GetGrid().GetPropertyValueAsColour(Self) Local fld:TField = m_PropertyField.m_Field, flddat:Object = fld.Get(Gadget), .. fldtype:TTypeId = fld.TypeId() fldtype.SetArrayElement(flddat, 0, String(Value.RED())) fldtype.SetArrayElement(flddat, 1, String(Value.Green())) fldtype.SetArrayElement(flddat, 2, String(Value.Blue())) End Method Function CreateProp:wxColourPropertyField(label:String = Null, Name:String = Null, Value:wxColour = Null, propfield:TPropertyField = Null) Local prop:wxColourPropertyField = wxColourPropertyField(New wxColourPropertyField.Create(label, Name, Value)) prop.m_PropertyField = propfield Return prop End Function End Type Type wxBoolPropertyField Extends wxBoolProperty Field m_PropertyField:TPropertyField Method SetValue(Gadget:fry_TGadget) SetAttributeBool("", m_PropertyField.m_Field.GetInt(Gadget)) End Method Method SetFieldValue(Gadget:fry_TGadget, Value:Int = -1) If Value = -1 Then Value = GetValueAsBool() m_PropertyField.m_Field.SetInt(Gadget, Value) End Method Function CreateProp:wxBoolPropertyField(label:String = Null, Name:String = Null, Value:Int = False, propfield:TPropertyField = Null) Local prop:wxBoolPropertyField = wxBoolPropertyField(New wxBoolPropertyField.Create(label, Name, Value)) prop.m_PropertyField = propfield Return prop End Function End Type Type wxStringPropertyField Extends wxStringProperty Field m_PropertyField:TPropertyField Method SetValue(Gadget:fry_TGadget) SetAttributeString("", m_PropertyField.m_Field.GetString(Gadget)) End Method Method SetFieldValue(Gadget:fry_TGadget, Value:String = Null) 'null = "" here as well :/ If Value = Null Then Value = GetValueAsString() m_PropertyField.m_Field.SetString(Gadget, Value) End Method Function CreateProp:wxStringPropertyField(label:String = Null, Name:String = Null, Value:String = Null, propfield:TPropertyField = Null) Local prop:wxStringPropertyField = wxStringPropertyField(New wxStringPropertyField.Create(label, Name, Value)) prop.m_PropertyField = propfield Return prop End Function End Type
And the main usage of the SetValue method:
Method UpdateProps() 'Local pnames:String[], pprops:wxPGProperty[] 'PropertiesToNames(pnames, pprops) 'RefreshDimensions() For Local prop:wxPGProperty = EachIn Gadget_Props 'Local i:Int = 0 To pnames.Length ' Local Name:String = pnames[i], prop:wxPGProperty = pprops[i] If wxIntPropertyField(prop) wxIntPropertyField(prop).SetValue(CurrentGadget) ElseIf wxFloatPropertyField(prop) wxFloatPropertyField(prop).SetValue(CurrentGadget) ElseIf wxStringPropertyField(prop) wxStringPropertyField(prop).SetValue(CurrentGadget) ElseIf wxColourPropertyField(prop) Local sprop:wxColourPropertyField = wxColourPropertyField(prop), wxc:wxColour Local fld:TField = sprop.m_PropertyField.m_Field, flddat:Object = fld.Get(CurrentGadget), .. fldtype:TTypeId = fld.TypeId() Local r:Int = Int(String(fldtype.GetArrayElement(flddat, 0))), .. g:Int = Int(String(fldtype.GetArrayElement(flddat, 1))), .. b:Int = Int(String(fldtype.GetArrayElement(flddat, 2))) wxc = wxColour.CreateColour(r, g, b) SetPropertyValueColour(sprop, wxc) 'cant do this from within a wxColourProperty object, report to Brucey ElseIf wxBoolPropertyField(prop) wxBoolPropertyField(prop).SetValue(CurrentGadget) EndIf Next End Method
Also neither wxColourProperty.SetPropertyValueColour() nor wxColourProperty.GetValueAsColour() exist; but their type counterparts (Boolean, String, Integer, Double/Float) do exist.
Simple problem, just not implemented?
If you want to see it in action (or rather, not in action ;) run guitest.exe, click 'New Project' (from the menu or the toolbar), and select a gadget or panel.
Notice how only the color, in the property grid, changes according to the gadget/panel you select, that is because I am setting the value in the property grid (because wxColourProperty.GetValueAsColour() does not exist; if it did I would have a SetValue method for wxColourPropertyField), see above: Method UpdateProps()
http://files.filefront.com/wxdesigner+7+9+08+pre+azip/;10996491;/fileinfo.html
EDIT: Oh ya, I have a workaround for wxColourProperty.GetValueAsColour(); the second line in wxColourPropertyField.SetFieldValue:
If Value = Null Then Value = GetGrid().GetPropertyValueAsColour(Self)
EDIT: It wxPropertyGrid.Disable() and .Enable() work, but do not gray-out the area where the propertygrid is.. is that the correct behavior?