XWidgetSoft Forum https://bbs.xwidget.com/ |
|
Help me with these script... Clone doesn't seem to work https://bbs.xwidget.com/viewtopic.php?f=8&t=4344 |
Page 1 of 1 |
Author: | digigamer [ April 8th, 2014, 7:48 am ] | ||
Post subject: | Help me with these script... Clone doesn't seem to work | ||
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.
|
Author: | Jimking [ April 8th, 2014, 9:31 am ] |
Post subject: | Re: Help me with these script... Clone doesn't seem to work |
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..? |
Author: | qiancang [ April 8th, 2014, 6:13 pm ] |
Post subject: | Re: Help me with these script... Clone doesn't seem to work |
var icon = template.Clone(list); icon.parent = list; icon.scripter = widget.scripter; |
Author: | digigamer [ April 8th, 2014, 6:20 pm ] |
Post subject: | Re: Help me with these script... Clone doesn't seem to work |
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. |
Author: | digigamer [ April 8th, 2014, 6:22 pm ] |
Post subject: | Re: Help me with these script... Clone doesn't seem to work |
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! |
Author: | qiancang [ April 8th, 2014, 6:35 pm ] |
Post subject: | Re: Help me with these script... Clone doesn't seem to work |
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. |
Author: | digigamer [ April 8th, 2014, 10:13 pm ] |
Post subject: | Re: Help me with these script... Clone doesn't seem to work |
Yes... that's the problem... Something with the core? I even tried using an image inplace of the button, still nothing... |
Author: | meme [ April 8th, 2014, 11:07 pm ] |
Post subject: | Re: Help me with these script... Clone doesn't seem to work |
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 ??? |
Author: | digigamer [ April 9th, 2014, 12:03 am ] |
Post subject: | Re: Help me with these script... Clone doesn't seem to work |
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 ![]() |
Author: | qiancang [ April 9th, 2014, 5:05 am ] |
Post subject: | Re: Help me with these script... Clone doesn't seem to work |
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; } |
Author: | digigamer [ April 10th, 2014, 12:10 am ] |
Post subject: | Re: Help me with these script... Clone doesn't seem to work |
When was this method added?? |
Author: | qiancang [ April 10th, 2014, 12:22 am ] |
Post subject: | Re: Help me with these script... Clone doesn't seem to work |
digigamer wrote: When was this method added?? http://www.xwidget.com/ver.html ver 1.73,a long time ago... |
Page 1 of 1 | All times are UTC - 8 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |