[ wxwindows-Bugs-1720516 ] toolbar does not get a painting events

SourceForge.net noreply at sourceforge.net
Tue Jun 12 20:24:30 PDT 2007


Bugs item #1720516, was opened at 2007-05-17 00:00
Message generated for change (Comment added) made by oneeyeman
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1720516&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: wxMSW specific
Group: Not a bug
Status: Closed
Resolution: Invalid
Priority: 1
Private: No
Submitted By: ONEEYEMAN (oneeyeman)
Assigned to: Nobody/Anonymous (nobody)
Summary: toolbar does not get a painting events

Initial Comment:
Attached please find the modified files from the docvwmdi sample.

I saw it with the 2.8.1 wxMSW on WinXP SP 2 with MSVC.

Steps to reproduce the problem:
0. Copy new.xpm file from the toolbar sample to the docvwmdi directory.
1. Compile the docvwmdi sample.
2. Run the sample.
3. Click the button on the first toolbar (or select File->New).
4. Select "Drawing" from the list and click OK.
5. Second toolbar will be created along with the drawing view.

Try to click the button on the second toolbar (the one that is being vertical). Nothing happened.
Drag the MDI child window over the second toolbar. The toolbar will be erased on the space you are dragging the mdi child over.

----------------------------------------------------------------------

>Comment By: ONEEYEMAN (oneeyeman)
Date: 2007-06-12 20:24

Message:
Logged In: YES 
user_id=1325635
Originator: YES

Jamie,
Thank you, the event delivery has been resolved.
However, please look at the screenshot.

I believe there is some problem with the positioning of MDIChildFrame
window....

Thank you, again.

P.S.: I know it is not related, I just want to understand why it is
positioned like this, when it should be positioned at the toolbars corner,
and cover all client area of the MDIParent window.
File Added: with_patch.PNG

----------------------------------------------------------------------

Comment By: Jamie Gadd (jrgadd)
Date: 2007-06-08 04:30

Message:
Logged In: YES 
user_id=1193054
Originator: NO

>I do not resize the mdi client window, I just change the position where
it is created. The same way as you. Here is my code:

(code removed that shows that wxMDIClientWindow is somehow the same thing
as wxDocMDIChildFrame)

Um, no. wxMDIClientWindow != wxDocMDIChildFrame

The EVT_SIZE handler showed you that you need to resize the
wxMDIClientWindow. In your latest diff file (which was nearly perfect, much
better this time) you have this code:

