XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 10th, 2025, 2:38 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 17 posts ] 
Author Message
 Post subject: open locked shortcut?
PostPosted: February 2nd, 2014, 4:22 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
Guys, I have two png files of a safe. At the beginning I wanted to create a RB, but then I had this "crazy" idea:
Is possible to create with a script a locked folder / shortcut???

Here is my thought:
1) layer 1:png file 1-safe closed. When click on, it will show up a txt box (we can use "edit"component for this), then the user must write a certain 4 digits for example number (the default will be 0000 where the user can edit it later through the script).
2) after write the code-press Enter, will appear the layer 2, png file 2-safe open, where there will be a shortcut component of a folder or file..

What do you think? Someone crazy like me can help me?? :D

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


Top
 Profile  
 
PostPosted: February 2nd, 2014, 8:21 pm 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
so what's the problem?
i don't know any way to lock a file in xwidget
but if you want to just hide it visually (and not for security) it's easy


Top
 Profile  
 
PostPosted: February 2nd, 2014, 8:49 pm 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
I'm thinking a way hamid, that somehow the layer2 will appear only when the input text have the same value of the text in the script..
I don't know if I'm clear.. (read my first post and to understand better...)
There is a script for this..? :?

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


Top
 Profile  
 
PostPosted: February 2nd, 2014, 10:21 pm 
Offline

Joined: June 18th, 2012, 12:07 am
Posts: 268
So you want script that asks for a password when a button is clicked, then do something to a file or folder.
What exactly do you want to do to the file or folder ?
Which a file or a folder ?
Just hide it as hamid wrote ?
Or lock it so it can not be opened ?
After you open or un hide the file or folder how will it re hide or re lock ?


Top
 Profile  
 
PostPosted: February 2nd, 2014, 10:26 pm 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
to switch between layers:
you can do one of these:
1. Enabling and disabling visiblity of Objects:
-show the Objects you want using: [layer2.Visible=1]
-hide the objects you don't want using: [layer1.Visible=0]
2. Fliping the Object:
-use [flipObject(layer1,layer2,"")]
3. Fliping the widget
-add sides for the widget (rightClick the widget in treeView and select AddSides)
-add layer1 to FrontSide and layer2 to BackSide
-flip the widget using [widget.cmd("!Flip")]

===========
to input and check the text in editbox you can use this code:
(replace comment section with your code for changing layers)
(don't forget to add [edit1OnKeyDown] in [OnKeyDown] of function tab for edit1)
Code:
pass="1234"
function edit1OnKeyDown(Sender,Key,KeyChar,Shift)
{
  if(Key==13)
  {
    if(edit1.Text==pass)
    {
      showTrayBalloon("unlocked","5")
      edit1.Visible=0
      //use you code here to show layer2; here are some examples:
      //ex: layer2.Visible=1;
      //ex2: flipObject(layer1,layer2,"")
      //ex3: widget.cmd("!Flip")
    }
    edit1.Text=""
  }
}

===========
to limit the input to 4 character you can use this code:
(don't forget to add [edit1OnChange] in [OnChange] of function tab for edit1)
Code:
function edit1OnChange(Sender)
{
  if(edit1.Text.length>4)
  {
    edit1.Text=edit1.Text.slice(0,4)
  }
}

=============
to enable only digit input:
you can use [Filter Char>Integer] in the Attribute tab of Inspector


Top
 Profile  
 
PostPosted: February 2nd, 2014, 10:54 pm 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
i think he want it just for fun
to just have a view of a safe with pass code

it couldn't be used as a security; because:
1. anyone can open the script and see the password and even change the password
2. anyone can open the script and change the script to access the other layer
3. anyone can open the script and widget files to see what you hide


Top
 Profile  
 
PostPosted: February 3rd, 2014, 5:09 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
hamid wrote:
i think he want it just for fun
to just have a view of a safe with pass code

it couldn't be used as a security; because:
1. anyone can open the script and see the password and even change the password
2. anyone can open the script and change the script to access the other layer
3. anyone can open the script and widget files to see what you hide

I know all this hamid.. Surely it will be not a real security widget, but just a little "different" widget.. Only who has installed this on his/her computer will know the trick! :)

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


Top
 Profile  
 
PostPosted: February 3rd, 2014, 5:32 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
meme wrote:
So you want script that asks for a password when a button is clicked, then do something to a file or folder.
What exactly do you want to do to the file or folder ?
Which a file or a folder ?
Just hide it as hamid wrote ?
Or lock it so it can not be opened ?
After you open or un hide the file or folder how will it re hide or re lock ?

Here is my thought meme (and hamid):
1) I have these two pngs: (there is no text on them)

