Ricardo 1 Posted April 26, 2018 Report Share Posted April 26, 2018 Hi. If I insert a TW3Button and assign it an event (by double clicking on OnClick in the object inspector) the onClick event is not triggered by clicking with the mouse or with the finger on the mobile. If I set the focus on the button and press Enter it will fire. I've also tried assigning it to an onclick event in InitializebOject What do I need to add? Quote Link to post Share on other sites
Czar 125 Posted April 26, 2018 Report Share Posted April 26, 2018 I have not had this problem. I tend to set click events in code because the IDE is buggy. In quick projects I do set the event by double clicking but I haven't come across this problem. Ricardo 1 Quote Link to post Share on other sites
Ricardo 1 Posted April 27, 2018 Author Report Share Posted April 27, 2018 Hi. I have entered the error. If you declare a FLayout in private and then add this in Resize: FLayout.Resize (Self); the buttons can not be pressed with the mouse or with your finger. Solution: Add on form Activete: FLayout: = Layout.Client (Layout.Margins (3) .Spacing (3), [ Layout.Top (W3Label1), ... ]); FLayout.Resize (Self); and, in Resize if assigned (FLayout) then FLayout.Resize (Self); I do not know if it is an bug or ignorance on my part. Quote Link to post Share on other sites
IElite 280 Posted April 27, 2018 Report Share Posted April 27, 2018 This works for me unit Form1; interface uses System.Types, System.Types.Convert, System.Objects, System.Time, SmartCL.System, SmartCL.Time, SmartCL.Graphics, SmartCL.Components, SmartCL.FileUtils, SmartCL.Forms, SmartCL.Fonts, SmartCL.Theme, SmartCL.Borders, SmartCL.Application, SmartCL.Layout, SmartCL.Controls.Label, SmartCL.Controls.Button; type TForm1 = class(TW3Form) private {$I 'Form1:intf'} fLayout: TLayout; fLabel: TW3Label; fButton: TW3Button; protected procedure HandleButtonClick(Sender: TObject); procedure InitializeForm; override; procedure InitializeObject; override; procedure Resize; override; end; implementation { TForm1 } procedure TForm1.HandleButtonClick; begin ShowMessage('Click!'); end; procedure TForm1.InitializeForm; begin inherited; // this is a good place to initialize components end; procedure TForm1.InitializeObject; begin inherited; {$I 'Form1:impl'} fLabel:= TW3Label.Create(Self); fLabel.Caption:= 'Click Example'; fLabel.AlignText:= taCenter; fButton:= TW3Button.Create(Self); fButton.Caption:= 'Click Me'; fButton.OnClick:= HandleButtonClick; fLayout:= Layout.Client([Layout.Top(Layout.Height(32), fLabel), Layout.Bottom(Layout.Height(32), fButton)]); end; procedure TForm1.Resize; begin inherited; if Assigned(fLayout) then fLayout.Resize(self); end; initialization Forms.RegisterForm({$I %FILE%}, TForm1); end. Ricardo and lynkfs 2 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.