XWidgetSoft Forum
https://bbs.xwidget.com/

How get event target?
https://bbs.xwidget.com/viewtopic.php?f=8&t=2069
Page 1 of 1

Author:  vlad [ September 2nd, 2012, 1:56 am ]
Post subject:  How get event target?

When im pulling the "Sender" inside the function i get an error. "function menuItemOnMouseEnter(Sender)"
Code:
function menuItemOnMouseEnter(Sender)
{
    //print(Sender); - prints null (Nothing)

    print(Sender.toString()); // I get a weird character.

    //print(Sender.Target); - prints null (Nothing)
   
    ...myCode
}


Apparently the Sender has some sort of Target but i didn't found any explanation about event / Senders online.
If somebody could name the variable name (if such exist's) it will be very helpful to me.

Author:  qiancang [ September 2nd, 2012, 6:15 pm ]
Post subject:  Re: How get event target?

print(Sender.name)

Author:  vlad [ September 3rd, 2012, 1:12 am ]
Post subject:  Re: How get event target?

For the code:
Code:
function menuItemOnMouseMove(Sender)
{
(line 35)                print(Sender.name);
(line 36)                Sender.Scale = 2;
(line 37)                print(Sender.Scale);
}


I get the following debug error.
Code:
[19:05:47 431]: Widget Debug has ShutDown
[19:05:47 371]: Widget Hide (OnHide)
[19:05:47 222]: Widget is Closing... (OnClose)
[19:05:46 380]: Menu Popup (OnPopupMenu)
[19:05:44 430]: [Script Error (line:37,char:6) ]: EVariantTypeCastError Could not convert variant of type (Dispatch) into type (OleStr)
[19:05:44 428]: print: crclMenuSelectCPU
[19:05:44 138]: Mouse Enter Widget Window (OnEnter)


The problem when line 36 is executed the object won't change his scale value.

Author:  Tony [ September 3rd, 2012, 4:38 pm ]
Post subject:  Re: How get event target?

Hi, What is the "menuItem" ?

Or, you can write this:

Sender.Scale.X = 2;
Sender.Scale.Y = 2;

Author:  vlad [ September 3rd, 2012, 10:55 pm ]
Post subject:  Re: How get event target?

Thank you tony so much!!!!
Seance there is no any explanation about how to use scale i had assumed it a scalar. Now when i know its a vector quantity i finality get the result i was expecting for.

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/