XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently 2017年 Dec 11日 01:25

All times are UTC - 8 hours




Post new topic Reply to topic  [ 19 posts ] 
Author Message
PostPosted: 2017年 Nov 25日 03:28 
Offline

Joined: 2016年 Sep 16日 03:30
Posts: 35
Hello

I have a concern I created a widget with several background that the user can define but I can not save each time I restart xwidget it puts me the bottom by default ........

Someone know how?
I tried various codes without success

thank you ;)


Top
 Profile  
 
PostPosted: 2017年 Nov 25日 08:28 
Offline
User avatar

Joined: 2012年 Dec 5日 17:52
Posts: 4567
Use the script in the widget that I attached you in your previous post
viewtopic.php?f=7&t=6819

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


Top
 Profile  
 
PostPosted: 2017年 Nov 26日 02:39 
Offline

Joined: 2016年 Sep 16日 03:30
Posts: 35
Hi thanks

I can not make it work here is the code that I have written

Code:
function widgetOnLoad()
{
    GlassEffect.Visible = getValue('GlassEffect.visible',GlassEffect.Visible);

    GlassEffectBtn1.checked = GlassEffect.visible;
}
function GlassEffectBtn1OnClick(Sender)
{
   GlassEffect.visible = true;
   Setvalue("GlassEffect.visible","GlassEffect.Visible")
   saveIni;
   GlassEffectBtn1.checked = GlassEffect.visible;

}


Thx :)


Top
 Profile  
 
PostPosted: 2017年 Nov 26日 03:18 
Offline
User avatar

Joined: 2012年 Dec 5日 17:52
Posts: 4567
could you please attach the .xwp to check from the "inside"..?

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


Top
 Profile  
 
PostPosted: 2017年 Nov 26日 04:10 
Offline

Joined: 2016年 Sep 16日 03:30
Posts: 35
i send you the widget
https://www.mediafire.com/file/5l56qtdy ... t_Beta.zip

thx


Top
 Profile  
 
PostPosted: 2017年 Nov 26日 05:31 
Offline
User avatar

Joined: 2012年 Dec 5日 17:52
Posts: 4567
It's a bit complicated widget since there are a lot of layers and submenus and I don't know how will work..
So I'll give you a general script that works for 2 or more layers or images that you want to make tem selectable (show/hide) through the right click option or with clickon function.
Just replace the layer1, layer2, function menu..... with the names of the layers or images or whatever you want to use.

Code:
function menuitem1OnClick(Sender)
{
  layer1.visible = true;
  layer2.visible = false;
  setValue('layer1.visible',layer1.Visible);
  setValue('layer2.visible',layer2.Visible);
  saveIni;
  menuitem1.checked = layer1.visible;
  menuitem2.checked = layer2.visible;
}

function menuitem2OnClick(Sender)
{
  layer1.visible = false;
  layer2.visible = true;
  setValue('layer1.visible',layer1.Visible);
  setValue('layer2.visible',layer2.Visible);
  saveIni;
  menuitem1.checked = layer1.visible;
  menuitem2.checked = layer2.visible;
}


function widgetOnLoad()
{
  layer1.Visible = getValue('layer1.visible',layer1.Visible);
  layer2.Visible = getValue('layer2.visible',layer2.Visible);

  menuitem1.checked = layer1.Visible;
  menuitem2.checked = layer2.Visible;
}


If you want to show/hide a single layer,image etc use this one:

Code:
function menuitem1OnClick(Sender)
{
  widget.cmd("!ShowHideObj=layer1");
  setValue('layer1.visible',layer1.Visible);
  saveIni;
  menuitem1.checked = layer1.Visible;
}


function widgetOnLoad()
{
  layer1.Visible = getValue('layer1.visible',layer1.Visible);
  menuitem1.checked = layer1.Visible;
}

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


Top
 Profile  
 
PostPosted: 2017年 Nov 26日 05:45 
Offline

Joined: 2016年 Sep 16日 03:30
Posts: 35
i will try this now :)
And yes it's a beta widget..its have lots of layer i create a new version with less layer as possible to make it easier ;)


Top
 Profile  
 
PostPosted: 2017年 Nov 26日 06:30 
Offline

Joined: 2016年 Sep 16日 03:30
Posts: 35
Thank you very much it works finally :)

In revenche I have a slight bug easy to solve I think, to activate my layer I use a checkbox except that if I disable the layer via this checkbox it remains tick .... that the effect be activated or not. ... here is a screen for you to see and the code that goes with it;)

