Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

get event type?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-19-2009, 02:32 PM
Byak@'s Avatar
Basic4ppc Veteran
 
Join Date: Jul 2008
Posts: 416
Send a message via ICQ to Byak@
Awards Showcase
Beta Tester 
Total Awards: 1
Default get event type?

Code:
sub appstart
addevent(
"button1","Click","ev")
addevent(
"form1","MouseUp","ev")
addevent(
"timer1","Tick","ev")
end sub

sub  ev

end sub
when "ev" called i may get name of control with keyword SENDER but how can i get what EVENT called this sub?
__________________
I'll Kill you, I'll Crash you, I'll never be yours!
--------------------------------------------------
Qtek s110; o2 XDA Flame; Nokia E63 red;
ASUS Eee PC 901 (Windows XP sp3) + TouchScreen;
Reply With Quote
  #2 (permalink)  
Old 03-19-2009, 04:04 PM
Basic4ppc Veteran
 
Join Date: Feb 2008
Location: Hilversum, The Netherlands
Posts: 295
Awards Showcase
Beta Tester 
Total Awards: 1
Default

untill it someone has a better solution would this help?
Code:
sub appstart
addevent(
"button1",Click,"ev1")
addevent(
"form1",MouseUp,"ev2")
addevent(
"timer1",Tick  ,"ev3")
end sub

sub  ev1
    ev(
"Button")    
end sub
sub  ev2
    ev(
"MouseUp")
end sub
sub  ev3
    ev(
"Tick")
end sub

sub  ev(showtype)
    
MsgBox("Type " & showtype)
end sub
Reply With Quote
  #3 (permalink)  
Old 03-19-2009, 04:28 PM
Byak@'s Avatar
Basic4ppc Veteran
 
Join Date: Jul 2008
Posts: 416
Send a message via ICQ to Byak@
Awards Showcase
Beta Tester 
Total Awards: 1
Default

no,you dont understand me=)
for example i have 100 controls...and i must add 100 subs?

but this problem i have?when i create plugins for my program with Scripting dll
plugins can arr objects to program but now i want add events for this objects,and code of this events in plugin.

my first example shows exactly the problem
__________________
I'll Kill you, I'll Crash you, I'll never be yours!
--------------------------------------------------
Qtek s110; o2 XDA Flame; Nokia E63 red;
ASUS Eee PC 901 (Windows XP sp3) + TouchScreen;
Reply With Quote
  #4 (permalink)  
Old 03-19-2009, 04:35 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by Byak@ View Post
for example i have 100 controls...and i must add 100 subs?
No. Just have one event Sub for each type of event then you know the Event type and can use Sender for the source of the event.

Code:
sub appstart
  addevent(
"button1","Click","clickev")
  addevent(
"form1","MouseUp","mupev")
  addevent(
"timer1","Tick","tickev")
end sub

sub  clickev
  ...
end sub

sub  mupev
  ...
end sub

sub  tickev
  ...
end sub
Reply With Quote
  #5 (permalink)  
Old 03-19-2009, 04:45 PM
Byak@'s Avatar
Basic4ppc Veteran
 
Join Date: Jul 2008
Posts: 416
Send a message via ICQ to Byak@
Awards Showcase
Beta Tester 
Total Awards: 1
Default

i think about it,but in program used all(maybe not all but many) controls and objects from any dlls and i must create very many subs includes all events...
it is not good too...
and most importantly it is unnecessary, it may be sufficient to know what event

maybe it's real with door dll and object "event"?
__________________
I'll Kill you, I'll Crash you, I'll never be yours!
--------------------------------------------------
Qtek s110; o2 XDA Flame; Nokia E63 red;
ASUS Eee PC 901 (Windows XP sp3) + TouchScreen;
Reply With Quote
  #6 (permalink)  
Old 03-19-2009, 05:22 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by Byak@ View Post
maybe it's real with door dll and object "event"?
No, it is not possible. It would need a modification to Basic4ppc to save the event name as well as the sender name. Presently the event name is lost once the event sub has been identified by the Basic4ppc event code.

Surely there are not that many events you need, and surely it is better to have small individual event Subs handling each type of event rather than one huge Sub with lots of conditional tests inside it trying to handle all the possible event types!

EDIT:- Remember that you don't need a different event sub for each control or object, only different ones for each individual event name. You can hide them in a module!

Last edited by agraham : 03-19-2009 at 05:26 PM.
Reply With Quote
  #7 (permalink)  
Old 03-19-2009, 05:57 PM
Byak@'s Avatar
Basic4ppc Veteran
 
Join Date: Jul 2008
Posts: 416
Send a message via ICQ to Byak@
Awards Showcase
Beta Tester 
Total Awards: 1
Default

thanks you agraham. it is not good but it better then nothing
__________________
I'll Kill you, I'll Crash you, I'll never be yours!
--------------------------------------------------
Qtek s110; o2 XDA Flame; Nokia E63 red;
ASUS Eee PC 901 (Windows XP sp3) + TouchScreen;
Reply With Quote
  #8 (permalink)  
Old 03-19-2009, 07:18 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Also notice that the event sub must match the number of arguments. So the event sub of a MouseUp event should have two parameters (and you can't use the same sub for the Click event).
Reply With Quote
  #9 (permalink)  
Old 03-19-2009, 08:31 PM
Byak@'s Avatar
Basic4ppc Veteran
 
Join Date: Jul 2008
Posts: 416
Send a message via ICQ to Byak@
Awards Showcase
Beta Tester 
Total Awards: 1
Default

thanks erel, but it was example and in my app some events not been used(mouseup,mousedown,mousemove,keypress).
but what you say about add new keyword in basic in latest version? =)
__________________
I'll Kill you, I'll Crash you, I'll never be yours!
--------------------------------------------------
Qtek s110; o2 XDA Flame; Nokia E63 red;
ASUS Eee PC 901 (Windows XP sp3) + TouchScreen;
Reply With Quote
  #10 (permalink)  
Old 03-19-2009, 08:34 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

I will consider it.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing font type mozaharul Questions (Windows Mobile) 4 05-18-2009 09:17 AM
DIM TYPE - redimming is it possible mattsaintdev Questions (Windows Mobile) 2 12-15-2008 09:45 AM
Cannot type in Device IDE Leginus Bug Reports 3 02-03-2008 03:47 PM
How to get the PDA type and make HARRY Questions (Windows Mobile) 3 01-13-2008 11:19 AM
Another Reason for IntPtr Type Louis Basic4ppc Wishlist 4 10-24-2007 06:17 PM


All times are GMT. The time now is 08:08 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0