XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently April 17th, 2025, 10:28 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: February 6th, 2018, 7:01 am 
Offline
User avatar

Joined: July 29th, 2013, 9:13 am
Posts: 609
There is a bug in Xwidgets that causes the evaluation of boolean conditional statements to process incorrectly. True or False are both ignored.

Javascript in general uses boolean values of zero (0) and one (1) to represent true or false. You can use if () {} statements to probe the values:

Code:
  if (playlistFrame.visible === false) {
   mediaPlayerHelp.visible = true;
  }

  if (playlistFrame.visible === 0) { // also false
   mediaPlayerHelp.visible = 1;
  }


Note: Any non-zero value (1, 2, 3, 4, -1) will also evaluate as TRUE.

If the visibility of an object is set in the Xwidget IDE using the radio button then it should be possible to test the visibility in Microsoft's (Xwidget's) jscript:

Code:
  if (playlistFrame.visible === false) {} ;
  if (playlistFrame.visible === true) {} ;


These should be valid, however, in Xwidget, checking to see if a value is true or false will result in an incorrect response:

Code:
  //if (playlistFrame.visible === false) {  FAILS
  //if (playlistFrame.visible == "0") {  works
  //if (playlistFrame.visible == 0) {  works
  //if (playlistFrame.visible === 0) {  works

  //if (playlistFrame.visible === true) {  FAILS
  //if (playlistFrame.visible == "-1") {  works
  //if (playlistFrame.visible == -1) {  works
  //if (playlistFrame.visible === -1) {  works


Javascript typically uses boolean values 1 or 0 as boolean whereas Xwidget uses 0 or -1, this is not really an issue as any non-zero value (1, 2, 3, 4) should also evaluate as true. However, this is not the case with Xwidget and only a numeric value of -1 (minus one) indicates a true value. This is against standard practice with javascript.

In addition, and much, much worse, there is a bug in Xwidgets (or Jscript) that means even a value of "true" is NOT valid:

Code:
  if (playlistFrame.visible === true) {  FAILS


This is crazy!

You will have to replace all your conditional statements that check for true or false with 0 or -1.

Code:
 if (playlistFrame.visible === -1) {  works


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group