Jump to content

Custom Property Inspector for a certain type


Recommended Posts

See my iphone-style-toggle-switch This is an experimental pure smart component. 


What I am trying to accomplish is edit the value of the property directly in Property Object Inspector in SMS,

 


How can I implement my own custom property editor for of a certain object type (inherits from base TW3CustomControl)?

Any idea?

 

PROPERTY INSPECTOR

=============================

btnToggle: TButtonSwitch

_____________________________

Properties    | Events

-----------------------------

AlphaBlend      : True

Angle               : 0

BorderRadius  : 5

Caption            : onToggle

Color                : $000000

Enabled           : True

Height              : 25

Left                  : 200

Name               : btnToggle

Opacity            : 255

StyleClass        :

TagValue         : 0

Top                  : 176

Transparent    : False

Visible             : True

Width              : 110

Zoom              : 1

------------------------------

Default             : ON

Disabled          : False

Checked          : True

Tranking          : False

StyleClass        : [iOS, Android, Material] --> a dropdown menu to select the item

 

Link to post
Share on other sites
  • Moderators

I haven't checked but was under the impression that specifying properties like in TW3Memo

 

  published
    property  Text: String read getText write setText;
 
added these properties to the property inspector of that component
 
Not ?
 
Like your component by the way
Link to post
Share on other sites

Thanks for replying.

 

This is actually my real problem,  let's suppose that we are writing a nice smart component iphone-style-toggle-switch this component have a published property named "CustomStyle". The user fills it with the style name. The predefined values should be 'iOS', 'Android', 'Material'. The user would be able to choose one of them, from the drop-down list.

For instance, if the user choose 'Material' from the list, the Material CSS style should be applied to the component.

type
   TCustomStyle = array[1..3] of string;

const
   CustomStyle : TCustomStyle = ('iOS','Android','Material');

type
  TMystyle  = (cssIOS, cssAndroid, cssMaterial);

TToggleComponent = class(TW3CustomControl)
  private
    fMyStyle: TMystyle;
    fCustomStyle : TCustomStyle;
  published
    property Mystyle: TMystyle Read fMyStyle Write fMyStyle default cssAndroid;
    property CustomStyle: TCustomStyle Read fCustomStyle Write fCustomStyle;

In my tests, when I see at Object Inspector the property MyStyle : 0 (set to zero?). For the boolean type it shows the dropdown list.

 

How can I create  a property of type String that will show a combo box in the object inspector with  a predefined set of values the 
user could choose.

 

I know it is possible. I just don't know how! 
Any help will be appreciated. 

See you soon, 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...