XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 10th, 2025, 12:02 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: April 8th, 2014, 7:48 am 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
I might have made a mistake but... As per documentation and examples this should work
Code:
function widgetOnLoad()
{

  widget.Top = 0;
  widget.Left = 0;
  bg.Left = 0;

  widget.Height = ScreenHeight;
  var nIcons = Math.floor(ScreenHeight/72);
  //shortcutlistcore1.ItemCountOfSinglePage = nIcons;
    shortcutlistcore1.cmd(null,"!ItemCountEveryPage="+nIcons);
  print(nIcons);

  list.Height = 72*nIcons;

  for(i = 1; i<= nIcons; i++) {
     var icon = template.Clone(list);
     icon.Name = "icon"+i;
     icon.Top = (i-1)*72 + 4;
     icon.Left = 0;
     icon.Core = shortcutlistcore1;
     icon.Coreformat = '%item'+i+'_Icon';

     icon.Parent = list;
     icon.Visible = true;
  }

  shortcutlistcore1.UpdateTargets();
}


Buttons initialize properly, I've tested them, but don't show the icons!

This is a sidebar like widget inspired from those found in Galaxy Grand 2 and Ubuntu. Drag and Drop to add icons.


Attachments:
sidebar_dock.xwp [6.77 KiB]
Downloaded 297 times

_________________
Life is a myriad game... Just play it!
Top
 Profile  
 
PostPosted: April 8th, 2014, 9:31 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
One thing that I found is that you forgot to fill the "OnClick" function of the template with the "!Open".
But tested and even with this code the shortcut doesn't work/open the file.
Why not use shortcuts like a normal dock widget..?

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


Top
 Profile  
 
PostPosted: April 8th, 2014, 6:13 pm 
Offline
User avatar

Joined: June 10th, 2012, 5:57 am
Posts: 313
var icon = template.Clone(list);
icon.parent = list;
icon.scripter = widget.scripter;


Top
 Profile  
 
PostPosted: April 8th, 2014, 6:20 pm 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
qiancang wrote:
var icon = template.Clone(list);
icon.parent = list;
icon.scripter = widget.scripter;


But still, If I add icons they do not display. Only the first one is. Try dragging and dropping two or three icons. Hand-point cursor appears and and clicking them opens the shortcut, but there is no sign of the icon! Really strange.

_________________
Life is a myriad game... Just play it!


Top
 Profile  
 
PostPosted: April 8th, 2014, 6:22 pm 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
jimking wrote:
Why not use shortcuts like a normal dock widget..?

Oh! I missed that !open. But thats not I'm trying to achieve. The widget should resize and fill all the available height with available icons. The problem is that the buttons do created, and the applications open when clicked on appropriate button, but don't display the icon... Even adding a hint tag shows the correct names!

_________________
Life is a myriad game... Just play it!


Top
 Profile  
 
PostPosted: April 8th, 2014, 6:35 pm 
Offline
User avatar

Joined: June 10th, 2012, 5:57 am
Posts: 313
all icons have been created.
if you set icon.src = WidgetPath+'default.png', you can see them after adding shortcuts.
but their src don't change. it's strange.


Top
 Profile  
 
PostPosted: April 8th, 2014, 10:13 pm 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
Yes... that's the problem... Something with the core?

I even tried using an image inplace of the button, still nothing...

_________________
Life is a myriad game... Just play it!


Top
 Profile  
 
PostPosted: April 8th, 2014, 11:07 pm 
Offline

Joined: June 18th, 2012, 12:07 am
Posts: 268
As you have already said the shortcuts and icons are created... if you right click on the shortcuts and select - edit shortcut - the path, name and ICON appear correctly.
If you edit shortcut 1 it updates OK, so shortcut 1 is working all OK.
So if shortcut 1 works OK ... What is the difference between shortcut 1 and the others ???
As you said it seems to be the clone process that makes it not work ???


Top
 Profile  
 
PostPosted: April 9th, 2014, 12:03 am 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
Thanks qiancang... A little hint was enough!
Looks like we needed to set the absolute path of the icon not the relative ones...

icon.Coreformat = WidgetPath+'\\%item'+i+'_Icon';

However, this causes the !Open to not fire correctly... Still, a fix was possible using event handlers.

Will post the scripts after a little finishing touches :mrgreen:

_________________
Life is a myriad game... Just play it!


Top
 Profile  
 
PostPosted: April 9th, 2014, 5:05 am 
Offline
User avatar

Joined: June 10th, 2012, 5:57 am
Posts: 313
for(i = 1; i<= nIcons; i++) {
var icon = template.Clone(list);
widget.InitControl(icon); // it's necessary!
icon.Parent = list;
icon.Name = "icon"+i;
icon.Top = (i-1)*72 + 4;
icon.Left = 0;
icon.Core = shortcutlistcore1;
icon.Coreformat = '%item'+i+'_Icon';
icon.Visible = true;
}


Top
 Profile  
 
PostPosted: April 10th, 2014, 12:10 am 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
When was this method added??

_________________
Life is a myriad game... Just play it!


Top
 Profile  
 
PostPosted: April 10th, 2014, 12:22 am 
Offline
User avatar

Joined: June 10th, 2012, 5:57 am
Posts: 313
digigamer wrote:
When was this method added??


http://www.xwidget.com/ver.html

ver 1.73,a long time ago...


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

All times are UTC - 8 hours


Who is online

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