By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,269 Members | 1,506 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,269 IT Pros & Developers. It's quick & easy.

Drag & Drop Hypertext Headaches and Image Instability

P: n/a
I'm designing an app in Access 97 that will facilitate the uploading
of records and images to a website. The user selects the image
thumbnails from the file system and drags them into the app. There
appears to be just two types of controls that support this action: OLE
controls and Hyperlink text boxes. I am using the hyperlink. Dragging
the images into the hyperlink works just fine, but I'm quite dismayed
about the lack of control over the way the hyperlink behaves. For
instance, I have no need for the images to pop up in a browser when
clicked. The app minimizes every time and loses the focus. I couldn't
find any way of disabling this behavior.

The user really has no need of clicking the hyperlinks, unless perhaps
to delete one or more. But I wanted to have an image control to
display a thumbnail of whatever image I have clicked. (There are five
image textboxes). So since I can't control the OnEnter event the way I
wanted, I have been experimenting with the MouseMove event.

The Mouse Move event is hard to control since it fires repeatedly and
tries to render the image that I've selected. To prevent the app from
crashing, I used a variable to only let OnMouseMove fire if it needs
to render a different image. I also added a timer event to wait one
second to allow the user to make a selection. These improved the
reliability from crashing every time to just crashing every once in a
while. The app is still very unreliable this way and I can't seem to
eliminate the problem eventhough my timer and variable are working
properly.

My hunch at this point is that the image control may sometimes take
more than one or two seconds to "import" the image. This may be enough
time to have the MouseMove event fire again and eventually overload
the memory.

Does anyone know of a better solution? ... a way to drag and drop
without hyperlinks? ... a different image control that doesn't crash?

Here is some code for reference, should anyone be interested:

Private Sub imgfile1_BeforeUpdate(Cancel As Integer)
iMove = 1
If Me!imgfile1 = "" Then
Me!Image1.Picture = ""
GoTo 80
End If
istart = InStr(1, Me!imgfile1, "#")
iend = InStr(istart + 1, Me!imgfile1, "#")
On Error GoTo 70
Me![Image1].Picture = FileSystem.CurDir & "/" & Mid(Me!imgfile1,
istart + 1, iend - istart - 1)
On Error GoTo 0
GoTo 80
70 Cancel = True
MsgBox ("Images must be a .jpg or .gif format")
Me.Undo
80 End Sub

Private Sub imgfile1_MouseMove(Button As Integer, Shift As Integer, X
As Single, Y As Single)
If iMove = 1 Then GoTo 71
Call timeDelay 'I added a second time delay here. Delay before AND
delay after.
If Not IsNull(Me!imgfile1) Then
iMove = 1
istart = InStr(1, Me!imgfile1, "#")
iend = InStr(istart + 1, Me!imgfile1, "#")
strImage = FileSystem.CurDir & "/" & Mid(Me!imgfile1, istart + 1,
iend - istart - 1)
On Error Resume Next
If Me![Image1].Picture <> strImage Then Me![Image1].Picture =
strImage
On Error GoTo 0
Call timeDelay
Me!imgfile1.SetFocus
End If
71 End Sub

