XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 10th, 2025, 8:46 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Help with Round Corners.
PostPosted: September 10th, 2012, 2:32 am 
Offline
User avatar

Joined: August 18th, 2012, 4:08 pm
Posts: 101
Location: Oradea, Bihor, Romania
Is there a way to check/uncheck the round corners via script? An example would be:
Code:
function widgetOnLoad()
{
  backboard_small.Corner.Corners.BottomLeft.Checked = true;
  backboard_small.Corner.Corners.BottomRight.Checked = true;
}


Thanks in advance.

_________________
" Homosexuality exists in 450 species. Homophobia is found in only one. Which seems unnatural now?
Image


Top
 Profile  
 
PostPosted: September 10th, 2012, 3:53 am 
Offline
User avatar

Joined: August 29th, 2012, 2:34 am
Posts: 56
Well i have to admit that was a challenge, i had to go back 4 the old school stuff and learn over again bit-wise operations 8-) , and it was totally worth it (Help me with one of the game im witting now)

Shortly use this function to convert 4 Boolean to an integer.
Code:
/** Written by vlad. Contact me for question or help at http://4ybak47.deviantart.com/
convertCornersToInt( [topleft] , [topright] , [buttonleft] , [buttonright] ).

Example : object.Corner.Corners = convertCornersToInt(true,true,false,false);*/
function convertCornersToInt(tl,tr,bl,br)
{
    return tl | tr << 1 | bl << 2 | br << 3;
}



If you wish some explanations here is my code while i was testing the function above. 8-)
Code:

//print(true << 2);
//convertCornersToInt(true,true,true,true);
//print(convertCornersToInt(true,false,false,false));

//Works!!!
////widgetContainer.Corner.Corners =  convertCornersToInt(false,true,false,true);





/** Written by vlad. Contact me for question or help at http://4ybak47.deviantart.com/

**function usage Example :

//Curve only the top two corners.
object.Corner.Corners = convertCornersToInt(true,true,false,false);

**Variables:
//tl - topleft       : Boolean [true / false]
//tr - topright      : Boolean [true / false]
//bl - buttonleft    : Boolean [true / false]
//br - buttonright   : Boolean [true / false]
*/
function convertCornersToInt(tl,tr,bl,br)
{
         //obj.Corner.Corners = "topleft,topright,buttonleft,buttonright";
         //printBinary(4);
         //printBinary(15);

         // var b = true;
         //printBinary(b ? 1 : 0);

         //printBinary(cb2i(true));

         //printBinary(tl);

         // tl = 1,   tl << 1 = 10,     tl << 2 = 100,     tl << 3 = 1000
         //printBinary(cb2i(tl) << 2);

     return tl | tr << 1 | bl << 2 | br << 3;
}
//Usage : check the binary value of the number n.
function printBinary(n)
{
    print("~~~~~~~~~~~~~~~~~~~");
    print("   Binary ( " + parseInt(n).toString(2) + " )");
    print("   Number ( " + parseInt(n).toString() + " )");
    print("   Value  ( " + n.toString() + " )");
    print("~~~~~~printBinary~~~~~~");
}
//Convert boolean to int / binary [1,0]
function cb2i(bool)
{
    return bool ? 1 : 0;
}

_________________
Image


Top
 Profile  
 
PostPosted: September 10th, 2012, 3:58 am 
Offline
User avatar

Joined: August 18th, 2012, 4:08 pm
Posts: 101
Location: Oradea, Bihor, Romania
Wow. Thanks dude. It helped me a lot O_O I could've never figure this out on my own -_-

_________________
" Homosexuality exists in 450 species. Homophobia is found in only one. Which seems unnatural now?
Image


Top
 Profile  
 
PostPosted: September 11th, 2012, 3:14 am 
Offline
User avatar

Joined: June 10th, 2012, 5:57 am
Posts: 313
Code:
backboard_small.Corner.Corners =0(disable corner)
                               =1(TopLeft)
                               =2(TopRight)
                               =3(TopLeft + TopRight)
                               =4(BottomLeft)
                               ......
                               =7(TopLeft + TopRight +BottomLeft)
                               =8(BottomRight)
                               ......
                               =15(TopLeft + TopRight +BottomLeft + BottomRight)


Top
 Profile  
 
PostPosted: September 11th, 2012, 3:30 am 
Offline
User avatar

Joined: August 18th, 2012, 4:08 pm
Posts: 101
Location: Oradea, Bihor, Romania
Thanks qiancang but the script vlad gave me seems easier to use and less likely to bug.

_________________
" Homosexuality exists in 450 species. Homophobia is found in only one. Which seems unnatural now?
Image


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

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 21 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