Unexpected problems

Workarounds and usability notes.

Unexpected problems

Postby John Robin Dove » Sun Jul 23, 2017 11:16 am

Hi Clifton,

I'm still struggling on with my overloaded program but less frequently these days. After a gap of several weeks I was surprised to see a number of problems which did not exist previously. Could the latest Powerpac update(s) be the cause? I'm not suggestimg you change anything because my excessive amounts of code are probably also to blame.

snapObjectToCenter

The code below in a JS file used to work but now it doesn't:

Code: Select all
function tbfunction_showPad(progFolder, timeAllowed) {
tbfunction_pgTBObjSet("pad", "height", 362);
var barWidth = tbfunction_pgTBObjGet("bar", "width");
tbfunction_pgTBObjSet("textDisplay", "width", barWidth);
var isVisible = tbfunction_pgTBObjGet("teacherPad", "visible");
    if (isVisible == false)
    {
    tbfunction_pgTBObjSet("pad", "visible", true);
    tbfunction_pgGotoURL("pad", progFolder + "/video/CKE/pad/pad.html");
    }
    else                                                             
    {
    tbfunction_pgTBObjSet("menu", "visible", true);
    tbfunction_pgTBObjSet("teacherPad", "text", "");
    tbfunction_pgTBObjSet("pad", "visible", true);
    }
tbfunction_snapObjectToCenter("container", "page");
tbfunction_pgTBObjSet("shield", "visible", true);
tbfunction_pgTBObjSet("container", "visible", true);
tbfunction_pgTBObjSet("myGroup", "visible", true);
timeAllowed = timeAllowed * 1
    if (timeAllowed > 0)
    {
    var lapseS = tbfunction_pgDateFormat(timeAllowed, "isoTime");
    lapseS = lapseS.substring(3, 8);
    tbfunction_pgTBObjSet("writingCounter", "text", lapseS);
    tbfunction_pgTimer(true, 1000, "writingCounter");
    tbfunction_pgTBObjSet("timedWriting", "visible", true);
    tbfunction_pgTimer(false, timeAllowed, "hideStart");
    }
};


There are no messages. The code is simply not executed and the program stops.

I can cure it with this workaround:

Code: Select all
tbfunction_pgTBObjSet("container", "left", 233);
tbfunction_pgTBObjSet("container", "top", 103);


By the way, correct me if I'm wrong but your help text seems to suggest that quotes are required around the dimensions in pixels. This doesn't work for me.

Image

Another thing that used to work but now doesn't is pgGotoURL. The program (1 page) has a lot of things to load. It used to do the various loading procedures in this order:

XMLHttpRequest loads appropriate captions etc. in appropriate language from XML file
pgExtFiles loads a CSS file
pgGotoURL is then used 7 times to load various components 3 of which are TB DHTML files

The last file triggers an object in the main window which completes the loading process by loading a video file and using XMLHttpRequest to load an "instructions" txt file and another XML file is read which completes the final setting up of the page. The last item is almost certainly in the wrong place!

Despite the multiple tasks involved this used to load everything as planned although the TB files seemed to get loaded twice. I use an animated gif to indicate the loading time which works well however long the loading period is. You could probably advise me on the order in which I should do these tasks but why did it use to work but not now? The 3 TB files seem to get loaded because the trigger is sent from the last one. However when I make their containing fields visible all 3 are empty!?

To test that pgGotoURL is not hapenning or maybe happening and then getting cancelled I can make everything work by reloading the TB files from a Click.

One other new problem is a field into which I place an image somehow gets a text '0'. This is not difficult to correct but it never happened before.

Any thoughts please?

Regards John
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: Unexpected problems

Postby Clifton » Sun Jul 23, 2017 2:45 pm

John Robin Dove wrote:Hi Clifton,

I'm still struggling on with my overloaded program but less frequently these days. After a gap of several weeks I was surprised to see a number of problems which did not exist previously. Could the latest Powerpac update(s) be the cause? I'm not suggestimg you change anything because my excessive amounts of code are probably also to blame.

snapObjectToCenter

The code below in a JS file used to work but now it doesn't:

