Thanks for the answer!
If you 're not using the custom code-completion control
Well, I do! But here it comes: I changed to the "default" control (removing the check in the checkbox, right?) and it works! This helps (for the first step).
ed->GetControl()->AutoCompSetFillUps(m_IsAutoPopup ? _T("") : _T(">.;([="));
Isn't this the place where I change when the code completion pops up? I want to change when it closes automatically, so it's the opposite... or am I missing something here?!
Else, for the custom control, in cclist.cpp line 267 insert:
case WXK_SPACE:
Aaaah! I guess that's what I was looking for. It seems I only need to add:
case WXK_SPACE:
{
Destroy();
break;
}
here. But I'm looking into this tomorrow, I'm far too tired for now to run a C::B build. Anyway, posting this here makes sure I've got that information tomorrow morning at work. Sorry for misusing the board as a scratchpad... ;-)
Thanks again, I'll report back...
With regards, Morten.
case WXK_SPACE:
int pos = m_pEditor->GetCurrentPos();
m_pEditor->InsertText(pos, _T(' ')); // I don't remember this by heart, sorry (look it up)
m_pEditor->GotoPos(pos + 1);
Destroy();
break;
I don't remember this by heart, sorry (look it up)
this works fine
case WXK_SPACE:
{
m_pList->AddChar(c);
Destroy();
break;
}
thanks for the tip !
CCList::PositionMe()
doesn't work on dual monitor desktop :(
has anybody any tips how to solve this ?
Yes, by turning PositionMe() into SizeMe() and using PlaceWindow(this, pdlConstrain); instead:
Index: plugins/codecompletion/cclist.cpp
===================================================================
--- plugins/codecompletion/cclist.cpp (revision 2190)
+++ plugins/codecompletion/cclist.cpp (working copy)
@@ -29,6 +29,7 @@
#include <wx/sizer.h>
#include <configmanager.h>
#include <manager.h>
+#include <globals.h>
const wxEventType csdEVT_CCLIST_CODECOMPLETE = wxNewEventType();
@@ -72,6 +73,8 @@
{
m_StartPos = m_pEditor->GetCurrentPos();
PositionMe();
+ PlaceWindow(this, pdlConstrain);
+
int start = m_pEditor->WordStartPosition(m_StartPos, true);
wxString prefix = m_pEditor->GetTextRange(start, m_StartPos);
@@ -106,34 +109,6 @@
if (h > screenH)
h = screenH;
-// now we 're where we want to be, but check that the whole window is visible...
-// the main goal here is that the caret *should* be visible...
-
-// for the horizontal axis, easy stuff
- if (pt.x + w > screenW)
- pt.x = screenW - w;
-
- // for the vertical axis, more work has to be done...
- if (pt.y + h > screenH)
- {
- // it doesn't fit to the bottom of the screen
- // check if it fits to the top
- if (h < pt.y)
- pt.y -= h + lineHeight; // fits
- else
- {
- // we have to shrink the height...
- // determine if pt.y is closer to top or bottom
- if (pt.y <= screenH / 2)
- h = screenH = pt.y; // to top
- else
- {
- h = pt.y - lineHeight; // to bottom
- pt.y = 0;
- }
- }
- }
- // we should be OK now
SetSize(pt.x, pt.y, w, h);
// PlaceWindow(this, pdlConstrain, true);
}
Btw, shouldn't the code completion window also close on '(' or ')'?
I need to define a class constructor:
SafeArray[1]::SafeArray[2](...[3])
Although i suppose it should not pop up there (this is not the problem, i don't mind if it pop ups), the cc window gets closed at [1] when i type the first : of :: and it add a -> (again it's not the problem), then repopups and does not get closed when i type '(' at [2], then repopups with the possible overloaded constructors and does not get closed when i type ')' at [3].
Sometimes the reaction is different, ie at [3] it chooses the first variable declaration and close up.