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

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

Code Samples & Tips Share your recent discoveries and ideas with other users.

HOTSPOT controls

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-17-2008, 12:03 PM
Knows the basics
 
Join Date: May 2007
Posts: 78
Awards Showcase
Beta Tester 
Total Awards: 1
Default HOTSPOT controls

Hi All,
Is there a 'hotspot' function or control that we can use to execute actions? The hotspot can be a rectangle (better still, any polygon shape or irregular ones).. and this will come useful when there are multiple objects within an area.

Instead of having actions script in each objects, a simply hotspot overlaying on top would suffice.

If not, perhaps Erel can consider having that in next or future versions...

Rgds
WZSun
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 03:56 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Can you give some more details about your idea?
Reply With Quote
  #3 (permalink)  
Old 04-18-2008, 11:51 AM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

If I understood him correctly....
It's something done very easily with html, so the html dll would be a workaround....
Basically you take an image containing several objects, like a ball, a car, whatever...
and define a set of coordinates within wich the curos changes and actions upon cliking can be fired....

In html, it called "image map" if i'm not mistaken...
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)

My Posts helped you? Consider Buying me a Porto Glass!
Reply With Quote
  #4 (permalink)  
Old 04-18-2008, 11:56 AM
Knows the basics
 
Join Date: May 2007
Posts: 78
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi Erel,
In Palm, there's what we call gadgets where it's actually a transparent rectangle control/object, where you can have actions. Here's a scenario.

Let me see.. ok imagine a 'spot the difference' game where you have a 2 panels, with each panel having an 'almost identical' image. There are 5 areas in the pictures where it's different. HotSpot-A is overlay on top of the whole panel. The smaller HotSpot-1... HotSpot-5 (that surrounds only the region of the different parts' of the image) are placed at the top, above HotSpot-A.

When user click on anywhere other than HotSpot-1 to HotSpot-5, they are assumed to have clicked on HotSpot-A instead. An action will be executed.. say, a 'wrong sound effect. If they click correctly on the HotSpot-1 to HotSpot-5, a graphic overlay (circle) will be displayed on top of the picture.

With just a single hotspot control, we can reduce unnecessary code in checking for mouse action and x/y coordinates. Hope this to clear the air.

For non-games, imagine a 'base panel' with scrollbar. On this panel are say, 10 vertical panels with multiple objects (inage and text) on it.. like a table. Right now, if we click on the vertical panel, nothing will happen. Even if the panel accepts action, it will not work on areas where the image/texts are placed. Then again, this means the images/text must have actions as well. So, instead of the vertical panels, images and text all having similar actions, placing a hotspot on top of the whole vertical panel will execute the action. So, even if user scrolls the 'base panel', the hotspot are still in relative position.

Hope that gives you some examples.. of what hotspot can do to enhance Basic4PPC into a better development tool.. and possibly, games development as well. Of course, to further expand on the hotspot, you can even have hotspot with irregular polygon (hmm... for jigsaw puzzle, trigram games) with actions.

For other software tools.. the hotspot controls are usually dispayed with dotted 'rubberband' lines.

Rgds
Ronnie

Last edited by WZSun : 04-18-2008 at 12:04 PM.
Reply With Quote
  #5 (permalink)  
Old 04-18-2008, 12:00 PM
Knows the basics
 
Join Date: May 2007
Posts: 78
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi Cableguy,
something like imagemap but not exactly as imagemap would be similar to image button. It's more than just HTML which has its own limitation as well.

Let's say... imagine you have an form where you define your own message dialog (to simulate a modal message form). Currently the background 'images' or buttons outside the 'message dialog' are still clickable. Imagine you have a hotspot control surrounding the whole form, but beneath the 'message dialog'. When you display the message, you enable the hotspot... so no matter how user taps on the screen.. only the button in the message dialog is clickable.

of course, any request for 'modal form' of any size is another wishlist.. but that is besides the 'hotspot' request...

Hope that helps..
Reply With Quote
  #6 (permalink)  
Old 04-18-2008, 12:08 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

The sample you gave, the matching/ discovering diferences in images...
Can be acomplished in the device, although I agree its a very tricky, and code taking job... but its doable with the mouse event's...
Then you would have to compare the clicked coordinates with the "stored" or "listed in a file" ones...

An hotspot, as you call it, would endeed be a plus, but is something that, as I sayed, can be workrd around, for your "image game"....
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)

My Posts helped you? Consider Buying me a Porto Glass!
Reply With Quote
  #7 (permalink)  
Old 04-18-2008, 02:53 PM
Knows the basics
 
Join Date: May 2007
Posts: 78
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi Cableguy,
My project is not a game.. the example provided is just for explanation only - one that comes to mind. Many authoring tools provide hotspot controls as standard.. which reduces the need to have identical actions (even using SUBs) on multiple images. Imagine 10 panels with each panel having 5 objects. To enable the objects and panels to be clickable, it means 6 duplicated actions (assuming panel is clickable in the 1st place). Multiply that with 10 panels, you have a total of 60 actions. With hotspot conrols.. you need only 10 controls with 10 actions.


A typical hotspot can be a rectangle button with transparency, where it's clickable. An irregular hotspot is just a irregular polygon with transparency. Having transparency means anything beneath the region covered by the hotspot is still visible.

I'm fully aware of using codes.. as a matter of fact, I'm using codes currently for a non-game project... no plan to do any game yet as there real applications that would be great with hotspot... although w/o it is still doable..

The wishlist for hotspot is to eliminate unnecessary coding on images/texts etc... leaving the clickable actions on just one single hotspot control..
Reply With Quote
  #8 (permalink)  
Old 04-18-2008, 04:37 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

BTW, you can use one sub event for many controls.
It is done with AddEvent and Sender keywords.
You could see more information here: http://www.basic4ppc.com/forum/tutorials/907-runtime-controls-manipulation.html
Reply With Quote
  #9 (permalink)  
Old 04-18-2008, 05:09 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

A simple Hotspot control using an Image control and the Door library takes very little code as long as you are happy with square hotspots. You would have to set up the co-ordinates of the hotspots anyway so the actual code is pretty minimal.
Attached Files
File Type: zip HotSpots.zip (11.2 KB, 136 views)
Reply With Quote
  #10 (permalink)  
Old 04-19-2008, 04:17 AM
Knows the basics
 
Join Date: May 2007
Posts: 78
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi agraham,
Thanks for the sample demo. That is a great one... for rectangle hotspot.

Does it work for scrollable panels? Is the coordinates relative to the control, say panel control? Let's say we have a panel, larger than the width. So, there is a horizontal scrollbar. if I specified the coordinates to be x=5, y=5, will it remain the same if the panel is scrolled to the right or left?

For example, there are 10 columns, but only 3 are shown at one time on the screen:
[1] [2] [3] - normal screen - original position.
[2] [3] [4] - scroll to the right

when we specify coordinates for column 2, and when user scroll to the right, column2 becomes the first column. If we specify the coordinates for columns (as in original position), when user tap on column3, will it be column2 coordimates, or column3?

Rgds
WZSun
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
Tab Order for Controls BPak Questions (Windows Mobile) 3 05-29-2009 01:45 PM
Drag controls (name) to the IDE Mr_Gee Basic4ppc Wishlist 2 07-21-2008 08:35 PM
COM controls lairdre Questions (Windows Mobile) 3 02-28-2008 08:53 AM
Disposing Controls RandomCoder Questions (Windows Mobile) 7 02-19-2008 09:26 AM
Controls name PepSoft Questions (Windows Mobile) 4 12-17-2007 02:49 PM


All times are GMT. The time now is 09:52 PM.


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