LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Firing Click Events with Accelerators

Hi
Ok we have resolved the issue - at least a good part of it.

With scenario 1, optYes and optNo, the control cboVehReg is responsible for
calling the optbuttons and it has an Exit event with a Cancel=True statement.
If optNo is selected, focus is switched back to cboVehReg, its data string
is cancelled and because of that Cancel = True and focus remains there. I
found if I placed the optNo.Visible=False in the cboVehReg_Exit event
everything worked as required.

With scenario 2, the single button to simply hide itself. There are no Exit
events prior to the optbutton call so I used your suggested Application.
Ontime statement. This worked.

Whether the errors were caused by focus or time is still not entirely clear
but at least now I have 2 methods with which to tackle the rest of the
projects optbuttons.

Many thanks for the original suggestion and for staying with the problem
which then emerged. Like another correspondent stated in the 'msgbox
transient' thread I am very grateful to the participants of this group for
the tremendous support it gives to the little guy. Thank you also Bob for
the kindness in looking at the form as a whole by email, I shall respond
further by email.

Geoff

"Geoff" wrote:

Hi
In short - still no. In both cases the optNo proc completes but without
calling for HideControl. Therefore no error is generated but the buttons
remian visible.

One thing I had not mentioned before; my original code for optYes_Change
included a LookUp function. Since using the GetAsyncKeyState code I have had
to place this function in the new optYes_Enter event else an error was
generated in the optYes_Change event

Private Sub OptYes_Enter()

If GetAsyncKeyState(vbKeyMenu) And &H8000 Then optYes.Value = True
OpenSpeedo = WorksheetFunction.VLookup(cboVehReg.Value,
Sheets(3).Range("G1").CurrentRegion, 3, False)

End Sub

It seems as though only certain things can be done within the optbutton
change event under these circumstances. In numerous new code tests I have
also had problems with SetFocus statements. The curious thing of course is
the original code worked with the mouse.

The differences in execution a in the mouseup event, focus will be
directed to the optbutton, disregarding where it was prior to the click, the
procedure completes but focus is not returned to the previous position. In
other words the mouse click forces a 'GotFocus' condition. Maybe with the
GetAsyncKeyState code, focus may well be only diverted and the previous
control has not 'LostFocus'. This might explain the SetFocus problems. But
I do not understand why some statements are executed in the optNo proc. What
is different about Visible and VLookup. With VLookup it seems reasonable to
propose that focus is being switched to another object ie the worksheet but
can that be said of the Visible property?

I shall focus my efforts on focus mechanics:):)

Thanks so far

Geoff
"okaizawa" wrote:

Hi,

Geoff wrote:
I too thought it may be a timing issue but the interesting thing now is the
HideControl sub is not being called. There is no error now as the proc is
not being called and therefore there is no attempt to hide the buttons. It
is at the hide point the Visible error occurs.


set a break point on the line:

Application.OnTime Now(), "HideControl"

If the macro stops at the point, the procedure name might be different
or conflict.
try something like:
(assuming 'HideControl' is in 'Module1' in the same workbook)

Application.OnTime Now, "'" & ThisWorkbook.Name & "'!Module1.HideControl"

--
HTH,

okaizawa

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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
Deactivate Events not Firing William Excel Programming 12 July 5th 05 05:12 AM
Excel App. level events not firing Chris W. Excel Programming 1 February 28th 05 03:44 AM
class events stop firing with ADO 2.8 ThankYou_jeff Excel Programming 4 November 14th 04 10:59 AM
Click events on charts Steve Excel Programming 3 May 29th 04 03:26 AM
Events firing willy nilly Darren Hill[_2_] Excel Programming 4 January 23rd 04 10:00 PM


All times are GMT +1. The time now is 02:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"