Glass Active
https://gyazo.com/af169b064bafbd48d384ab710d0175ab
Glass not active but checkbox are checked
https://gyazo.com/351fdb51b52b3ac0d5047440c11a9641

And you'r code
Code:
function widgetOnLoad()
{
  EffectGlass.Visible = getValue('EffectGlass.visible',EffectGlass.Visible);
  GlassCheckBox.checked = EffectGlass.Visible;
  SaveIni()
}

function GlassCheckBoxOnClick(Sender)
{
  widget.cmd = "!FadeInOutVisibleObj=EffectGlass"
  setValue('EffectGlass.visible',EffectGlass.Visible);
  SaveIni()
  GlassCheckBox.checked = EffectGlass.visible;
}


i will try to find a way for this bug but i'm a novice in scripting :)

Thank for you'r help :)


Top
 Profile  
 
PostPosted: 2017年 Nov 26日 14:52 
Offline
User avatar

Joined: 2012年 Dec 5日 17:52
Posts: 4567
This is not a bug Rom.
When the layer is visible, the checkbox will be activated. So the script overwrites any manual "uncheck" option.
You need to "play" with the "visible"option and keep the layer "invisible" on the start.
If you have it visible you will have the opposite result..

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


Top
 Profile  
 
PostPosted: 2017年 Nov 27日 07:40 
Offline

Joined: 2016年 Sep 16日 03:30
Posts: 35
Ok ok but i set my layer invisible by default
https://gyazo.com/0fab4555a236dba378c9e4ec2bba7ff2

if i understand I have to change this in my code
Code:
widget.cmd = "!FadeInOutVisibleObj=EffectGlass"

by this
Code:
layer1.visible = true;


Edit : XW have uncheck function for check button ?


Top
 Profile  
 
PostPosted: 2017年 Nov 27日 08:48 
Offline
User avatar

Joined: 2012年 Dec 5日 17:52
Posts: 4567
With the first code you can show hide the component
With the second the layer will stay visible.
Depends on what you want to do

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


Top
 Profile  
 
PostPosted: 2017年 Nov 28日 06:07 
Offline

Joined: 2016年 Sep 16日 03:30
Posts: 35
ok realy thanks for you'r help
i have learn loot of good things :)

I have a question, can i call a external javascript file created by me ?
i find codes on internet but does't work....

thanks :)


Top
 Profile  
 
PostPosted: 2017年 Nov 28日 09:47 
Offline
User avatar

Joined: 2012年 Dec 5日 17:52
Posts: 4567
You're free to use any java script you want. Personally I shave no problem with it.
You can find external java scripts but you need to know how to edit them and make them work properly to your design. And it's not so easy especially for novice users.
There are so many ready widgets for XWidget and you can find many many functions.
That's way I did :)

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


Top
 Profile  
 
PostPosted: 2017年 Nov 28日 13:10 
Offline

Joined: 2016年 Sep 16日 03:30
Posts: 35
Yes I search a lot too and I find a lot of useful things.
Is it possible to put the windgetOnLoad function in a .js file rather than in the widget itself?

sorry with all that is question but I'm embarking on a pretty big project and I just miss some info :)

thank you


Top
 Profile  
 
PostPosted: 2017年 Nov 28日 16:54 
Offline
User avatar

Joined: 2012年 Dec 5日 17:52
Posts: 4567
Rom wrote:
Yes I search a lot too and I find a lot of useful things.
Is it possible to put the windgetOnLoad function in a .js file rather than in the widget itself?

I don't understand what do you mean with it..

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


Top
 Profile  
 
PostPosted: 2017年 Nov 29日 06:54 
Offline

Joined: 2016年 Sep 16日 03:30
Posts: 35
I would like to put the WidgetOnLoad function in a .js file because I am created a widget with a lot of options and customization and suddenly so that my code be readable easily I had the question of knowing if I could put all the backup function in an external file and the loaded at launching the widget


Top
 Profile  
 
PostPosted: 2017年 Nov 29日 14:44 
Offline
User avatar

Joined: 2012年 Dec 5日 17:52
Posts: 4567
You can create a second clone widget with a different name if you want to backup your design/java script.
The java script in general like the WidgetOnLoad works for the widget itself. There is no way to interact with more widgets using a java script.
I hope that I replied to your question, because really I don't understand well your thought. The Google translator is bad... :)

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


Top
 Profile  
 