Image Image

2) There will be two LAYERS:
LAYER1:
- The empty icon
- When click on it (hand cursor) it will appear a txt-box (we can use "edit" component of the designer for this) where the user will have to put a 4digit num or num/letters code. This code must have, somehow using a script, the same value with the text command of the script. And after press "enter" will show up the LAYER2 (and hide the first one)
Something like:
when txtvalue 0000 = layer2 visible / hide layer1

LAYER2:
- The full icon.
- A customizable shortcut where the user can add a file or a folder.
(like a normal XWidget's shortcut)

So the main idea is to have visible the second layer only when the user will put the right text value.

It will be not a real security lock shortcut, but only who installed this on his/her pc will know the trick..

I'm not so good creating scripts, especially from the scratch, so any help will be appreciated!
Especially from you guys that you know a lot more things than me on this..
:)

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


Top
 Profile  
 
PostPosted: February 3rd, 2014, 9:12 am 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
then above script code can be used.
if you have problem with scripting:
just make the other parts of the widget and post it here,
so i can add the code for it.


Top
 Profile  
 
PostPosted: February 3rd, 2014, 10:35 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
hamid wrote:
then above script code can be used.
if you have problem with scripting:
just make the other parts of the widget and post it here,
so i can add the code for it.

Thanks hamid! ;)
I will post the test version here soon..

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


Top
 Profile  
 
PostPosted: February 3rd, 2014, 3:01 pm 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
Here is the test widget. I added some script by hamid but certainly needs adjusting!.. :roll:

(I added a "!ShowHideObj=edit1" onclick code, when click on the image1-layer1 so show/hide the edit panel.)

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


Top
 Profile  
 
PostPosted: February 4th, 2014, 12:26 am 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
here's the new version:
===================
fixed: ScriptCode
fixed: on pressing 5 Character, 1 of the 4character will get out of view; now all 4 characters will be shown
added: menuitem to change password
===================


Top
 Profile  
 
PostPosted: February 4th, 2014, 4:47 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
hamid wrote:
here's the new version:
===================
fixed: ScriptCode
fixed: on pressing 5 Character, 1 of the 4character will get out of view; now all 4 characters will be shown
added: menuitem to change password
===================


You're absolutely brilliant hamid!!! :D
Just what I was thinking!
One last thing: There is a way after the safe is open put a right click option to close it again (return to the initial state)???

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


Top
 Profile  
 
PostPosted: February 4th, 2014, 6:30 am 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
There is already another menuitem that do that:
RightClick>Window>Reload


but anyway;
here's the new version:
====================
added: menuitem for locking safe again after unlocking (Only Visible when safe is unlocked)
====================


Top
 Profile  
 
PostPosted: February 4th, 2014, 6:59 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
Yes I known about the Reload option, but I wanted something more direct, like you did! :D
Thanks a lot for the help and your fantastic job! I will make some visuals improvements and I'll post it soon..!

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


Top
 Profile  
 
PostPosted: February 4th, 2014, 9:08 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
posted: :D
viewtopic.php?f=11&t=4063

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


Top
 Profile  
 
PostPosted: February 4th, 2014, 12:10 pm 
Offline

Joined: June 18th, 2012, 12:07 am
Posts: 268
Very nice... :mrgreen:
What about a click on the center of the open door handle to lock it


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

All times are UTC - 8 hours


Who is online

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