XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently 2017年 May 29日 23:17

All times are UTC - 8 hours




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 15 posts ] 
Author Message
PostPosted: 2013年 Jul 30日 04:51 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 453
Is there a method of changing the dock icon dynamically?

widget.icon.src="volume-dock.png";

or

widget.setDockItem("volume-dock.png");

Anything similar to give some sort of vitality to the dock image?

Apologies for asking so many questions...


Last edited by yereverluvinuncleber on 2014年 Jun 2日 09:46, edited 2 times in total.

Top
 Profile  
 
PostPosted: 2013年 Jul 30日 07:15 
Offline
User avatar

Joined: 2012年 Jun 10日 05:57
Posts: 315
which core do you use? shortcutlistcore or shortcutcore?


shortcutcore:
Code:
function image1OnClick(Sender)
{
  var path = "F:\\Pictures\\mist\\mountain.jpg";
  var command = "!SetIcon=" + path;
  shortcutcore1.cmd(null,command)
}


shortcutlistcore:
no such method


Top
 Profile  
 
PostPosted: 2013年 Jul 30日 09:20 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 453
That's great. Do you have any in-built or compatible method of building an image dynamically so I can incorporate text?

For example a temperature widget might modify the icon in the dock so that the temperature can appear on the icon dynamically.

Learning a lot here.

I tried the shortcutcore1 code as suggested and it seems to function without error, path is good, image exists but the dock icon does not seem to change, am I missing something?


Top
 Profile  
 
PostPosted: 2013年 Jul 31日 22:33 
Offline

Joined: 2012年 Jun 18日 00:07
Posts: 267
This is the last line of code I use to change the image of a shortcutcore to my recycle bin, it work OK. Same as qiancang !
eval("shortcutcore" + i).cmd(null, "!SetIcon=recycleMT.png" );

Code:
Do you have any in-built or compatible method of building an image dynamically so I can incorporate text?

Good question, I would also like to know.


Top
 Profile  
 
PostPosted: 2013年 Aug 1日 18:22 
Offline
User avatar

Joined: 2012年 Jun 10日 05:57
Posts: 315
yereverluvinuncleber wrote:
That's great. Do you have any in-built or compatible method of building an image dynamically so I can incorporate text?

For example a temperature widget might modify the icon in the dock so that the temperature can appear on the icon dynamically.

Learning a lot here.

I tried the shortcutcore1 code as suggested and it seems to function without error, path is good, image exists but the dock icon does not seem to change, am I missing something?


could you show me the preview image of your widget or tell me what kind of widget you want to do? it seems that there is no need to use code.

I guess you forgot to bind core and add tag
Attachment:
binding core.png
binding core.png [ 4.99 KiB | Viewed 5479 times ]


XWidget Tutorials Index


Top
 Profile  
 
PostPosted: 2014年 May 29日 13:28 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 453
I don't want to bind the shortcut core to any particular button press, I simply want to display the current volume on top of the current dock icon when the volume changes.

All I want to do is to have the ability to add text to the dock icon. Is it possible?

In the past I've built the icon thus:

Code:
function buildVitality(bg, perc) {
   var d, v, dock_bg, w, vit;

   if (!widget.dockOpen) { return; }

   d = XMLDOM.createDocument();
   v = d.createElement("dock-item");
   v.setAttribute("version", "1.0");
   d.appendChild(v);

   dock_bg = d.createElement("image");
   dock_bg.setAttribute("src", bg);
   dock_bg.setAttribute("hOffset", 0);
   dock_bg.setAttribute("vOffset", 0);
   v.appendChild(dock_bg);

   w = d.createElement("text");
   w.setAttribute("hOffset", "5");
   w.setAttribute("vOffset", "20");
   w.setAttribute("hAlign", "left");
   w.setAttribute("style", "text-align: left;font-family: 'times', 'times'; font-stretch: condensed; font-size: 18px; color: #ffffff; -kon-shadow: 0px -1px rgba( 0, 0, 0, 0.7 )");

        if (system.mute != 1) {
           vit = perc + "%";
        } else {
           vit = "Muted";
        }
        w.setAttribute("data",   vit );
   v.appendChild(w);

   widget.setDockItem(d, "fade");
}


Top
 Profile  
 
PostPosted: 2014年 May 29日 15:35 
Offline

Joined: 2013年 Oct 26日 08:17
Posts: 362
you just need to add a text object and use [%Volume] to show volume in text object

