Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!aioe.org!.POSTED!not-for-mail From: "Phil" Newsgroups: comp.databases.ms-access Subject: Re: Getting control names by passing the mouse over them. Date: Mon, 4 Apr 2011 23:07:10 +0100 Organization: Aioe.org NNTP Server Lines: 49 Message-ID: References: NNTP-Posting-Host: tzJWApdsynISXhvcCDnD1w.user.speranza.aioe.org X-Complaints-To: abuse@aioe.org X-Antivirus-Status: Clean X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: NewsMan Pro 3.0.4 (Freeware) X-Antivirus: avast! (VPS 110404-1, 04/04/2011), Outbound message Xref: x330-a1.tempe.blueboxinc.net comp.databases.ms-access:810 On 04/04/2011 01:45:41, "Stuart McCall" wrote: > "Phil" wrote in message > news:inaso6$2ah$1@speranza.aioe.org... >>I have a number of controls in the detail section of a form, each control >> corresponding to an individual record in a table (Spaces). The controls >> are >> all named something like "Space001", "Space002" ... "Space120". Got bored >> after that There is a field in the table called "Selected". >> When a drag the mouse over any number of controls, I want to change >> Selected >> to true if it is false, and vice-versa. >> >> >> Problem appears to be that as I drag the mouse over a single control, the >> MouseMove keep "firing". How do I "switch it off" until I hit the next >> control? Thanks >> Phil > > Use a static variable to see if the control has changed since the last > mouse move notification: > > Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As > Single, Y As Single) > > Static CtlName As String > Dim Ctl As Control > > If Button And acRightButton Then > For Each Ctl In Me.Section(acDetail).Controls > If X >= Ctl.left And X <= Ctl.left + Ctl.Width Then > If Y >= Ctl.top And Y <= Ctl.top + Ctl.Height Then > If Ctl.Name <> CtlName Then > Call SaveSelect(CInt(right(Ctl.Name, 3))) > CtlName = Ctl.Name > End If > End If > End If > Next Ctl > End If > > End Sub > Thanks Stuart. That bit works perfectly Still having problems if the images are overlapping (or completely covering each other). All my images are transparent, so I can see the image indeneath, but not neccessarily be able to pick it up. Will do some more research ans come back Thanks again Phil