Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Major Problems with the Chrome Helper Commands.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Major Problems with the Chrome Helper Commands.

    I have several old desktop applications using xDialog that I am updating to incorporate Bootstrap 5.3 as a replacement to the standard xDialog user interface. So far the aesthetics and performance using Bootstrap are amazing. Unfortunately, tying the UI and custom javascript functions back to the older dialog buttons and functions has been a challenge. Enough so that I am questioning whether or not the cp helper functions really work in a more complex HTML environment. Specifically the cp.ExecuteJavascriptResult(jstorun) function. I have spent approx 20 hours trying to debug the possible source of my conflict with this function to no avail. My questions for the community and everything I have done to troubleshoot are listed below.

    Specific problem (one of many):
    Code:
    jstorun = "document.getElementById('myCheckboxId').checked;" 
    resultA = cp.ExecuteJavascriptResult(jstorun)    '===> hangs then fails in my app.  Works in test environment
    jstorun = "document.getElementById(myCheckboxId').hasAttribute('checked');"
    resultB = cp.ExecuteJavascriptResult(jstorun)     '===> hangs then fails in my app.  Works in test environment​
    
    'Alt Code
    resultA = cp.GetAttribute('myCheckboxId', "checked")  '===> hangs then fails in my app.  Fails in test environment so anyone can reproduce
    resultB = cp.HasAttribute('myCheckboxId', "checked")  '===> hangs then fails in my app.  Fails in test environment so anyone can reproduce
    Questions for the Community:
    1. Has anyone used the Chrome Control within an xDialog within the last 2 years to build an application? If so, did you run into any problems using the cp.ExecuteJavascriptResult(jstorun)​ function or anything else using the cp pointer? I am interested in any insight or knowledge gained from your issues.
    2. From a logic standpoint, is there anything else that I should try to identify the issue? I listed the primary methods performed below. If I included them all I would have to publish a book.
    3. Is it even possible for the HTML code itself to cause a problem with the CP functions?
    Troubleshooting Steps:
    1. In a test environment where the function was successful, I included all of the css and javascript files that are in my application. Test environment still successful less all of the HTML from my application.
    2. In my application, removed all of the css and javascript files but it still did not work.
    3. Inspected my HTML code using WebStorm application and no issues were found.
    4. Tried every alt method available under CP to no avail.
    5. Did not use HTML_Page_Prepare() function so I do not need to worry about any jQuery or Alpha Anywhere javascript conflicts.
    6. I can not imagine that any of my xBasic code is causing an issue.
    Thanks,
    James

    #2
    The way I do it with Chrome Control is to use DOM for storing values and pass values between javascript and xbasic. So I use cp.GetValue and cp.SetValue in xbasic and I fire events from javascript and from html button and I use xDialogEvent function to fire then xbasic events. And so xbasic and javascript talk with values stored in DOM. I use hidden fields for this purpose. So actually I save variables to them. This works fine because user will never see the DOM which is not case in web application.

    So for example this way I pass value to xbasic from javascript event:

    Code:
    document.getElementById("instanceid").value = editedInstace;
    xdialogEvent('delrec', editedInstace);

    Comment


      #3
      kkfin, thanks for the response. I do it the same way except I prefer a JavaScript object for storing values. I also use the windows variable space if it is strictly desktop.

      My issue is this, I can set the value of an input using cp.setValue('id', value) but calling cp.getValue('id') on the next line hangs and returns nothing. Same thing if I set the value using JavaScript and cp.executeJavascript(js) and try to return the result using JavaScript and cp.executeJavascriptResult(js). Have you ever had any time when you had problems using the cp functions that were not due to the asyncrenous nature of JavaScript? I have not until now and it is driving me crazy. I have already ruled out another js file which leaves me with an issue with the HTML. How would it be possible that the HTML markup is causing this issue? It does not make sense to me.
      Thanks,
      James

      Comment


        #4
        I did a quick test.
        I do not have problem with cp.executeJavascriptResult(js) and cp.executeJavascript(js) but with cp.SetValue and cp.GetValue on the next line I do. But it does not hang. I did solve this using cp.GetValue twice. I did the test with simple text input. But for example cp.hasElement was always false whatever I did do…

        Comment


          #5
          kkfin, I started re-writing my application to see if I could figure out what is breaking the get portion of the CP helper. Right after I declared all of my test variables that prove that CP does work, I broke it. I think I now have enough to submit a bug report. If you want to see if you can obtain the same results, I have attached a simple function you can import and run. To break, do the following:
          1. Import the attached function and execute.
          2. You will see a bunch of test buttons at the bottom that execute CP functions.
          3. Using the buttons, set the value of the checkbox and then get the value of the checkbox.
          4. Immediately following this, get the value of the window var. It should return "undefined" but instead it returns a type error.
          5. Close the function and open again.
          6. As soon as it opens, get the value of the window var again. Everything works.
          7. Immediately following this, get the value of the checkbox. It returns a type error.
          If I had to bet, there is probably some old alpha JavaScript that is still using var and the global namespace when it needs to be changed to either const or let. Whenever it runs a type check, it is returning the result from the previous check.
          Attached Files
          Thanks,
          James

          Comment


            #6
            Resolved. Whenever you need to push data from from the chrome control back to xDialog/xBasic so you can take immediate action, do the following:

            Chrome Side:
            HTML Code:
            <button id="myButton" onclick="myJsFunction()">My Button</button>
            
            <script>
            function myJsFunction() {
               ...manipulate some data...
               Const myVar = my data converted to text
               xdEvent("eventName:" + myVar)
            }
            
            function xdEvent(eventName) {
                const client = new XMLHttpRequest();
                client.open('GET', 'a5xdialog:' + eventName, false);
                client.setRequestHeader('My-Custom-Header', 'Some Value');
                client.send();
                console.log('xdEvent triggered');
            }​
            </script>
            xDialog Side:
            Code:
            dlg_event = <<%code%
            
            if atc("eventName:", a_dlg_button) = 1 then
               dim myData as C = word(a_dlg_button, 2, ":", 9999999)
               ...manipulate the data using xBasic...
            
            end if
            %code%
            This will keep you from making the mistake of trying to access the CP document while you are still within the xdEvent callback which will continue as long as your xDialog function has not completed.
            Thanks,
            James

            Comment

            Working...
            X