473,480 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

event disappearing

Hi,

I have a really frustrating problem....

I have a custom windows form control that contains a collection of
controls, these controls in turn contain other controls, a titlebar for
example a client scrollable area etc. My component needs to be able to
generate a custom click (cardpanelclicked) event that has a custom
eventargs class that shows which control was clicked, and what area of
the control was clicked, so this means I need to have my contained
classes propogate up through the parent controls....with me so far ?

Now the thing is, this works fine if I step through the code in the
debugger, however when I run the app normally the event does not fire
or actually it may, it may just be the paint event getting lost, I
can't tell for sure as when I debug, it works as designed....I am doing
my head in on this, please help if you can !!!
Regards Tim.

PS in groping at straws mode I have tried a DoEvents() and also a
Thread.Sleep(100) as well, to no avail.
Nov 16 '05 #1
11 1824
Tim Jarvis wrote:
Hi,

I have a really frustrating problem....

I have a custom windows form control that contains a collection of
controls, these controls in turn contain other controls, a titlebar
for example a client scrollable area etc. My component needs to be
able to generate a custom click (cardpanelclicked) event that has a
custom eventargs class that shows which control was clicked, and what
area of the control was clicked, so this means I need to have my
contained classes propogate up through the parent controls....with me
so far ?

Now the thing is, this works fine if I step through the code in the
debugger, however when I run the app normally the event does not fire
or actually it may, it may just be the paint event getting lost, I
can't tell for sure as when I debug, it works as designed....I am
doing my head in on this, please help if you can !!!
Regards Tim.

PS in groping at straws mode I have tried a DoEvents() and also a
Thread.Sleep(100) as well, to no avail.


Nov 16 '05 #2
"Tim Jarvis" <Ti*******@newsgroup.nospam> wrote in message
news:ua**************@TK2MSFTNGP09.phx.gbl...
Now the thing is, this works fine if I step through the code in the
debugger, however when I run the app normally the event does not fire
or actually it may, it may just be the paint event getting lost, I
can't tell for sure as when I debug, it works as designed


Debug.WriteLine is handy for debugging this kind of problem.

Tim
..NET pros and cons
http://www.itwriting.com/phorum/list.php?f=6
Nov 16 '05 #3
Hi Tim,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that the custom event was not fired when the
app is running in release mode. However, in debug mode, it works fine. If
there is any misunderstanding, please feel free to let me know.

If it fires in debug mode, I think it has to be fired also in release mode.
Could you please post some of your code here for an example, so that I can
try to repro it on my machine? It will be more quickly for us to deliver
our assistance with some source code. Thanks!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #4
Kevin Yu [MSFT] wrote:
Hi Tim,

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that the custom event was not
fired when the app is running in release mode. However, in debug
mode, it works fine. If there is any misunderstanding, please feel
free to let me know.

If it fires in debug mode, I think it has to be fired also in release
mode. Could you please post some of your code here for an example,
so that I can try to repro it on my machine? It will be more quickly
for us to deliver our assistance with some source code. Thanks!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


Hi Kevin,

Nope, that's not it. I have not tried it in release mode, it is that
the event does not fire when the app is run normally (or in the IDE)
but does fire when stepping through the code in the debugger.

In fact further investigation tells me that it is in fact just the
paint message that is being lost, I do indeed have several
debug.writeline messages ( thanks for the suggestion Tim A, but had
already done that) and that is writing a debug message in the custom
event, however at the end of the event handling code I invalidate the
control to repaint, its this that is being eaten, however when stepping
through the code, on resumption the paint works fine.

The code is part of a very large project with tendrils that run very
deep and connect to an OPF, to extract the control will be very time
consuming (probably a day or so, conservatively)....which I might have
to resort to, but if you can help without it in the first instance that
would be fab.

Regards Tim.
Nov 16 '05 #5
Tim Anderson wrote:
Debug.WriteLine is handy for debugging this kind of problem.


Thanks Tim,

Yeah have several of them, actually they do print, so the event is
firing, my wording of my question was poor...Its the paint message that
is being eaten, the final event handler in the chain does some stuff
and then invalidates the control for a repaint, its this that is not
happening. (and as you probably know, in a custom control the meat and
potatoes is in the paint)

The weird thing is this does paint correctly after a break, and step
through the code, just not without a break.

Cheers Tim.
Nov 16 '05 #6

"Tim Jarvis" <Ti*******@newsgroup.nospam> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
Tim Anderson wrote:
Its the paint message that
is being eaten, the final event handler in the chain does some stuff
and then invalidates the control for a repaint, its this that is not
happening. (and as you probably know, in a custom control the meat and
potatoes is in the paint)


There are some flags that determine how a control paints. Have a look at the
help entry for the ControlStyles enumeration. Is it possible that a
different setting could fix the issue? These are normally set in the
constructor.

Tim
IE share declining - does it make a difference?
http://www.itwriting.com/blog/?postid=106
Nov 16 '05 #7
Hi Tim,

Besides Tim A's advice, I think you can also check the watch window. Some
methods might be called in it which makes the event firing working properly
when debugger stops on some breakpoints. Believe me, it's quite hard to
debug on this kind of problem without seeing a repro.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #8
Kevin Yu [MSFT] wrote:
Hi Tim,

Besides Tim A's advice, I think you can also check the watch window.
Some methods might be called in it which makes the event firing
working properly when debugger stops on some breakpoints. Believe me,
it's quite hard to debug on this kind of problem without seeing a
repro.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


Yeah I know, this is the worst kind of issue to have, when the act of
debugging changes the outcome (In this case makes the problem go away)

I will see if its possible to create a test case that duplicates the
problem and post it up.
Cheers Tim

Nov 16 '05 #9
Tim Anderson wrote:


There are some flags that determine how a control paints. Have a look
at the help entry for the ControlStyles enumeration. Is it possible
that a different setting could fix the issue? These are normally set
in the constructor.


Thanks Tim, yeah I know about those, I am am in fact using double
buffering, so have set some flags i.e. userpaint, double buffer and
allpaintinginwmpaint, I also have set the repaint on resize flag as
well. And of course one of the first things I looked at was those
flags, sadly that is not the issue.

the stucture of the control is a container type contol that contains a
collection of panels, these panels in turn contain a collection of
categorys which are just panels them selves except they are scrollable,
the panels all contain a title bar as well, so you are probaly getting
the picture controls in controls in controls, and what I need to do to
produce a click event in the top level control is pass it up the chain
about 3 levels, and it seems to work fine, just loses the paint at the
end......very frustrating.

Kevin has asked for a test case that reproduces the problem, which is
entirely reasonable (that's what I ask for when it's me on that side of
the fence) I am going to try and do that in the morning.

Cheers Tim.

Nov 16 '05 #10
Thanks for your cooperation, Tim. Could you also check if this happens on
another machine if you copy all the project files to it?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #11
Kevin Yu [MSFT] wrote:
Thanks for your cooperation, Tim. Could you also check if this
happens on another machine if you copy all the project files to it?

Hi Kevin,

I have resolved the issue. In the process of creating a test case I
found a workround.

The issue is I was modifying a subproperty, this subproperty, modifies
an internal value that is used in the painting, in this case a gradient
start color and a gradient end color (in another case a position within
the container), now what seems to be happening is that because the
properties sub property is modified a subsequent invalidate must think
there is nothing to do.

i.e. ....some stuff....

TitleColor.StartColor = Color.White;
TitleColor.EndColor = Color.DodgerBlue;
......some more stuff....
Invalidate();

does not repaint.

My workround was....

GradientColor grCol = new GradientColor(Color.White,Color.DodgerBlue);
TitleColor = grCol;

Now the invalidate works.

(note GradientColor is my own custom helper glass, that just holds the
start and end colors the gradient mode, and generates a gradient brush
for me)

Now I don't know if this is a GDI+ bug or designed behaviour, I can
certainly see that an invalidate should only fire if required, however
this is an issue if as in my case its easily fooled...

Anyway, thanks for your help, its much appreciated. I hope that this
workround helps someone else in the same predicament.

Regards Tim.
Nov 16 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1879
by: R0bert Neville | last post by:
My web page has one unordered list that disappears in Firefox. The unordered list in question has the class="dir". I double-checked the source code and verified the markup's semantics. Everything...
1
1670
by: .Net Sports | last post by:
Periodically, my project dll inside the bin folder keeps disappearing (????) , which creates a "Cannot load type myproject.global " error . ????? ..NetSports
5
5782
by: Tom Louchbaum | last post by:
When I preview my Access 2000 Report it looks fine. When I Email the report using DoCmd.SendObject acSendReport, "Report", acFormatRTF, "To Address", , , "Subject", , False the resulting...
2
4073
by: neptune | last post by:
I built a form to access a query with a 2 field primary key. It should use 2 controls to find the unique record and display the other field values on the form. In the criteria section of the...
2
2591
by: Rachel Suddeth | last post by:
Here is my scenario: I have a few custom controls that I set up on a form and tested setting properties and appearances. Then I added a couple references to the project which add classes I need to...
6
1609
by: Winshent | last post by:
I have read many threads which indicate that this was a problem with version 2002. Why should i be suffering this? I am using VB.NET 2003 Standard Edition... is it still a problem with 2003? ...
0
5707
by: Oz | last post by:
Hi Using VS.NET 2003, Windows XP SP1, We have a page which has been developed using ASP.NET. On it, is a button which when clicked is supposed to add some data to a table. When the button is...
2
1337
by: Calvin KD | last post by:
Hi everyone, Can someone help me in stopping .NET from removing event handler declarations for controls on an aspx page please. This has been causing a lot of headaches as things just mysteriously...
0
3404
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
Like many people, I normally use Yahoo! Mail via the web and like to keep all my emails stored on the Yahoo! server. However sometimes I can’t get access to a PC/the web and I download my emails...
0
7033
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5318
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4468
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2974
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
557
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
170
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.