Author Topic: wxTreeCtrl  (Read 22585 times)

Offline Albenejean

  • Multiple posting newcomer
  • *
  • Posts: 65
wxTreeCtrl
« on: January 02, 2008, 07:03:31 pm »
Hi everyone and happy new year!!

I'm currently makink a plugin to improve the Search Result dialog (for now I make a nex one). My goal is to sort the files (header/source) and to display more text from the code around the searched words.

But I have got a little problem. I don't know if it is related to CB or to wxWidget.

When I display my wxFrame with a TreeCtrl inside, the frame stay below CB. I have to click on the frame to make it go on top.
When I click on the wxTreeCtrl, nothing happens. I have to click on the wxFrame.
But when I do not create a wxTreeCtrl, everything is OK.

Any idea?

Here is the code:
Code
SearchResults::SearchResults(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size):
m_pTreeCtrl(NULL)
{
//(*Initialize(SearchResults)
Create(parent, wxID_ANY, _("Search Results"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
SetFocus();
Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
m_pTreeCtrl = new wxTreeCtrl(Panel1, ID_TREECTRL1, wxPoint(0,0), wxSize(400,448), wxTR_DEFAULT_STYLE, wxDefaultValidator, _T("ID_TREECTRL1"));  // <----- When I comment this line, everything is OK
Center();
Show(true);
//*)
}

//AND

SearchResults* SearchResults::Get()
{
    if(!m_pInstance)
    {
        m_pInstance = new SearchResults(Manager::Get()->GetAppWindow());
    }
    return m_pInstance;
}

By the way, I didn't find the EVT_SIZE of my wxFrame. I have to implement this myself (very easy, but..)

[EDIT]: Windows XP SP2
svn 4760

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: wxTreeCtrl
« Reply #1 on: January 02, 2008, 08:05:50 pm »
search the forum for the THreadSearch plug-in, this might already contain what you want to try ;-)

Most likely that plug-in will become part of the contrib plug-ins and as such part of the nightly builds ...

Offline Albenejean

  • Multiple posting newcomer
  • *
  • Posts: 65
Re: wxTreeCtrl
« Reply #2 on: January 02, 2008, 08:16:15 pm »
I'll have a look at it.
Thanks!

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: wxTreeCtrl
« Reply #3 on: January 02, 2008, 10:07:53 pm »
Hi !

Version 1.0 of ThreadSearch plugin is broken since cbeditor/cbstyledtextctrl split. Basically, it is just necessary to add some
Code
#include "cbstyledtextctrl.h"
to make it work.
I updated it on Linux but I can't use my XP laptop to test it. It will be released as soon as tested.

Dje

Offline Albenejean

  • Multiple posting newcomer
  • *
  • Posts: 65
Re: wxTreeCtrl
« Reply #4 on: January 02, 2008, 11:29:28 pm »
I have built it......... That's great!!

I've got some suggestion if you want.
  _ sort these items by the file (and not the directory) so that the header and the source code are together
  _ make it inside a tree (so that we can fold/unfold the results sorted by files)
  _ make it inside a detachable window (or a completly detached window) because seeing the results in a so small window (depending on the resolution) is disappointing

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: wxTreeCtrl
« Reply #5 on: January 02, 2008, 11:50:55 pm »
Look at the options, items 2 and 3 are already available  8)

Offline Albenejean

  • Multiple posting newcomer
  • *
  • Posts: 65
Re: wxTreeCtrl
« Reply #6 on: January 02, 2008, 11:59:14 pm »
Excellent!!

So one last:
  _ move the window containing the code under the one containing the search results. I think that we need more space for the code itself than for the results.

Offline Albenejean

  • Multiple posting newcomer
  • *
  • Posts: 65
Re: wxTreeCtrl
« Reply #7 on: January 03, 2008, 12:01:50 am »
And an other one :
  _ when the window is closed, you memorize th code, but not the search results. It would be great that you memorize both (or that you launch the last search??)

But you've realy made a good job.

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: wxTreeCtrl
« Reply #8 on: January 03, 2008, 12:14:46 am »
  _ when the window is closed, you memorize th code, but not the search results. It would be great that you memorize both (or that you launch the last search??)
Do you mean search history or search results ?
I already thought of saving the search expressions but I'm not keen on saving the search results. Files can be modified outside and would lead to unreliable results at reload. Sometimes, there are lots of results (try a search on wxString in wxWidgets dir... good robustness test  :wink:); I think it's not valuable to store Megabytes of results to the conf files.

Dje

Offline Albenejean

  • Multiple posting newcomer
  • *
  • Posts: 65
Re: wxTreeCtrl
« Reply #9 on: January 03, 2008, 12:32:00 am »
Quote
Files can be modified outside and would lead to unreliable results at reload
I haven't think of this.....

