Jump to content

COMFIED

Members
  • Content Count

    87
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by COMFIED

  1. I am try to clean up a JSON string from

    {"v":"this is sample text"}

    with the aim of obtaining the text value:

    this is sample text

     

    I have tried JSON.parse as follows, but it doesn't seem to work

    string_value := JSON.parse('"'+string_value+'"'); 

     

    What is the correct way of doing this?

  2. Another code security question - is there a way of detecting if the files in the \res folder have been modified?

    How can I access timestamps, files size and other parameters of graphics and html resource files?

  3. I am trying to integrate PayPal payment buttons using the script below via W3DIVHtmlElement.InnerHTML

    The app fails to run when I embed the script. How can I can use the PayPal script in the app?

     

    <div id="paypal-button-container"></div>
    <script src="https://www.paypal.com/sdk/js?client-id=XXXYYYZZZ&currency=USD" data-sdk-integration-source="button-factory"></script>
    <script>
      paypal.Buttons({
          style: {
              shape: 'rect',
              color: 'gold',
              layout: 'vertical',
              label: 'pay',
              
          },
          createOrder: function(data, actions) {
              return actions.order.create({
                  purchase_units: [{
                      amount: {
                          value: '30'
                      }
                  }]
              });
          },
          onApprove: function(data, actions) {
              return actions.order.capture().then(function(details) {
                  alert('Transaction completed by ' + details.payer.name.given_name + '!');
              });
          }
      }).render('#paypal-button-container');
    </script>
     

  4. I am trying to create a web app (to be wrapped using phonegap into android app) that needs permissions enabled.

    On load, the app should check and prompt the user to enable android permissions for sending SMS android.permission.SEND_SMS

    and enable access of camera within the app android.permission.CAMERA.

    How can I do that using smart mobile studio?

  5. 25 minutes ago, COMFIED said:

    I have a W3IFrameHTMLElement with content that contains URL links.

    Is there a way to format the URL links in W3IFrameHTMLElement content so that I can click on them and access within the web app?

    Another way of asking the same question: Can I pass parameters via URL without reloading the web app?

  6. This works and copies text to clipboard

         browserapi.document.designMode := 'on';
         asm
             navigator.clipboard.writeText("copy this text");
         end;
     

    I'm still unable to introduce a string variable from label or input box to replace "copy this text" - Any idea how I can do that?

  7. Any help on how I can click a label/ text to copy to clipboard?

    Here is my code, but its not working.

    procedure TForm1.W3Label1Click(Sender: TObject);
    begin

         W3Label1.Caption:= '<id="ACC">1234';

       var document.getElementById('ACC');
        copyText.select();
        document.execCommand('copy');
        ShowMessage("Copied the text: " + copyText.value);
    end;

     

  8. I have built a web app using smart mobile studio and compiled to android APK on phonegap.

    I'm trying to get the android back button to read a variable and either perform an action in the app or terminate the app.

    The code below minimizes/ hides the android app, but doesn't terminate it.  How can I introduce a variable onBackKeyDown event and prevent app from minimizing?

     

    Here is my code:

     

    procedure TForm1.onDeviceReady;
    begin
      receivedEvent('deviceready');
    end;

     

    procedure TForm1.bindEvents;
    begin
         document.addEventListener('deviceready', onDeviceReady, false);

         asm
          document.addEventListener("backbutton", onBackKeyDown, false);
          function onBackKeyDown(e) {
          e.preventDefault();
    }
         end;
    ...more code...

     

    procedure TForm1.InitializeForm;
    begin
      inherited;
       // this is a good place to initialize components

       bindEvents;
    ...more code...

  9. I am storing and retrieving emoji in UTF16 format on a MySQL database.

    When I retrieve, i get the data results

    "\ud83d\ude0a" for smile emoji (😊)
    "\ud83e\udd37\u200d\u2640" (for🤷‍♀️)

    Is there a simple way to convert the UTF16 to unicode and render the emoji on a browser?

     

×
×
  • Create New...