Public Function timeDelay()
Dim PauseTime, Start
PauseTime = 1 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
Loop
End Function
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Without even getting into your logic to load the Images(why don't you
use a CommandButton and it's Click event?) I would ask the following
question.

Do you have the "Loading Image" Dialog turned off via the Registry Key
method found here:?
http://www.mvps.org/access/api/api0038.htm

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Fred R@smussen" <TH**********@spammotel.com> wrote in message
news:65**************************@posting.google.c om...
I'm designing an app in Access 97 that will facilitate the uploading
of records and images to a website. The user selects the image
thumbnails from the file system and drags them into the app. There
appears to be just two types of controls that support this action: OLE
controls and Hyperlink text boxes. I am using the hyperlink. Dragging
the images into the hyperlink works just fine, but I'm quite dismayed
about the lack of control over the way the hyperlink behaves. For
instance, I have no need for the images to pop up in a browser when
clicked. The app minimizes every time and loses the focus. I couldn't
find any way of disabling this behavior.

The user really has no need of clicking the hyperlinks, unless perhaps
to delete one or more. But I wanted to have an image control to
display a thumbnail of whatever image I have clicked. (There are five
image textboxes). So since I can't control the OnEnter event the way I
wanted, I have been experimenting with the MouseMove event.

The Mouse Move event is hard to control since it fires repeatedly and
tries to render the image that I've selected. To prevent the app from
crashing, I used a variable to only let OnMouseMove fire if it needs
to render a different image. I also added a timer event to wait one
second to allow the user to make a selection. These improved the
reliability from crashing every time to just crashing every once in a
while. The app is still very unreliable this way and I can't seem to
eliminate the problem eventhough my timer and variable are working
properly.

My hunch at this point is that the image control may sometimes take
more than one or two seconds to "import" the image. This may be enough
time to have the MouseMove event fire again and eventually overload
the memory.

Does anyone know of a better solution? ... a way to drag and drop
without hyperlinks? ... a different image control that doesn't crash?

Here is some code for reference, should anyone be interested:

Private Sub imgfile1_BeforeUpdate(Cancel As Integer)
iMove = 1
If Me!imgfile1 = "" Then
Me!Image1.Picture = ""
GoTo 80
End If
istart = InStr(1, Me!imgfile1, "#")
iend = InStr(istart + 1, Me!imgfile1, "#")
On Error GoTo 70
Me![Image1].Picture = FileSystem.CurDir & "/" & Mid(Me!imgfile1,
istart + 1, iend - istart - 1)
On Error GoTo 0
GoTo 80
70 Cancel = True
MsgBox ("Images must be a .jpg or .gif format")
Me.Undo
80 End Sub

Private Sub imgfile1_MouseMove(Button As Integer, Shift As Integer, X
As Single, Y As Single)
If iMove = 1 Then GoTo 71
Call timeDelay 'I added a second time delay here. Delay before AND
delay after.
If Not IsNull(Me!imgfile1) Then
iMove = 1
istart = InStr(1, Me!imgfile1, "#")
iend = InStr(istart + 1, Me!imgfile1, "#")
strImage = FileSystem.CurDir & "/" & Mid(Me!imgfile1, istart + 1,
iend - istart - 1)
On Error Resume Next
If Me![Image1].Picture <> strImage Then Me![Image1].Picture =
strImage
On Error GoTo 0
Call timeDelay
Me!imgfile1.SetFocus
End If
71 End Sub

Public Function timeDelay()
Dim PauseTime, Start
PauseTime = 1 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
Loop
End Function


Nov 13 '05 #2

P: n/a
Stephen,
Thanks for the suggestion regarding the registry key. It would be good
to eliminate that "loading image" dialog, especially if it helps
alleviate the problem. But I would like to publish this application as
a runtime version eventually and I wouldn't know how to implement
changes to other folks registry keys. Yikes.

The command buttons would be a good alternative to the MouseMove
event. I may have to go that route.

So I guess there's no way to disable the hyperlink feature then? (I
need drag & drop, but I can do without the hyperlink onclick
behavior).

Regards,

Fred R@smussen

"Stephen Lebans" <Fo****************************************@linval id.com> wrote in message news:<fe**********************@ursa-nb00s0.nbnet.nb.ca>...
Without even getting into your logic to load the Images(why don't you
use a CommandButton and it's Click event?) I would ask the following
question.

Do you have the "Loading Image" Dialog turned off via the Registry Key
method found here:?
http://www.mvps.org/access/api/api0038.htm

--

Nov 13 '05 #3

P: n/a
Yes, suppressing the loading image dialog will fix your issue.

A search for Drag Drop in the Access NG's will yield several
alternatives on this subject.

There's lots of sample code out there showing how to Modify the
Registry(if you have the necessary permissions).
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Fred R@smussen" <TH**********@spammotel.com> wrote in message
news:65**************************@posting.google.c om...
Stephen,
Thanks for the suggestion regarding the registry key. It would be good
to eliminate that "loading image" dialog, especially if it helps
alleviate the problem. But I would like to publish this application as
a runtime version eventually and I wouldn't know how to implement
changes to other folks registry keys. Yikes.

The command buttons would be a good alternative to the MouseMove
event. I may have to go that route.

So I guess there's no way to disable the hyperlink feature then? (I
need drag & drop, but I can do without the hyperlink onclick
behavior).

Regards,

Fred R@smussen

"Stephen Lebans"

<Fo****************************************@linval id.com> wrote in
message news:<fe**********************@ursa-nb00s0.nbnet.nb.ca>...
Without even getting into your logic to load the Images(why don't you use a CommandButton and it's Click event?) I would ask the following
question.

Do you have the "Loading Image" Dialog turned off via the Registry Key method found here:?
http://www.mvps.org/access/api/api0038.htm

--


Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.