wxSize size = GetMainFrame()->GetClientSize();
GetMainFrame()->m_toolbar = new wxToolBar( GetMainFrame(), wxID_ANY,
wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT |
wxTB_VERTICAL );
GetMainFrame()->m_toolbar->AddTool(wxID_NEW, _T("New"), wxBitmap(new_xpm),
wxNullBitmap, wxITEM_NORMAL, _T("New file"), _T("This is help for new file
tool") );
GetMainFrame()->m_toolbar->Realize();
GetMainFrame()->m_toolbar->SetSize( 0, 0, wxDefaultCoord, size.y );

Where is the resizing of the wxMDIClientWindow?

Add these two lines:

int offset = GetMainFrame()->m_toolbar->GetSize().x;
GetMainFrame()->GetClientWindow()->SetSize(offset, 0, size.x - offset,
size.y);

Now as this is common with the code in the EVT_SIZE handler you could
easily make it a seperate function, maybe even call it LayoutChildren() and
call it in your OnSize() function and after you create the second toolbar,
just like in the toolbar sample. Which I'm sure you are very familiar with.

----------------------------------------------------------------------

Comment By: ONEEYEMAN (oneeyeman)
Date: 2007-06-07 21:03

Message:
Logged In: YES 
user_id=1325635
Originator: YES

OK, here are the answers to Jamie's questions:

>1. The second toolbar and the wxMDIClientWindow share the same parent.
>wxWidgets does not support overlapping windows. Where do you resize the
>wxMDIClientWindow?

I do not resize the mdi client window, I just change the position where it
is created. The same way as you.
Here is my code:
  wxDocMDIChildFrame *subframe =
      new wxDocMDIChildFrame(doc, view, GetMainFrame(), wxID_ANY,
_T("Child Frame"),
                             wxPoint(100, 100), wxSize(200, 200),
                             wxDEFAULT_FRAME_STYLE |
                             wxNO_FULL_REPAINT_ON_RESIZE);

>2. Thank you for the screenshots however I understand what the problem
is,
>it is you that cannot understand the solution. Try my bugreport.diff and
>confirm it shows the same problem. You don't need the child frame to see
it
>as you can move any other window over it and it won't repaint, just as
you
>have described. See question 1 for the explaination of why this is.

I put the screenshot out, so you can see the difference in the
implementation. I tried you fix.diff, and it worked. Then I commented out
the EVT_SIZE event handler for main frame (not the mdi child), and it
worked the same way as in my screenshots.
However, as I explained in the previous post you create second toolbar,
and then resize main frame. I resize main frame, and then create the second
toolbar. It brings me to the same position as you fix.diff with the
EVT_SIZE handler commented out.

>3. Where is your diff file with the EVT_SIZE code added? And this time
>read my earlier suggestions about not having code that isn't related to
the
>problem. Why submit a diff file that contains changes to other files in
it?
>And use CVS HEAD for the diff.

1. The sample did not change between WX_2.8 and CVS HEAD.
2. I explained the situiation when tried to answer the questions number
2.Just to show the non-working sample I will attach it. I will explain how
to work with it later on.

>4. Have you even looked at the toolbar sample yet?

I am very familiar with this sample, as I even modified it once for the
patch.

>I'm trying my best here to explain this to you but you are making it
>difficult. Stop changing the status and priority, I can assure you the
bug
>is in your code and not wxWidgets.

OK, I won't change the bugb parameters anymore. I'm also convinced that
this is not a bug itself, since it might be possible to have a workaround
to the problem. What I want to know is where is this workaround? Maybe just
create a toolbar as hidden, and then show it when the mdi child will be
creating?
I don't see any other solution at this point....

OK, I'm attaching the bug_sample1.diff file.




File Added: bug_sample1.diff

----------------------------------------------------------------------

Comment By: Vadim Zeitlin (vadz)
Date: 2007-06-07 16:52

Message:
Logged In: YES 
user_id=71618
Originator: NO

I didn't look at this bug but you seem to totally ignore Jamie's
questions. Why don't you answer them and look carefully at what he's
telling you? Chances are you could learn something. It really doesn't look
you've ever read what he wrote at all.

And, at the very least it looks like this bug has a trivial workaround so
why does it have such high priority?

----------------------------------------------------------------------

Comment By: ONEEYEMAN (oneeyeman)
Date: 2007-06-07 16:46

Message:
Logged In: YES 
user_id=1325635
Originator: YES

Jamie,
Here is the code snippet from your source:

  wxSize size = frame->GetClientSize();
  frame->m_toolbar = new wxToolBar( frame, wxID_ANY, wxDefaultPosition,
wxDefaultSize, wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT | wxTB_VERTICAL );
  frame->m_toolbar->AddTool(wxID_NEW, _T("New"), wxBitmap(new_xpm),
wxNullBitmap, wxITEM_NORMAL, _T("New file"), _T("This is help for new file
tool") );
  frame->m_toolbar->Realize();
  frame->m_toolbar->SetSize( 0, 0, wxDefaultCoord, size.y );

  frame->Centre(wxBOTH);

After creating the second toolbar you're resizing the main frame calling
the EVT_SIZE handler.

In my case, the top window is already re-positioned, which means that
after creating the second toolbar, I don't need to re-position, i.e. call
EVT_SIZE handler. It just un-neccessary.

Thank you.

----------------------------------------------------------------------

Comment By: Jamie Gadd (jrgadd)
Date: 2007-06-07 01:33

Message:
Logged In: YES 
user_id=1193054
Originator: NO

I don't know how else I can explain it to you. How about you start by
answering my questions:

1. The second toolbar and the wxMDIClientWindow share the same parent.
wxWidgets does not support overlapping windows. Where do you resize the
wxMDIClientWindow?

2. Thank you for the screenshots however I understand what the problem is,
it is you that cannot understand the solution. Try my bugreport.diff and
confirm it shows the same problem. You don't need the child frame to see it
as you can move any other window over it and it won't repaint, just as you
have described. See question 1 for the explaination of why this is.

3. Where is your diff file with the EVT_SIZE code added? And this time
read my earlier suggestions about not having code that isn't related to the
problem. Why submit a diff file that contains changes to other files in it?
And use CVS HEAD for the diff.

4. Have you even looked at the toolbar sample yet?

I'm trying my best here to explain this to you but you are making it
difficult. Stop changing the status and priority, I can assure you the bug
is in your code and not wxWidgets.

----------------------------------------------------------------------

Comment By: ONEEYEMAN (oneeyeman)
Date: 2007-06-07 00:55

Message:
Logged In: YES 
user_id=1325635
Originator: YES

File Added: bug_4.PNG

----------------------------------------------------------------------

Comment By: ONEEYEMAN (oneeyeman)
Date: 2007-06-07 00:54

Message:
Logged In: YES 
user_id=1325635
Originator: YES

File Added: bug_3.PNG

----------------------------------------------------------------------

Comment By: ONEEYEMAN (oneeyeman)
Date: 2007-06-07 00:53

Message:
Logged In: YES 
user_id=1325635
Originator: YES

File Added: bug_2.PNG

----------------------------------------------------------------------

Comment By: ONEEYEMAN (oneeyeman)
Date: 2007-06-07 00:52

Message:
Logged In: YES 
user_id=1325635
Originator: YES

Jamie,
please look at the attached screenshots.
The EVT_SIZE handler has absolutely nothing to do with the painting. It
just resizes the window.
When I added the EVT_SIZE to my code, it didn't change anything!

Please look at the attached screenshots to see what is going on...

bug_1 - is after the step 3
bug_2 - is after the step 4
bug_3 and bug_4 describes the bug.

Thank you.

File Added: bug_1.PNG

----------------------------------------------------------------------

Comment By: Jamie Gadd (jrgadd)
Date: 2007-06-06 03:00

Message:
Logged In: YES 
user_id=1193054
Originator: NO

That diff is unusable, have you even read my suggestions?

It makes no difference when you create the 2nd toolbar if you don't handle
the resizing. Where in your code do you resize the wxMDIClientWindow to
adjust for the new toolbar?

Apply bugreport.diff and confirm the behaviour is as you have described
re: the painting.
Now apply fix.diff to a clean sample and see how it works. Remove the
EVT_SIZE event handler and then try it.

Again, this is all demonstrated in the toolbar sample.

----------------------------------------------------------------------

Comment By: ONEEYEMAN (oneeyeman)
Date: 2007-06-05 22:38

Message:
Logged In: YES 
user_id=1325635
Originator: YES

Jamie,
I created the diff to show the problem.
Please apply, then follow the steps in the description of the bug.

It is a little different than your code.
The difference is that my code creates the program with one toolbar only
(main toolbar).
Second toolbar shows up when the view is created.

The idea is to change the toolbar when the view is changing/creating. But
it is a second toolbar, not the first one.

Only the main toolbar should be visible when the program starts.

Thank you
File Added: bug_sample

----------------------------------------------------------------------

Comment By: Jamie Gadd (jrgadd)
Date: 2007-06-02 23:03

Message:
Logged In: YES 
user_id=1193054
Originator: NO

Have another look.

----------------------------------------------------------------------

Comment By: ONEEYEMAN (oneeyeman)
Date: 2007-06-02 21:24

Message:
Logged In: YES 
user_id=1325635
Originator: YES

Jamie,
The code you put on will work. I am not arguing this.
If you tried to run my files, you would've see that I'm creating 2
toolbars: one main toolbar (for the application), and one local toolbar
(for the view command).
The second toolbar (local one) does not get updated. In fact it does not
receive any events/messages at all.
When I looked at your code I found only one toolbar created....

Thank you.

----------------------------------------------------------------------

Comment By: Jamie Gadd (jrgadd)
Date: 2007-06-01 17:43

Message:
Logged In: YES 
user_id=1193054
Originator: NO

File Added: fix.diff

----------------------------------------------------------------------

Comment By: Jamie Gadd (jrgadd)
Date: 2007-06-01 17:42

Message:
Logged In: YES 
user_id=1193054
Originator: NO

This is because you don't adjust the size for the wxMDIClientWindow, see
fix. This is demonstrated clearly in the toolbar sample.

Some suggestions:

Why were these lines included?
        wxSize test = GetMainFrame()->GetClientSize();
        test.y -= 2;
No need for the call to CreateStatusBar()
Don't use TABs
Don't include additional headers unnecessarily e.g. "wx/notebook.h"

I have attached a sample of your files with the excess removed as an
example of how you should submit these in the future. Try and have it in
this format next time please.

File Added: bugreport.diff

----------------------------------------------------------------------

Comment By: ONEEYEMAN (oneeyeman)
Date: 2007-05-17 00:04

Message:
Logged In: YES 
user_id=1325635
Originator: YES

File Added: view.cpp

----------------------------------------------------------------------

Comment By: ONEEYEMAN (oneeyeman)
Date: 2007-05-17 00:02

Message:
Logged In: YES 
user_id=1325635
Originator: YES

File Added: docview.h

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1720516&group_id=9863




More information about the wx-dev mailing list