Developer forums (C::B DEVELOPMENT STRICTLY!) > Contributions to C::B
BOUNTY: Notebook class with "close" button at the right
Ceniza:
Good news: the current version compiles under Linux (after the few minor fixes, namely an address operator missing and a case mismatch in a #include).
Bad news: adding a new page makes it crash (the crash point is a bit unclear, maybe a wxGTK problem).
The last point still in this library is wxFlatNotebook.cpp line 364:
--- Code: ---return m_pages->GetClientSize();
--- End code ---
eranif: about the second issue: the main problem is not that it isn't drawing at least a truncated tab, the problem is it's crashing if you try to scroll :)
mandrav:
--- Quote from: eranif on January 04, 2006, 08:08:10 pm ---I will apply the patch you sent me ASAP...
--- End quote ---
No need anymore. It's old (from last night :)).
eranif:
--- Quote ---Good news: the current version compiles under Linux (after the few minor fixes, namely an address operator missing
--- End quote ---
Already fixed: an '&' was missing before the address of the callback function in the drag'n'drop constructor and will be published on the next release
mandrav:
From the diff i mainly see that you added an overloading function with notify flag set to true for DeletePage(page, notify), and RemovePage(), however, this is not needed anymore since I already fixed the code couple a days ago that when closing a page, and event will be sent AND will be handled properly (including veto by the event handler).
You also added an event firing when pressing on mouse middle click - also not needed, since the DeletePage() function is always sending an event
Correct me if I am wrong here.
Eran
eranif:
Sorry for posting again - but I am on the roll here!
Ceniza:
--- Quote ---Bad news: adding a new page makes it crash (the crash point is a bit unclear, maybe a wxGTK problem).
--- End quote ---
Try in Frame.cpp, in OnAddPage() to change this line:
--- Code: ---wxTextCtrl *text = new wxTextCtrl(book, wxID_ANY, caption, wxDefaultPosition, book->GetPageBestSize(),
wxTE_MULTILINE);
--- End code ---
to
--- Code: ---wxTextCtrl *text = new wxTextCtrl(book, wxID_ANY, caption, wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE);
--- End code ---
I dont have Linux box yet ( will have one tomorrow though :) )
Let me know if it helped,
Eran
mandrav:
--- Quote from: eranif on January 04, 2006, 08:35:17 pm ---From the diff i mainly see that you added an overloading function with notify flag set to true for DeletePage(page, notify), and RemovePage(), however, this is not needed anymore since I already fixed the code couple a days ago that when closing a page, and event will be sent AND will be handled properly (including veto by the event handler).
You also added an event firing when pressing on mouse middle click - also not needed, since the DeletePage() function is always sending an event
Correct me if I am wrong here.
--- End quote ---
Sure :)
You 're testing the notebook with your sample app and that's fine. I 'm testing it in a real-world app, C::B itself which is quite a beast.
So you 're wondering why I need these bool notify=true arguments in DeletePage() and RemovePage(), as well as a couple of extra notifications?
[*] C::B handles itself the lifetime of its editors. We don't want the notebook destroying the object without C::B knowing. That's why I added the notification in OnMiddleClick().
[*] If I don't add the bool notify=true arguments in DeletePage() and RemovePage(), C::B either crashes with a stack overflow or deletes two pages instead of one (depending where the CLOSING notification came from). C::B communicates with wxFlatNotebook using its messages and so the messaging system needs to be well-defined.
[*] Finally, I 've added a new message wxEVT_COMMAND_FLATNOTEBOOK_CONTEXT_MENU, instead of using SetRightClickMenu(). The popup menu C::B displays when right-clicking on a tab is dynamic, i.e. it changes based on the current file's state. So we need the notebook to notify C::B when a context menu needs to be displayed and then we let C::B do its magic.
[/list]
I 'm not criticizing you, I just patched the source as needed to make it co-operate nicely with C::B :)
Ultimately, it's up to you to decide what goes in your main distribution package and what stays out ;)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version