TkEntityProperty editorClass

Thread is closed for posting
2 posts, 0 answers
  1. Ryan
    Ryan avatar
    39 posts
    Member since:
    Jun 2016

    Posted 11 Apr 2017 Link to this post

    Currently if a TKEntityProperty for the dataform is set for read only with TKEntityPropertyTypeString the dataform uses un-editable TKTextFields to display the data. Is there an editorClass for the TKEntityProperty where I can have UILabels being displayed instead? I want the data form to use UILabels because I have an objective-c category for UILabels that allows me to add copy to pasteboard functionality for labels. I need these values displayed to be copyable.
  2. Todor
    Todor avatar
    798 posts

    Posted 12 Apr 2017 Link to this post

    Hello Ryan,

    Thank you for writing. Indeed having UILabels to display the property value when in read only mode is a nice suggestion. I have logged it in our feedback portal. Currently, as we don't have such editor, you can use the TKDataFormCustomEditor, which allows you to choose the type of UIView that is used as editor:

    _dataSource[@"propertyName"].editorClass = [TKDataFormCustomEditor class];

    Then in the setupEditor method of the TKDataFormDelegate you can assign a delegate to the editor:

    -(void)dataForm:(TKDataForm *)dataForm setupEditor:(TKDataFormEditor *)editor forProperty:(TKEntityProperty *)property
        if ([ isEqualToString:@"propertyName"]) {
            TKDataFormCustomEditor* customEditor = (TKDataFormCustomEditor*)editor;
            customEditor.delegate = self;

    And provide an UILabel as UIView in the proper TKDataFormCustomEditorDelegate methods:

    -(UIView *)editorWillCreateView:(TKDataFormCustomEditor *)editor
        UILabel* label = [[UILabel alloc] init];
        return label;
    -(NSObject *)editorWillReturnValue:(TKDataFormCustomEditor *)editor editorView:(UIView *)view
        return ((UILabel*)view).text;
    -(void)editor:(TKDataFormCustomEditor *)editor shouldApplyValue:(NSObject *)value editorView:(UIView *)view
        ((UILabel*)view).text = (NSString*)value;

    Let us know if you need further assistance.

    P.S. I have updated your Telerik points for the given suggestion. Thank you!

    Telerik by Progress
    Want to build beautiful Android apps as well? Check out UI for Android which enables the same set of scenarios, allowing you to create the same great app experience on both iOS and Android.
Back to Top