XWidgetSoft Forum https://www.bbs.xwidget.com/ |
|
Adding Event's in Javascript https://www.bbs.xwidget.com/viewtopic.php?f=10&t=2081 |
Page 1 of 1 |
Author: | vlad [ September 4th, 2012, 12:20 am ] |
Post subject: | Adding Event's in Javascript |
How to add/remove a costume created event to a object? (In the code, without using the Inspector Functions) ??? |
Author: | Shezoid [ September 4th, 2012, 3:06 am ] |
Post subject: | Re: Adding Event's in Javascript |
maybe this will work: Code: function widgetOnEnter()
{ //event } function setEventForWidget() { widget.OnWidgetEnter=widgetOnEnter; } |
Author: | Tony [ September 4th, 2012, 3:06 am ] |
Post subject: | Re: Adding Event's in Javascript |
Hi, Code: image1.OnClick = "imgclk"; and you need create a function named imgclk Code: function imgclk(Sender)
{ alert( Sender.name + " Clicked"); } |
Author: | Tony [ September 4th, 2012, 3:08 am ] |
Post subject: | Re: Adding Event's in Javascript |
Shezoid wrote: maybe this will work: Code: function widgetOnEnter() { //event } function setEventForWidget() { widget.OnWidgetEnter=widgetOnEnter; } Event function need function name string, etc: Code: widget.onEnter = "widgetOnEnter";
|
Author: | vlad [ September 4th, 2012, 6:11 am ] |
Post subject: | Re: Adding Event's in Javascript |
My aim is to create a short cut add some events to it (Thank to you it all working now ![]() As much as i tried to go around the code and try to hack it, i cannot manage to create a new instance of the core, and I'm not sure if its needed to be attached to the widget or not... help please. ![]() |
Author: | flibio [ September 4th, 2012, 8:28 am ] |
Post subject: | Re: Adding Event's in Javascript |
vlad wrote: ...As much as i tried to go around the code and try to hack it, i cannot manage to create a new instance of the core, and I'm not sure if its needed to be attached to the widget or not... help please. ![]() I asked the same question and still no answer... |
Author: | qiancang [ September 5th, 2012, 11:55 pm ] |
Post subject: | Re: Adding Event's in Javascript |
hi,vlad,may i know why you want to creat shortcut in code? if you need a widget with dynamic shortcut number , you can use the shortcutlist core , here is a example:http://www.xwidget.com/xwidget/widgets/system/2012/0415/249.html |
Author: | vlad [ September 6th, 2012, 10:41 pm ] |
Post subject: | Re: Adding Event's in Javascript |
Thank you qiancang! u just made my widget possible |
Author: | qiancang [ September 7th, 2012, 12:06 am ] |
Post subject: | Re: Adding Event's in Javascript |
vlad wrote: Thank you qiancang! u just made my widget possible you are welcome ![]() |
Author: | flibio [ September 7th, 2012, 4:46 am ] |
Post subject: | Re: Adding Event's in Javascript |
qiancang wrote: vlad wrote: Thank you qiancang! u just made my widget possible you are welcome ![]() Sadly, not mine. qiancang, do you know how to create an instance of any core in script code? I really need it. |
Author: | qiancang [ September 7th, 2012, 6:27 am ] |
Post subject: | Re: Adding Event's in Javascript |
flibio wrote: qiancang wrote: vlad wrote: Thank you qiancang! u just made my widget possible you are welcome ![]() Sadly, not mine. qiancang, do you know how to create an instance of any core in script code? I really need it. it seems that creating core in code is not available , may i know what function you want? maybe there is another way to reach it ![]() here is a example of clone controls in code , hope it will help you Attachment:
|
Author: | flibio [ September 7th, 2012, 11:28 am ] |
Post subject: | Re: Adding Event's in Javascript |
Thanks quiancang, I know how create or clone controls in code. The need of dinamically creating instances of cores comes in order to make a widget which displays information of all the drives. The fix drives aren't a problem, but removable drives such USB or firewire cannot be predefined. You should create a diskcore for every letter of the the system drives, which is highly inefficient. Right now I can do the trick using WMI queries but CPU activity is a little high, and I would rather use the diskcore, but obviously only if I can create it dinamically. That's my need, but there are a lot of scenarios in which would be interesting create a core dinamically. |
Author: | vlad [ September 8th, 2012, 1:28 am ] |
Post subject: | Re: Adding Event's in Javascript |
Nice ! The cloning objects is very handy, now i can create unlimited amount of icons ![]() |
Author: | qiancang [ September 8th, 2012, 5:00 am ] |
Post subject: | Re: Adding Event's in Javascript |
flibio wrote: Thanks quiancang, I know how create or clone controls in code. The need of dinamically creating instances of cores comes in order to make a widget which displays information of all the drives. The fix drives aren't a problem, but removable drives such USB or firewire cannot be predefined. You should create a diskcore for every letter of the the system drives, which is highly inefficient. Right now I can do the trick using WMI queries but CPU activity is a little high, and I would rather use the diskcore, but obviously only if I can create it dinamically. That's my need, but there are a lot of scenarios in which would be interesting create a core dinamically. Hi,flibio, creating core in code is not the only way to meet your need ![]() here is a widget by asia which just uses 4 diskcores but could display all your drives the code you need is between about line 1 and line 200. it's a old widget and some code is not necessary in current XWidget its annotation are Chinese , hope that would not trouble you And , vlad , some code in this widget is the rudiment of shortcutlistcore , hope it will make your work easier ![]() Attachment:
|
Author: | vlad [ September 8th, 2012, 9:03 pm ] |
Post subject: | Re: Adding Event's in Javascript |
Cheers qiancang! ![]() Would you have any explanation to me how to use "GetFileIconToPng" function ? I'm trying to auto generate an icon on each time a link / app has been dropped on my widget. Code: OnDragDrop(Sender,Data,Point) { iconSrc = GetFileIconToPng(Data, ??); } |
Author: | Tony [ September 9th, 2012, 1:33 am ] |
Post subject: | Re: Adding Event's in Javascript |
Code: GetFileIconToPng( FileName , PNG FileName); So,you can uses this to get a PNG from a file into widget's folder named "IconFile.png" : Code: OnDragDrop(Sender,Data,Point)
{ var iconSrc = widgetPath + "IconFile.png"; GetFileIconToPng(Data, iconSrc ); } |
Author: | vlad [ September 9th, 2012, 5:02 am ] |
Post subject: | Re: Adding Event's in Javascript |
Thanks ![]() |
Author: | stormitornado [ April 13th, 2013, 1:16 pm ] |
Post subject: | Re: Adding Event's in Javascript |
Hello. Can you help me to delete cloned object in code. I've clone objects by this code Code: ds=new Array(); for (var i=1;i<=Edisks.length;i++) { ds[i] = disk.Clone(roots); ds[i].Parent = roots; } ..... if I use this code to delete item Code: ds.splice(0,1); //for example then the object is not deleted I tryed to use ds[i].UpdateTargets; but it didn't work. Could you give an advice, how to do that? |
Author: | Tony [ April 13th, 2013, 4:50 pm ] |
Post subject: | Re: Adding Event's in Javascript |
try this code: Code: for (var i=1;i<=ds.length;i++) { ds[i].free; } Or, you can clone these controls and set their parent to a layer control , when you need delete them ,just call layer1.ClearChildren; Code: function layer1OnClick(Sender)
{ layer1.ClearChildren; layer1.Repaint; } |
Author: | stormitornado [ April 13th, 2013, 11:56 pm ] |
Post subject: | Re: Adding Event's in Javascript |
it works, thank you very much |
Page 1 of 1 | All times are UTC - 8 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |