Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 3rd, 2003, 04:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default buggy event firing in ActiveX controls

I've got a problem with click events not firing as they should when I set the value of checkboxes, combos and radio buttons within code (by doing, say, checkbox.value = true, or combo.ListIndex = 1 etc). The value is set just fine, but the click event never fires. This happens in the IDE and when its all compiled.

The ActiveX controls in question are embedded in other ActiveX controls of mine. The only other things they contain are standard VB controls such as text boxes, frames, labels, command buttons.

I've got a workaround for it, but just wondered whether anyone else had experienced this and got to the bottom of it?

I'm running VB6 with SP5 on XP Pro.

Phil
Reply With Quote
  #2 (permalink)  
Old July 9th, 2003, 01:53 AM
Authorized User
 
Join Date: Jul 2003
Location: Hyderabad, Andhra Pradesh, India.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

As per my knowledge, u might not have included events for the controls u used in Activex control. To do so include events for the control thru activex interface wizard. or include an event for the activex control and map it to all Controls.

Public event Click()

Using activex interface wizrd map this event to all ur existing controls in ur activex control.If this solution does't help u pls write ur problem clearly and post it.

B.V.Kumar
Reply With Quote
  #3 (permalink)  
Old July 9th, 2003, 02:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi B.V. Kumar, and thanks for trying to help.

I don't want these events to be exposed outside of the control, I just want them to work properly inside the control. Here's an example of what is not working:

Inside one ActiveX control I have two radio buttons, lets call them A and B. When A is clicked I have code inside the click event that makes a text box, call it C, appear. When B is clicked, the code in the click event makes C disappear. This all works fine when its running and user is clicking the radio buttons with the mouse, or selecting them with the keyboard.

But it doesn't work if I set the value in code. For instance when I first show the control, I read what the value should be from a database and then set the value to be either A or B, by doing A.value = True, or B.value = True and the problem is that this doesn't fire the click event, so C is not being displayed correctly.

Hope that makes sense.
Thanks
Phil
Reply With Quote
  #4 (permalink)  
Old July 9th, 2003, 08:53 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Sparks, NV, USA.
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jlick
Default

Well, If you are setting the value in code, then you can simply call the event procedure yourself. You know what you are setting the value to, so when you change the value, call the event.

John R Lick
JohnRLick@hotmail.com
Reply With Quote
  #5 (permalink)  
Old July 9th, 2003, 08:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote:Originally posted by jlick
 Well, If you are setting the value in code, then you can simply call the event procedure yourself. You know what you are setting the value to, so when you change the value, call the event.

John R Lick
JohnRLick@hotmail.com
Yes, I realise that. That is the workaround I mentioned in the original post. The point is that I shouldn't have to do that, the event should fire when I set the value in code. Thanks anyway.
Reply With Quote
  #6 (permalink)  
Old July 9th, 2003, 12:48 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Now I understand your problem.
I have the same issue when I first initialize (or instantiate) the control,
I believe because we set the property before the control is ready to
receive events. DO not ask me why...

Because I do not want to fire multiple events, this is my workaround.
I declare a private boolean m_bSkipEvents and set to true at the beginning of
the initialization process. In the Click event, exit right away if the variable
is True, otherwise call a sub in which I put the code that was once in the
event method. In the initialization, call this new sub directly, and set the value
of your control (that at this point skip everything even if they receive the
event.) Set the skipEvent to false at the end of the initialization.
Cumbersome, but it works.

Marco

(like Button_Click). Set to false
Quote:
quote:Originally posted by pgtips
 
Quote:
quote:Originally posted by jlick
Quote:
 Well, If you are setting the value in code, then you can simply call the event procedure yourself. You know what you are setting the value to, so when you change the value, call the event.

John R Lick
JohnRLick@hotmail.com
Yes, I realise that. That is the workaround I mentioned in the original post. The point is that I shouldn't have to do that, the event should fire when I set the value in code. Thanks anyway.
Reply With Quote
  #7 (permalink)  
Old July 10th, 2003, 02:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote:I believe because we set the property before the control is ready to
receive events.
Thanks for that Marco, maybe that is the reason - kinda makes sense.

Phil
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
selectedindexchanged event not firing kaliaparijat ASP.NET 2.0 Professional 1 June 5th, 2008 08:58 AM
Event Firing tobriain C# 1 June 12th, 2007 08:19 AM
Custom event not firing flegel ASP.NET 2.0 Professional 0 February 23rd, 2007 06:31 AM
onSelectedIndexChanged event not firing??? MTLedari ASP.NET 2.0 Basics 5 December 19th, 2006 10:35 AM
OnSelectedIndexChanged event not firing ethertt77 ASP.NET 2.0 Basics 2 February 20th, 2006 07:34 PM



All times are GMT -4. The time now is 09:40 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.