Code: Select all
function tbfunction_showPad(progFolder, timeAllowed) {
tbfunction_pgTBObjSet("pad", "height", 362);
var barWidth = tbfunction_pgTBObjGet("bar", "width");
tbfunction_pgTBObjSet("textDisplay", "width", barWidth);
var isVisible = tbfunction_pgTBObjGet("teacherPad", "visible");
    if (isVisible == false)
    {
    tbfunction_pgTBObjSet("pad", "visible", true);
    tbfunction_pgGotoURL("pad", progFolder + "/video/CKE/pad/pad.html");
    }
    else                                                             
    {
    tbfunction_pgTBObjSet("menu", "visible", true);
    tbfunction_pgTBObjSet("teacherPad", "text", "");
    tbfunction_pgTBObjSet("pad", "visible", true);
    }
tbfunction_snapObjectToCenter("container", "page");
tbfunction_pgTBObjSet("shield", "visible", true);
tbfunction_pgTBObjSet("container", "visible", true);
tbfunction_pgTBObjSet("myGroup", "visible", true);
timeAllowed = timeAllowed * 1
    if (timeAllowed > 0)
    {
    var lapseS = tbfunction_pgDateFormat(timeAllowed, "isoTime");
    lapseS = lapseS.substring(3, 8);
    tbfunction_pgTBObjSet("writingCounter", "text", lapseS);
    tbfunction_pgTimer(true, 1000, "writingCounter");
    tbfunction_pgTBObjSet("timedWriting", "visible", true);
    tbfunction_pgTimer(false, timeAllowed, "hideStart");
    }
};



Hi John,
Just to be sure, I ran a snapObjectToCenter() test with the same parameters you are using in your code and it still works as documented and expected. I ran the test in TB 11.5 and v9.01 just to be sure.


John Robin Dove wrote:
There are no messages. The code is simply not executed and the program stops.

I can cure it with this workaround:

Code: Select all
tbfunction_pgTBObjSet("container", "left", 233);
tbfunction_pgTBObjSet("container", "top", 103);


By the way, correct me if I'm wrong but your help text seems to suggest that quotes are required around the dimensions in pixels. This doesn't work for me.



Hi John,
Also ran this test and my test works with both quoted or non-quoted integers. Since pgTBObjSet() accepts myProperty="position" it takes a quoted stack of integers like "233,103"


John Robin Dove wrote:
Image

Another thing that used to work but now doesn't is pgGotoURL. The program (1 page) has a lot of things to load. It used to do the various loading procedures in this order:

XMLHttpRequest loads appropriate captions etc. in appropriate language from XML file
pgExtFiles loads a CSS file
pgGotoURL is then used 7 times to load various components 3 of which are TB DHTML files

The last file triggers an object in the main window which completes the loading process by loading a video file and using XMLHttpRequest to load an "instructions" txt file and another XML file is read which completes the final setting up of the page. The last item is almost certainly in the wrong place!

Despite the multiple tasks involved this used to load everything as planned although the TB files seemed to get loaded twice. I use an animated gif to indicate the loading time which works well however long the loading period is. You could probably advise me on the order in which I should do these tasks but why did it use to work but not now? The 3 TB files seem to get loaded because the trigger is sent from the last one. However when I make their containing fields visible all 3 are empty!?

To test that pgGotoURL is not hapenning or maybe happening and then getting cancelled I can make everything work by reloading the TB files from a Click.

One other new problem is a field into which I place an image somehow gets a text '0'. This is not difficult to correct but it never happened before.

Any thoughts please?

Regards John


Hi John,
Not sure what to say about pgGotoURL(). Not much has changed with this function. However, you do indicate that you are using it to load several other TB DHTML apps. Make sure to load that from the basic index.html launch file rather than trying to match a browser folder. Several revisions ago, the renaming of folders was changed somewhat (e.g.: "firefox#" used to be renamed to "ff" and now it is "fe" as this folder is compatible with with firefox and generally all HTML5 versions of IE and Edge). You might want to take a look at revision #96 which affected pgGotoURL(). Perhaps this revision is causing a problem in your application and if so, we would want to look into that.
https://www.pgsoftwaretools.com/forum/viewtopic.php?f=9&t=223

Hope this helps.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: Unexpected problems

Postby John Robin Dove » Mon Jul 24, 2017 4:12 am

Hi Clifton,

Thanks for your replies. I too have made numerous test apps in which the functions all appear to work normally. I've just tried running the program on Chrome instead of Fiorefox but this makes no difference. Here is how I use pgGoToURL

I get the location of my programs like this :

