Jump to content


Photo

A Suggestion


  • Please log in to reply
No replies to this topic

#1 RobYost

RobYost

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 175 posts
  • LocationFlorida, USA

Posted 12 November 2017 - 05:23 PM

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.

 

  • 2

http://unigui.mirahe.../wiki/Main_Page

Please add any utilities you think are useful. I will try to keep the wiki organized.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users