Andrea Franco Posted February 2, 2021 Share Posted February 2, 2021 Hi, is it possible to simulate a click on a not visible TUnimFileUploadButton from the OnClick event of a TUnimLabel or TUnimButton? i.e. the user taps a label and the context menu of the device opens like the tap on the button of TUnimFileUploadButton. Thanks Andrea (we are using version 1.90.0.1531 - uniGUI Complete - Professional Edition) Link to comment Share on other sites More sharing options...
Sherzod Posted February 2, 2021 Share Posted February 2, 2021 Hi, 4 hours ago, Andrea Franco said: is it possible to simulate a click on a not visible TUnimFileUploadButton from the OnClick event of a TUnimLabel or TUnimButton? i.e. the user taps a label and the context menu of the device opens like the tap on the button of TUnimFileUploadButton. You can try to use this approach: procedure TMainmForm.UnimBitBtn1Click(Sender: TObject); begin UnimFileUploadButton1.JSInterface.JSCode(#1'.getFileButton().element.down("input").dom.click();'); end; Link to comment Share on other sites More sharing options...
Andrea Franco Posted February 3, 2021 Author Share Posted February 3, 2021 It works fine with Android/Chrome but not with Firefox and with iOS devices (both Chrome, Firefox ad Safari), can I do something else? Using the provided Browse... button on those devices works fine, but we need more flexibility in UI. I tried to inherit UnimFileUpload component overriding Execute method to customize the provided form but I'm always stuck with this kind of job, I can't simulate the click, if you can provide a solution for this it can be an alternative to the previous one. Thanks Andrea Link to comment Share on other sites More sharing options...
Sherzod Posted February 3, 2021 Share Posted February 3, 2021 So what's not to like with TUnimFileUploadButton? Link to comment Share on other sites More sharing options...
55143681 Posted February 6, 2021 Share Posted February 6, 2021 On 2/3/2021 at 1:18 AM, Sherzod said: Hi, You can try to use this approach: procedure TMainmForm.UnimBitBtn1Click(Sender: TObject); begin UnimFileUploadButton1.JSInterface.JSCode(#1'.getFileButton().element.down("input").dom.click();'); end; for cbuilder: void __fastcall TMainmForm::UnimBitBtn1Click(TObject *Sender) { UnimFileUploadButton1->JSInterface->JSCode(UnimFileUploadButton1->JSName+".getFileButton().element.down(\"input\").dom.click();"); } Link to comment Share on other sites More sharing options...
Recommended Posts