Image

then load like this:

Image

Is that correct?
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: Unexpected problems

Postby Clifton » Mon Jul 24, 2017 4:31 am

Please insert an action to check this value:
Display Alert: progFolder

Let us know what output you receive.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: Unexpected problems

Postby John Robin Dove » Mon Jul 24, 2017 4:59 am

John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: Unexpected problems

Postby Clifton » Mon Jul 24, 2017 5:20 am

What server is serving "http://localhost/...?"
If you are using the internal PowerPac content server, it is serving content on port 8282 and your localhost will fail unless it is specified as:
"http://localhost:8282/programs"

If you are using a program like XAMPP as your localhost application, then this should work as long as the /programs folder is populated with all the necessary content.

If in the end, all the content will be served from a single folder, I would recommend using a relative folder location as this will be more fool-proof when you go to the web and it should work in any test scenario on your local hard drive.
So try . . . (it should work regardless of where the content is being tested from)
"../programs"
instead of . . .
"http://localhost/programs"
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: Unexpected problems

Postby John Robin Dove » Mon Jul 24, 2017 5:37 am

I am using XAMMP. I don't think the progFolder variable is an issue because all the non-Toolbook content seems to get loaded. I am changing the order in which things are loaded. I'll let you know what happens.
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: Unexpected problems

Postby John Robin Dove » Mon Jul 24, 2017 6:13 am

The good news: I have changed the order in which things are loaded and now everything seems to work as planned. It's true I should have done this earlier as it was pretty incoherent to say the least but until yesterday it worked.

However there are 2 small problems still to solve: my workaround no longer works! there's still a zero character appearing in a field after a picture is added.

Image

Image

The pad group that contains a CKE pad loaded via pgGotoURL. It contains a draggable transparent field which allows the user to move it around the page. The showPad function is supposed to reset it to its initial position but the lines that reset the position stop execution.
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: Unexpected problems

Postby Clifton » Mon Jul 24, 2017 6:30 am

Complicated reset operations like this may require a delay before some parts of the function fire:
Code: Select all
function showPad(params) {
    //... do so reset stuff

    var fct = function() {
        //...stuff that should be delayed a bit
    };
    setTimeout( fct, [delay]); //try using a long delay to ensure it works (e.g.: 2000); then shorten it until it works but does not delay too long
};


This is a technique I use quite often and is the reason why delay mechanisms are built into many PowerPac functions.
  
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: Unexpected problems

Postby John Robin Dove » Mon Jul 24, 2017 10:21 am

Thanks Clifton,
Your system is working. Is my syntax correct, please?

Code: Select all
function tbfunction_showPad(progFolder, timeAllowed) {
tbfunction_pgTBObjSet("pad", "height", 362);
var barWidth = tbfunction_pgTBObjGet("bar", "width");
tbfunction_pgTBObjSet("textDisplay", "width", barWidth);
var isVisible = tbfunction_pgTBObjGet("teacherPad", "visible");
    if (isVisible == false)
    {
    tbfunction_pgTBObjSet("pad", "visible", true);
    tbfunction_pgGotoURL("pad", progFolder + "/video/CKE/pad/pad.html");
    }
    else                                                             
    {
    tbfunction_pgTBObjSet("menu", "visible", true);
    tbfunction_pgTBObjSet("teacherPad", "text", "");
    tbfunction_pgTBObjSet("pad", "visible", true);
    }

  var fct = function () {
  tbfunction_pgTBObjSet("container", "left", 233);
  tbfunction_pgTBObjSet("container", "top", 103);
  tbfunction_pgTBObjSet("shield", "visible", true);
  tbfunction_pgTBObjSet("container", "visible", true);
  tbfunction_pgTBObjSet("myGroup", "visible", true);
  timeAllowed = timeAllowed * 1
    if (timeAllowed > 0)
    {
    var lapseS = tbfunction_pgDateFormat(timeAllowed, "isoTime");
    lapseS = lapseS.substring(3, 8);
    tbfunction_pgTBObjSet("writingCounter", "text", lapseS);
    tbfunction_pgTimer(true, 1000, "writingCounter");
    tbfunction_pgTBObjSet("timedWriting", "visible", true);
    tbfunction_pgTimer(false, timeAllowed, "hideStart");
    }
  }
  setTimeout( fct, [200]);
};
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron