delagoutte Posted February 11, 2020 Share Posted February 11, 2020 is it possible to have an item menu that is a TUniFileUploadButton ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 12, 2020 Share Posted February 12, 2020 18 hours ago, delagoutte said: is it possible to have an item menu that is a TUniFileUploadButton ? 1. UniHiddenPanel1 -> UniFileUploadButton1 2. procedure TMainForm.UniFormReady(Sender: TObject); begin with UniFileUploadButton1 do JSInterface.JSAddListener('click', 'function(){'+ JSName +'.extractFileInput().click()}', YourUniMenuItem.JSMenuItem); end; Quote Link to comment Share on other sites More sharing options...
delagoutte Posted February 12, 2020 Author Share Posted February 12, 2020 big thanks. just a little problem, there seem to have a bug. if you have the UniFileUploadButton1 in a UniHiddenPanel then the property "filter" of the UniFileUploadButton1 don't work. if you don't use hiddenpanel and you set UniFileUploadButton1.visible = false it works. Quote Link to comment Share on other sites More sharing options...
delagoutte Posted February 12, 2020 Author Share Posted February 12, 2020 hum , there is a big problem with this method. the explorer file is opened but we don't enter in the method onCompleted. on network, with the unifileuploadbutton we can see HandleEvent?Evt=upload&IsEvent=1&Obj=O253&fileno=0&filename=WEB-02-2015.WEXD&filetype=&filesize=23104&_S_ID=dbeajsdOzW105819AAB after i select the file. but with the menu item there is no call to the server after the file is selected Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 12, 2020 Share Posted February 12, 2020 3 hours ago, delagoutte said: if you have the UniFileUploadButton1 in a UniHiddenPanel then the property "filter" of the UniFileUploadButton1 don't work. 1 hour ago, delagoutte said: but with the menu item there is no call to the server after the file is selected OK, 1. Don't use UniHiddenPanel... 2. UniFileUploadButton.Visible = False 3. procedure TMainForm.UniFormReady(Sender: TObject); begin with UniFileUploadButton1 do JSInterface.JSAddListener('click', 'function(){'+ JSName +'.fileInputEl.dom.click()}', YourUniMenuItem.JSMenuItem); end; Quote Link to comment Share on other sites More sharing options...
delagoutte Posted February 12, 2020 Author Share Posted February 12, 2020 thanks a lot Quote Link to comment Share on other sites More sharing options...
crystian Posted March 24, 2020 Share Posted March 24, 2020 On 2/12/2020 at 8:02 AM, Sherzod said: OK, 1. Don't use UniHiddenPanel... 2. UniFileUploadButton.Visible = False 3. procedure TMainForm.UniFormReady(Sender: TObject); begin with UniFileUploadButton1 do JSInterface.JSAddListener('click', 'function(){'+ JSName +'.fileInputEl.dom.click()}', YourUniMenuItem.JSMenuItem); end; hi Sherzod i have a similar question, i want call that fileuploadbutton event from a cell click on unidbgrid (i tried a click from a action colum but, i have no sucess) i try like with UniFileUploadButton1 do JSInterface.JSAddListener('click', 'function(){'+ JSName +'.extractFileInput().click()}', UniDBGrid1.Columns[0].ActionColumn.Buttons.Items[0].JSMenuItem); u know how i have success with this case ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 24, 2020 Share Posted March 24, 2020 38 minutes ago, crystian said: hi Sherzod i have a similar question, i want call that fileuploadbutton event from a cell click on unidbgrid (i tried a click from a action colum but, i have no sucess) i try like Hi Crystian, Simply use OnColumnActionClick event: procedure TMainForm.UniDBGrid1ColumnActionClick(Column: TUniDBGridColumn; ButtonId: Integer); begin case ButtonId of ... 3 : begin UniFileUploadButton1.JSInterface.JSCall('extractFileInput().click', []); end; end; end; Quote Link to comment Share on other sites More sharing options...
crystian Posted March 24, 2020 Share Posted March 24, 2020 Ty @Sherzod you the best! Quote Link to comment Share on other sites More sharing options...
crystian Posted March 24, 2020 Share Posted March 24, 2020 5 hours ago, Sherzod said: Hi Crystian, Simply use OnColumnActionClick event: procedure TMainForm.UniDBGrid1ColumnActionClick(Column: TUniDBGridColumn; ButtonId: Integer); begin case ButtonId of ... 3 : begin UniFileUploadButton1.JSInterface.JSCall('extractFileInput().click', []); end; end; end; when i use this method, not activated event from onCompleted how i can call for active a event OnCompleted after i selected my file Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 25, 2020 Share Posted March 25, 2020 Ok, I will check. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 25, 2020 Share Posted March 25, 2020 6 hours ago, crystian said: when i use this method, not activated event from onCompleted Do you use UniHiddenPanel? Quote Link to comment Share on other sites More sharing options...
crystian Posted March 25, 2020 Share Posted March 25, 2020 8 hours ago, Sherzod said: Do you use UniHiddenPanel? no, im my cenario is one unidbgrid with some tunipanels for control design Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 25, 2020 Share Posted March 25, 2020 Can you try this? procedure TMainForm.UniDBGrid1ColumnActionClick(Column: TUniDBGridColumn; ButtonId: Integer); begin case ButtonId of ... 3 : begin UniFileUploadButton1.JSInterface.JSCall('fileInputEl.dom.click', []); end; end; end; Quote Link to comment Share on other sites More sharing options...
crystian Posted March 25, 2020 Share Posted March 25, 2020 39 minutes ago, Sherzod said: Can you try this? procedure TMainForm.UniDBGrid1ColumnActionClick(Column: TUniDBGridColumn; ButtonId: Integer); begin case ButtonId of ... 3 : begin UniFileUploadButton1.JSInterface.JSCall('fileInputEl.dom.click', []); end; end; end; Worked Perfectly !! ty Quote Link to comment Share on other sites More sharing options...
Fábio Matte Posted March 29, 2022 Share Posted March 29, 2022 On 3/25/2020 at 8:29 AM, Sherzod said: Can you try this? procedure TMainForm.UniDBGrid1ColumnActionClick(Column: TUniDBGridColumn; ButtonId: Integer); begin case ButtonId of ... 3 : begin UniFileUploadButton1.JSInterface.JSCall('fileInputEl.dom.click', []); end; end; end; Is Perfectly . Quote Link to comment Share on other sites More sharing options...
PS1 Posted August 25 Share Posted August 25 What about mobile version of this. How can i do it with UnimFileUploadButton ? UniFileUploadButton1.JSInterface.JSCall('fileInputEl.dom.click', []); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 25 Share Posted August 25 Hello, I will check. 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 25 Share Posted August 25 Try this approach: Quote Link to comment Share on other sites More sharing options...
PS1 Posted August 25 Share Posted August 25 It works ! Thanks for the fast response. 1 Quote Link to comment Share on other sites More sharing options...
PS1 Posted October 12 Share Posted October 12 @Sherzod But this solution doesn't work on IOS system. If i click, nothing happens. Can you provide solution for IOS too? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 12 Share Posted October 12 9 hours ago, PS1 said: But this solution doesn't work on IOS system. If i click, nothing happens. Hello, I think I've encountered this before and the solution was simple. I couldn't remember the solution at the moment... Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 12 Share Posted October 12 10 hours ago, PS1 said: But this solution doesn't work on IOS system. If i click, nothing happens. Can you try this code too? UnimFileUploadButton1.JSInterface.JSCode(#1'.element.query("#ext-filebutton-1 input")[0].click();'); Quote Link to comment Share on other sites More sharing options...
PS1 Posted October 13 Share Posted October 13 Sadly this is not working 😕 Still it is working on android only. Quote Link to comment Share on other sites More sharing options...
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.