molla2005b Posted September 1, 2019 Share Posted September 1, 2019 hi I want to have a button only to capture photo by camera using TUnimFileUploadButton change button caption to "Take Photo" to directly open camera and hide LabelField and FileNameEditBox of UnimFileUploadButton Thanks And regards. 4856a216-f18b-44f8-8a6c-ce7252c9f62e.jfif Link to comment Share on other sites More sharing options...
Sherzod Posted September 1, 2019 Share Posted September 1, 2019 32 minutes ago, molla2005b said: and hide LabelField and FileNameEditBox of UnimFileUploadButton Hi, One possible solution: procedure TMainmForm.UnimFormCreate(Sender: TObject); begin UnimFileUploadButton1.JSInterface.JSAddListener('added', 'function(sender){if (sender.labelElement){sender.labelElement.hide()}; if (sender.inputElement) {sender.inputElement.hide()}}'); end; Link to comment Share on other sites More sharing options...
molla2005b Posted September 1, 2019 Author Share Posted September 1, 2019 thank you very much now I need to change button caption and width to fit the parent(unimContainer) Link to comment Share on other sites More sharing options...
Sherzod Posted September 1, 2019 Share Posted September 1, 2019 24 minutes ago, molla2005b said: now I need to change button caption and width to fit the parent(unimContainer) procedure TMainmForm.UnimFormCreate(Sender: TObject); begin UnimFileUploadButton1.JSInterface.JSAddListener('added', 'function(sender){if (sender.labelElement){sender.labelElement.hide()}; if (sender.inputElement) {sender.inputElement.hide()}; fbtn=sender.getFileButton(); if (fbtn) {fbtn.setText("newText"); fbtn.setWidth(sender.getWidth())};}'); end; Link to comment Share on other sites More sharing options...
molla2005b Posted September 1, 2019 Author Share Posted September 1, 2019 thank for your help width not set but i fix it by this approach with btnTakePhoto.JSInterface do begin JSConfig('border', ['false']); JSConfig('centered', ['true']); end; It would be great if we had buttonOnly option Link to comment Share on other sites More sharing options...
Fábio Matte Posted February 5, 2021 Share Posted February 5, 2021 On 9/1/2019 at 8:01 AM, molla2005b said: thank for your help width not set but i fix it by this approach with btnTakePhoto.JSInterface do begin JSConfig('border', ['false']); JSConfig('centered', ['true']); end; It would be great if we had buttonOnly option Good morning, where did you use this code? I tried here, but it didn't work. Disregard, i managed to solve on account, OnCreate in Form or Frame: with UnimFileUploadButton1.JSInterface do begin JSAddListener('added', 'function(sender){if (sender.labelElement){sender.labelElement.hide()}; if (sender.inputElement) {sender.inputElement.hide()}}'); JSAddListener('change', 'function(sender){getOrientation(sender.getFiles()[0], function(orientation) {ajaxRequest(sender, "getOrientation", ["orientation="+orientation])})}'); JSConfig('border', ['false']); JSConfig('centered', ['true']); end; Link to comment Share on other sites More sharing options...
55143681 Posted February 6, 2021 Share Posted February 6, 2021 16 hours ago, Fábio Matte said: Good morning, where did you use this code? I tried here, but it didn't work. Disregard, i managed to solve on account, OnCreate in Form or Frame: with UnimFileUploadButton1.JSInterface do begin JSAddListener('added', 'function(sender){if (sender.labelElement){sender.labelElement.hide()}; if (sender.inputElement) {sender.inputElement.hide()}}'); JSAddListener('change', 'function(sender){getOrientation(sender.getFiles()[0], function(orientation) {ajaxRequest(sender, "getOrientation", ["orientation="+orientation])})}'); JSConfig('border', ['false']); JSConfig('centered', ['true']); end; with cbuilder works well: UnimFileUploadButton1->JSInterface->JSAddListener("added", "function(sender){if (sender.labelElement){sender.labelElement.hide()}; if (sender.inputElement) {sender.inputElement.hide()}; fbtn=sender.getFileButton(); if (fbtn) {fbtn.setText(\"newText\"); fbtn.setWidth(sender.getWidth())};}"); with delphi works well: UnimFileUploadButton1.JSInterface.JSAddListener('added', 'function(sender){if (sender.labelElement){sender.labelElement.hide()}; if (sender.inputElement) {sender.inputElement.hide()}; fbtn=sender.getFileButton(); if (fbtn) {fbtn.setText("newText"); fbtn.setWidth(sender.getWidth())};}'); Link to comment Share on other sites More sharing options...
Fábio Matte Posted April 22, 2021 Share Posted April 22, 2021 On 2/6/2021 at 1:10 AM, 55143681 said: with cbuilder works well: UnimFileUploadButton1->JSInterface->JSAddListener("added", "function(sender){if (sender.labelElement){sender.labelElement.hide()}; if (sender.inputElement) {sender.inputElement.hide()}; fbtn=sender.getFileButton(); if (fbtn) {fbtn.setText(\"newText\"); fbtn.setWidth(sender.getWidth())};}"); with delphi works well: UnimFileUploadButton1.JSInterface.JSAddListener('added', 'function(sender){if (sender.labelElement){sender.labelElement.hide()}; if (sender.inputElement) {sender.inputElement.hide()}; fbtn=sender.getFileButton(); if (fbtn) {fbtn.setText("newText"); fbtn.setWidth(sender.getWidth())};}'); Thank you friend, It was even better using this code that you put here. It cost !!! Link to comment Share on other sites More sharing options...
Recommended Posts