Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


How to use "Sender" in click-events?


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-19-2008, 08:15 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default How to use "Sender" in click-events?

Hi,

I've got a program with a bunch of images on which can be clicked. All subs have the same structure with just one difference: the name of the image. Can this be reduced to ONE sub in which the Sender-feature is used?
example:

Code:
Sub Img1_Click  'img2_click, img3_click etc
  If Deck(SuitNr) = 0 Then
    CheckCard
    img1.Image = Cards.RetrieveImage 'img2, img3 etc
    If CardNr = Target Then 
      frmCards.Close
      ShowCards
    End If
  End If
End Sub
thnx
Marc
Reply With Quote
  #2 (permalink)  
Old 02-19-2008, 08:34 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 650
Default

Hi Stellaferox,

first add an identical event to all your images like
Code:
AddEvent("img1", Click, "Image_Click")
AddEvent("img2", Click, "Image_Click")
AddEvent("img3", Click, "Image_Click")
Then you can
Code:
Sub Imgage_Click
  If Deck(SuitNr) = 0 Then
    CheckCard
    Control(Sender).Image = Cards.RetrieveImage
    If CardNr = Target Then 
      frmCards.Close
      ShowCards
    End If
  End If
End Sub

specci48
Reply With Quote
  #3 (permalink)  
Old 02-19-2008, 08:38 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default

Hi Specci48,

You've been most helpfull...
Thanks very much!!!
Marc
Reply With Quote
  #4 (permalink)  
Old 02-19-2008, 08:51 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 650
Default

Quote:
Originally Posted by Stellaferox View Post
You've been most helpfull...
That's the aim of all users of this forum...

specci48
Reply With Quote
  #5 (permalink)  
Old 02-20-2008, 07:00 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

This tutorial should also be helpful: Runtime controls manipulation
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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
"AddEvent" and "buttonUp/buttonDown" Byak@ Questions & Help Needed 12 09-10-2008 04:04 PM
Is there any thing like Visual Basic "Tabbed dialog control" in Basic4ppc? mozaharul Questions & Help Needed 6 03-23-2008 12:07 PM
Icon / Image in a Table to "Click" on burd27 Questions & Help Needed 2 03-16-2008 04:04 AM
Image Button kommt nicht wieder "hoch" troll German Forum 3 02-22-2008 10:03 AM
calling the device's "Programs" or "settings" screens HarleyM Questions & Help Needed 0 12-05-2007 03:59 AM


All times are GMT. The time now is 02:49 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0