Jump to content

A Suggestion


RobYost

Recommended Posts

This is not a complaint  I am very happy with UniGUI, BUT

it seems there are many times I get on the support forum and ask how to do something and the answer is I have to do it in JavaScript.

 

DelphiDeveloper goes to the trouble to answer the question

 

for example:

 

Hi,

 

Can you try this approach for now ?!:

 

UnimLabel1 -> ClientEvents -> UniEvents -> function afterCreate:

function afterCreate(sender)
{
    var me = sender;
    me.element.on("tap",
        function() {
            me.fireEvent("click");
        }
    )
}

Best regards,

 

 
But really wouldn't it have been easier for everyone if he just added this code to the constructor of UnimCustomLabel?
 
 
I changed the constructor, and it works (just as a test, I know it will go away next release.
constructor TUnimCustomLabel.Create(AOwner: TComponent);
begin
  inherited;
  Width  := 225;
  Height := 23;

  ClientEvents.UniEvents.Add
    ('afterCreate=function afterCreate(sender) '#13#10'{'#13#10'    var me = sender;'#13#10'    me.element.on("tap",'#13#10'        function() {'#13#10'               me.fireEvent("click");'#13#10'        }'#13#10'    )'#13#10'}');

end;

This is just an example.  The font properties are ignored on mLable.  I added the code DelphiDeveloper supplied to the Update function and it also works.  

 

It just seems to me it would be just as easy to add this functionality than it would be to send me JS code to fix it, then you won't be asked that question again because I see people (including me) ask the same question again.

 
  • Upvote 2
Link to comment
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...