XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 10th, 2025, 1:37 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Curiosity: ESC key
PostPosted: July 23rd, 2014, 7:43 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
I was thinking...
We can control a layer (hide-fade out) using the "ESC" key..? Like many pc programs that use esc to close a window.
I make a full screen widget and I'm wondering if I can use the "ESC" to hide/fade out the layer, instead of use the click on function using a ΧW "button"..

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
 Post subject: Re: Curiosity: ESC key
PostPosted: July 23rd, 2014, 1:10 pm 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
it's easy,

you just need to:
1. Enable "Can Focused" on the object that you want to get the keypress
//it's in "other" section of "properties" of any object
2. add the function below to the [OnKeyUp]/[OnKeyDown] event of object that you make "can focus" enabled for it

the code for this:
Code:
function layer1OnKeyDown(Sender,Key,KeyChar,Shift)
{
   if(Key==27)
   {
      //write what you want to be done inside this if
      layer1.Visible=0 
   }
}


Notes:
1. keynumber:27 is the esc key
2. you can use:
> OnKeyDown Event: to make the function work when the key is pressed down
> OnKeyUp Event: to make the function work when the key gets up


Top
 Profile  
 
 Post subject: Re: Curiosity: ESC key
PostPosted: July 23rd, 2014, 1:24 pm 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
Thanks a lot man!!! I will test it after finish my full screen weather widget... :)

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
 Post subject: Re: Curiosity: ESC key
PostPosted: July 23rd, 2014, 1:51 pm 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
Tested hamid but doesn't work.. :?
What I'm doing wrong...

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
 Post subject: Re: Curiosity: ESC key
PostPosted: July 23rd, 2014, 2:34 pm 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
problems:
1. first of all, you add an extra } at the end of script
2. your layer that you make "can focused" enabled is in back of other objects, so it can't be focused
3. your "main" Image Object is on the top of all of the objects, so if you want to make focus you can use this object for it, not the layer that behind them


also remember that:
to make mouse focus [for layers]:
it should be visible to be clickable (it means you need a color for it to make it available for mouse)
you can make a clickable layer transparent by making its alpha to 1%


here's the example:
Attachment:
weather_pro_full_screen [test2].xwp [710.3 KiB]
Downloaded 401 times


Top
 Profile  
 
 Post subject: Re: Curiosity: ESC key
PostPosted: July 23rd, 2014, 3:23 pm 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
1. I fixed the script..
Quote:
2. your layer that you make "can focused" enabled is in back of other objects, so it can't be focused
3. your "main" Image Object is on the top of all of the objects, so if you want to make focus you can use this object for it, not the layer that behind them

2,3. Strange..since there is only ONE single layer on top and inside it all the objects. The logical thing is that the designer should recognize it as the top object and using this script had to hide all the elements inside it... :|

But even with alpha 1% what the utility of the "mouse focus" for layer, since after we add objects inside, the layer is not recognized as "top" and at the end doesn't work..??

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
 Post subject: Re: Curiosity: ESC key
PostPosted: July 23rd, 2014, 3:26 pm 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
Quote:
here's the example:
Attachment:
weather_pro_full_screen [test2].xwp [710.3 KiB]

But only assigning the function to the "main" image worked..?! :shock:
I did the same thing 5 min ago and didn't work... wt..?
Anyway.. I'm going to bed and I leave you in peace.. It's 1:30 am here..
Thanks a bunch for all your help and time! :)

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
 Post subject: Re: Curiosity: ESC key
PostPosted: July 23rd, 2014, 3:35 pm 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
1. the child objects will be on the top of parent object
> this means when you put objects inside another, those objects will be on the top of that object

2. it is not needed to focus the layer you want to get invisible,
you should focus one object to make the function execute (that object that will call the function should be on the top),
the function will do the job and it doesn't matter what it does (it can hide other objects,...)


Top
 Profile  
 
 Post subject: Re: Curiosity: ESC key
PostPosted: July 24th, 2014, 4:24 pm 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
Here is the final widget using the esc function: :D
viewtopic.php?f=11&t=4846

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


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

All times are UTC - 8 hours


Who is online

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

Powered by phpBB® Forum Software © phpBB Group