PostPosted: 2017年 Nov 30日 03:23 
Offline

Joined: 2016年 Sep 16日 03:30
Posts: 35
Yeah google translation is realy bad :)

I show you my only WidgetOnLoad function.
Code:
function widgetOnLoad()
{
// -------------------- Background Color Panel ------------------ //
// -------------------- Black Background btn -------------------- // 
  BgColorBlack.Visible = getValue('BgColorBlack.visible',BgColorBlack.Visible);
  ImagesLayer.Visible = getValue('ImagesLayer.visible',ImagesLayer.Visible);
  Colors.visible = getValue('Colors.visible',Colors.visible);
  black01.checked = BgColorBlack.Visible;
  black01.checked = ImagesLayer.Visible;
  black01.checked = Colors.visible;
// -------------------- Blue01 Background btn -------------------- //
  BgColorBlue01.Visible = getValue('BgColorBlue01.visible',BgColorBlue01.Visible);
  ImagesLayer.Visible = getValue('ImagesLayer.visible',ImagesLayer.Visible);
  Colors.visible = getValue('Colors.visible',Colors.visible);
  blue01.checked = BgColorBlue01.Visible;
  blue01.checked = ImagesLayer.Visible;
  blue01.checked = Colors.visible;
 
  BgColorBlack.visible = getValue('BgColorBlack.visible',BgColorBlack.visible);
  blue01.checked = BgColorBlack.visible;
// -------------------- Blue02 Background btn -------------------- //
  BgColorBlue02.Visible = getValue('BgColorBlue02.visible',BgColorBlue02.Visible);
  ImagesLayer.Visible = getValue('ImagesLayer.visible',ImagesLayer.Visible);
  Colors.visible = getValue('Colors.visible',Colors.visible);
  blue02.checked = BgColorBlue02.Visible;
  blue02.checked = ImagesLayer.Visible;
  blue02.checked = Colors.visible;
 
  BgColorBlack.visible = getValue('BgColorBlack.visible',BgColorBlack.visible);
  BgColorBlue01.visible = getValue('BgColorBlue01.visible',BgColorBlue01.visible);
  blue02.checked = BgColorBlack.visible;
  blue02.checked = BgColorBlue01.visible;
// -------------------- Blue03 Background btn -------------------- //
  BgColorBlue03.Visible = getValue('BgColorBlue03.visible',BgColorBlue03.Visible);
  ImagesLayer.Visible = getValue('ImagesLayer.visible',ImagesLayer.Visible);
  Colors.visible = getValue('Colors.visible',Colors.visible);
  blue03.checked = BgColorBlue03.Visible;
  blue03.checked = ImagesLayer.Visible;
  blue03.checked = Colors.visible;
 
  BgColorBlack.visible = getValue('BgColorBlack.visible',BgColorBlack.visible);
  BgColorBlue01.visible = getValue('BgColorBlue01.visible',BgColorBlue01.visible);
  BgColorBlue02.visible = getValue('BgColorBlue02.visible',BgColorBlue02.visible);
  blue03.checked = BgColorBlack.visible;
  blue03.checked = BgColorBlue01.visible;
  blue03.checked = BgColorBlue02.visible;
  // -------------------- Blue04 Background btn -------------------- //
  BgColorBlue04.Visible = getValue('BgColorBlue04.visible',BgColorBlue04.Visible);
  ImagesLayer.Visible = getValue('ImagesLayer.visible',ImagesLayer.Visible);
  Colors.visible = getValue('Colors.visible',Colors.visible);
  blue04.checked = BgColorBlue04.Visible;
  blue04.checked = ImagesLayer.Visible;
  blue04.checked = Colors.visible;
 
  BgColorBlack.visible = getValue('BgColorBlack.visible',BgColorBlack.visible);
  BgColorBlue01.visible = getValue('BgColorBlue01.visible',BgColorBlue01.visible);
  BgColorBlue02.visible = getValue('BgColorBlue02.visible',BgColorBlue02.visible);
  BgColorBlue03.visible = getValue('BgColorBlue03.visible',BgColorBlue03.visible);
  blue04.checked = BgColorBlack.visible;
  blue04.checked = BgColorBlue01.visible;
  blue04.checked = BgColorBlue02.visible;
  blue04.checked = BgColorBlue03.visible;
  // -------------------- Blue05 Background btn -------------------- //
  BgColorBlue05.Visible = getValue('BgColorBlue05.visible',BgColorBlue05.Visible);
  ImagesLayer.Visible = getValue('ImagesLayer.visible',ImagesLayer.Visible);
  Colors.visible = getValue('Colors.visible',Colors.visible);
  blue05.checked = BgColorBlue05.Visible;
  blue05.checked = ImagesLayer.Visible;
  blue05.checked = Colors.visible;
// -------------------- Background Images Panel ------------------ //
  ImagesLayer.Visible = getValue('ImagesLayer.visible',ImagesLayer.Visible);
  Colors.Visible = getValue('Colors.visible',Colors.Visible);

  AkBg.checked = ImagesLayer.Visible;
  AkBg.checked = Colors.Visible;
 
// -------------------- Background Tranparence ------------------ //
  Trans00.Opacity = 1;
  Trans10.Opacity = 1;
  Trans20.Opacity = 1;
  Trans30.Opacity = 1;
  Trans40.Opacity = 1;
  Trans50.Opacity = 1;
  Trans60.Opacity = 1;
  Trans70.Opacity = 1;
  Trans80.Opacity = 1;
  Trans90.Opacity = 1;
 
  WidgetBackground.Opacity = getValue('WidgetBackground.Opacity',WidgetBackground.Opacity);
  WidgetBackground.Opacity = getValue('WidgetBackground.Opacity',WidgetBackground.Opacity);
  WidgetBackground.Opacity = getValue('WidgetBackground.Opacity',WidgetBackground.Opacity);
  WidgetBackground.Opacity = getValue('WidgetBackground.Opacity',WidgetBackground.Opacity);
  WidgetBackground.Opacity = getValue('WidgetBackground.Opacity',WidgetBackground.Opacity);
  WidgetBackground.Opacity = getValue('WidgetBackground.Opacity',WidgetBackground.Opacity);
  WidgetBackground.Opacity = getValue('WidgetBackground.Opacity',WidgetBackground.Opacity);
  WidgetBackground.Opacity = getValue('WidgetBackground.Opacity',WidgetBackground.Opacity);
  WidgetBackground.Opacity = getValue('WidgetBackground.Opacity',WidgetBackground.Opacity);
  WidgetBackground.Opacity = getValue('WidgetBackground.Opacity',WidgetBackground.Opacity);
 
  Trans00.checked = WidgetBackground.Opacity;
  Trans10.checked = WidgetBackground.Opacity;
  Trans20.checked = WidgetBackground.Opacity;
  Trans30.checked = WidgetBackground.Opacity;
  Trans40.checked = WidgetBackground.Opacity;
  Trans50.checked = WidgetBackground.Opacity;
  Trans60.checked = WidgetBackground.Opacity;
  Trans70.checked = WidgetBackground.Opacity;
  Trans80.checked = WidgetBackground.Opacity;
  Trans90.checked = WidgetBackground.Opacity;


// -------------------- Widget Effect Glass --------------------- //

  EffectGlass.Visible = getValue('EffectGlass.visible',EffectGlass.Visible);
  GlassON.Visible = getValue('GlassON.Visible',GlassON.visible);
  GlassOFF.Visible = getValue('GlassOFF.Visible',GlassOFF.Visible);
 
  GlassOFF.visible =getValue('GlassOFF.visible',GlassOFF.visible);
  GlassON.visible = getValue('GlassON.visible',GlassON.visible);
  EffectGlass.visible = getValue('EffectGlass.visible',EffectGlass.visible);
 
  GlassCheckBox.checked = EffectGlass.Visible;
  GlassCheckBox.checked = GlassON.visible;
  GlassCheckBox.checked = GlassOFF.visible;
 
  GlassCheckBoxOff.checked = GlassOFF.visible;
  GlassCheckBoxOff.checked = GlassON.visible;
  GlassCheckBoxOff.checked = EffectGlass.visible;
  SaveIni()

// -------------------- WidgetOnLoad Settings FIN --------------- //



I would like to know if i can put this code on a external javascript file
and call this file when launching the widget ?

I hope I have been a little clearer and understandable :)


Top
 Profile  
 
PostPosted: 2017年 Nov 30日 13:29 
Offline
User avatar

Joined: 2012年 Dec 5日 17:52
Posts: 4567
As I said no it's not possible. The WidgetOnLoad function works only through the widget itself and should be placed in the Designer and XWidget will load all the data from there only. No external commands work with Xwidget widgets.

_________________
Image
...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  [ 19 posts ] 

All times are UTC - 8 hours


Who is online

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