maybe you don't know how to bind an object to core tags
if so, then read this:
1. place a volumecore in your widget
2. place a text object in your widget
3. select the text object that you just created, and in the right sidebar (Inspector) in the [Attributes] tab, go to [Binding Core], there you should select your volumecore from dropdownlist, and then add %Volume to show you the current volume by update of the core, you can type more text to this box if you like more text to be added to it


Top
 Profile  
 
PostPosted: 2014年 Jun 1日 05:35 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 453
Hamid, will that show in the dock?


Top
 Profile  
 
PostPosted: 2014年 Jun 1日 08:51 
Offline

Joined: 2013年 Oct 26日 08:17
Posts: 362
i don't know what you mean by dock?
sorry about my english

============
if you want to see a text on something in your widget:
just you need to create a text object and place it wherever you want and bind it to the core you want,
the way as above i mentioned

========

and also anything in the widget tree (left Sidebar) being upper will be viewed in front of others and anything being downer will be back of others

if you want something to be front/back of others you have to change it's position in the widget tree,
to change the object position in widget tree:
1. select that object
2. and then rightclick on it in the widget tree
3. from the rightclick menu select [bring to front] to make it in front of all other Objects or [send to back] to make it back of all others

============
if you mean something else, better to add an example for it


Top
 Profile  
 
PostPosted: 2014年 Jun 2日 02:14 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 453
When you double click onto the Xwidget icon in the sys tray up comes the Widget dock showing you all the widgets that you have installed, showing you which are running &c.

Each has an icon and that icon on many widget engines can be given vitality, meaning that a clock icon can have superimposed upon it, the current time.

In the widget itself time cores are used to display the time in the widget and could then be used to produce output on the dock icon.

Same with the volume widget, using the volume core, the current volume could be superimposed upon the dock image so that when you look at the dock the icon shows the current volume level.

That is what I am looking to do.


Top
 Profile  
 
PostPosted: 2014年 Jun 2日 02:46 
Offline
User avatar

Joined: 2012年 Jun 10日 05:57
Posts: 315
we can do anything to the dock made by us.
but we can do nothing to the dock you want to change.
the dock just show you widget icons,not more information is supported.


Top
 Profile  
 
PostPosted: 2014年 Jun 2日 09:45 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 453
OK, a limitation, understood. Thanks for that confirmation.

I am porting my widgets and attempting to retain all their functionality. This little bit of functionality will have to be lost.

This is the dock from the old Konfabulator engine that pops up when you "mouse over". Note the date, time and volume levels on the widget icons.

Image


Top
 Profile  
 
PostPosted: 2014年 Jun 2日 11:05 
Offline

Joined: 2013年 Oct 26日 08:17
Posts: 362
just to clarify a bit:
you can create dock icon for your widget in Designer,
so it will have all the functionality of your widget in its view

but it wouldn't updated when you open the dock (dashboard)
i mean it's just an static image that you created it before

===================

extra info about creating widget icon:

==========

if you want to have all the view of your widget in widget icon, do these:
1. open Designer
2. from the [left Sidebar], in the [widget tree], select [Widget Icon]
3. in this view click [Automatically generated] button to create a icon image from the state of the widget in Designer (note that script execution doesn't included)

=========

if you want to don't include some objects in Designer genereated icon image:
1. open the designer
2. select the object you don't want to be shown in icon
3. from the [right Sidebar], in Attributes tab, from general Section, uncheck [Show in Default Image]
4. you can use button next to this check box to show all/none the objects in default image
5. go to [left Sidebar] > in widget tree > Widget Icon
6. click on [Automatically generated] button

==========

if you want to include script execution in your icon image:
1. run the widget
2. right click on your widget
3. from rightclick menu, go to Window > Functions > ScreenShot...
4. save your png image as icon.png in your widget folder

=========

hope these would be helpful


Top
 Profile  
 
PostPosted: 2014年 Jun 6日 03:14 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 453
All the above was helpful, doesn't do quite what I wanted as it doesn't update the icons automatically and dynamically - but that is a limitation of this widget engine, understood and accepted - so I won't try to duplicate the dock functionality from my Konfabulator widgets on my new Xwidgets.

HELP: changing the dock icon dynamically - CLOSED


Top
 Profile  
 
PostPosted: 2014年 Jun 6日 10:08 
Online
User avatar

Joined: 2012年 Dec 5日 17:52
Posts: 4462
Topic closed

_________________
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 This topic is locked, you cannot edit posts or make further replies.  [ 15 posts ] 

All times are UTC - 8 hours


Who is online

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