Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Graphical Menu Navigation / Clickable Image Map

Status
Not open for further replies.

trevorwilliams2

Programmer
Mar 3, 2003
107
US
I have a request to create an image based style of navigation for a new database.
This database would contain a series of construction drawing details.

This menu would start out with an overhead image of the whole project.
On this project, for instance, there are multiple buildings.

From this overhead map I could click on that building (using an embedded hyperlink, command button?), and the next form that opens is a detailed overhead view of that building.
From there I could click on a room, a form opens, and get a list of documents for that room….etc….etc..

Through some Google searches I have seen a few programs that do this, but don’t see anything about anybody doing this in Access.

Has anybody had any experience with this style of navigation using clickable image maps?
Maybe there are ActiveX controls out there that might enhance this?

Any input would be appreciated..
 
I believe most controls allow you to identify the X and Y position of the mouse within the control on the MouseUp event. You could create a table that "mapped" spots on the image to records in a table that identify how to open a form to the proper record(s).
Code:
Private Sub Image_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
[green]   'your code here to use the X and Y coordinates
   ' good luck[/green]
End Sub

Duane
Hook'D on Access
MS Access MVP
 
There are probably some nice 3rd party apps for this. However, here is a more man's version assuming most of the objects can be estimated by a rectangle or series of rectangles.

1) Make a table that stores the x and y values for the object's lower left corner and upper right. Shapes like L, T I can be estimated using more than one rectangle for coverage.

so the table "tblLocation" would have
tblLocation
itemID (foriegn key to your room)
URx x coordinate for upper rt corner
URy y coord for upper rt corner
LLx x coord for Lower left
LLy y coord for LL

2) now get your coordinates by simply
Private Sub Image0_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
Debug.Print X & " " & Y
End Sub

Click on the UR and LL and it will print the values.
3) Enter the values into your table
itemID URx URy LLx LLy
1 2055 30 45 450
2 1275 915 165 2355

4) Add code
Code:
Private Sub Image0_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  'Debug.Print X & " " & Y
  'add code below to do something for the returned object
  MsgBox getID(X, Y)
End Sub


Public Function getID(X As Single, Y As Single) As Long
  Dim strWhere As String
  strWhere = "URx >= " & X & " AND URy <= " & Y
  strWhere = strWhere & " AND LLx <= " & X & " AND LLy >= " & Y
  Debug.Print strWhere
  getID = Nz(DLookup("itemID", "tblLocation", strWhere), 0)
End Function

It is pretty rudimentary, but I tried it and was able to quickly enter 10 objects and it worked well returning them.
 
should say "this is a poor man's version" not "more man's version. Not trying to insinuate this is the preferred way to do it, but it is a way using the native Access controls.
 
Thanks for the input!

This looks like a good way to allow the user to be able to specify / store the location of a hyperlink on a specifically named image.

This could be fired off through a double click / dialog that asks the user if they would like to specify this location as a link to another map or drawing.
The user then provides the name of the link and the path to the next image / drawing.

The routine would then store the position of the hyperlink and what image it is assigned to for the next time the image is called up.

Sounds like this may end up being a fun little app!

Looking forward to starting on this, but my priorities here shift like the wind……
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top