It's just that, the window can take lots of space, and I have the (bad) habit of closing the windows I did'nt need.
But now that I think of that, just a minimize (or hide) button can be sufficient. And a keyboard-shortcut to restore the window of course. So that I can sleep well tonight.............

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: wxTreeCtrl
« Reply #10 on: January 03, 2008, 12:55:40 am »
So, what I'll do :
- _ sort these items by the file (and not the directory) so that the header and the source code are together in the list logger (not the tree)
- _ move the window containing the code under the one containing the search results. I think that we need more space for the code itself than for the results. I'll do it with an option to set splitter mode (horizontal or vertical). Only code preview and logger will be affected by the direction. Buttons and combos will stay on the top of the panel.


Sorry for your night, I won't take any decision concerning the last point _ when the window is closed, you memorize th code, but not the search results. It would be great that you memorize both (or that you launch the last search??)
If you use the list control logger, results are not lost when you close or hide the window (through view menu). You lose them if you work with the tree.
If you work with list control, you can assign directly a shortcut with KeyBinder plugin to the ThreadSearch menu entry of the View menu. That way, you directly have what you're asking for

Dje

Offline Albenejean

  • Multiple posting newcomer
  • *
  • Posts: 65
Re: wxTreeCtrl
« Reply #11 on: January 03, 2008, 01:30:32 am »
That is fine for me.....

Quote
_ when the window is closed, you memorize th code, but not the search results. It would be great that you memorize both (or that you launch the last search??)
Now I prefer
Quote
just a minimize (or hide) button

And I'll make a patch for CB to move the Tabs of the logs to the left (so I have more space).

I found two related bugs (Message Notebook mode).
  _ Open CB, and disable the ThreadSearch with a right click on the Logs "title bar". Re-enable it (with a right click) CB crash.
  _ Open CB. Click on the ThreadSearch, and the disable it. Wait......... Several tabs shows the ThreadSearch window now.

Good night!

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: wxTreeCtrl
« Reply #12 on: January 03, 2008, 09:53:55 am »
Hi !

Quote
_ when the window is closed, you memorize th code, but not the search results. It would be great that you memorize both (or that you launch the last search??)
Now I prefer
I'm not sure to understand what you mean (sorry  :oops:) Could you be more precise ?

Quote
I found two related bugs (Message Notebook mode).
  _ Open CB, and disable the ThreadSearch with a right click on the Logs "title bar". Re-enable it (with a right click) CB crash.
  _ Open CB. Click on the ThreadSearch, and the disable it. Wait......... Several tabs shows the ThreadSearch window now.
I had already seen the second. It is an InfoPane bug. I have to submit it on BerliOS providing my code to be sure the bug is not in mine  :)

Dje

Offline Albenejean

  • Multiple posting newcomer
  • *
  • Posts: 65
Re: wxTreeCtrl
« Reply #13 on: January 03, 2008, 07:07:25 pm »
Quote
Quote from: Albenejean on Today at 12:30:32 AM
Quote
_ when the window is closed, you memorize th code, but not the search results. It would be great that you memorize both (or that you launch the last search??)
Now I prefer
I'm not sure to understand what you mean (sorry  Embarassed) Could you be more precise ?
My **problem** only happens in the detached window mode.
The problem is that when the window is detached it takes too much place on the screen. So when I search something, I ... search, and then I close the window so that I can have a nice look at my code.


But sometimes, I want to go back to the search to look for the next occurence. And.... damned I have closed the window!!!

So what I wanted to have is a window that you can hide without loosing the results. Perhaps you can do it with the Visible property of wxWidget. You can perhaps do the following : check if the window already exists. If no you create it. If it exists you check if it is visible. If no you set it visible. If it is visible, ..... well you have nothing to do.

It would be even more better if you set an option to turn the window automatically invisible when you click outside it.

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: wxTreeCtrl
« Reply #14 on: January 03, 2008, 10:50:26 pm »
Hi !

I released v1.1 of the plugin at this page.

So, I think there may be nothing to do.
@Albenejean
Please test with SVN4767 and ThreadSearch v1.1.

What I did:
- I run C::B
- I configure C::B so that ThreadSearch is managed by the layout and the logger is the TreeCtrl.
- I Clicked on Settings/Editor... then on Keyboard shortcuts
- I select in the Commands tree the Menu bar/View/ThreadSearch command
- I assign Ctrl+T keyboard shortcut to this command
- I click on Ok

And now, I can run searches, use the plugin for previewing/opening files, close the ThreadSearch window with the X button or the menu item View/ThreadSearch or the shortcut Ctrl+T

Another solution is to let the messages notebook manage ThreadSearch panel and show/hide it with F2 (default shortcut).

I am working on XP SP2 but when I see your picture, you may not. If the problem remains, could you tell more on the OS ?

Dje