Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
wxWidgets 3.1.2 Released
oBFusCATed:
Cool thanks.
Would it be possible to add the kill focus event to the stc sample?
So there is an easy way to test our use case in the future.
New Pagodi:
I've started a thread on the problems with autocompletion on the wxdev list here if anyone wants to join in.
But I guess none of those changes proposed there will help with with getting codeblocks to work with wxWidgets 3.1.2. In order to do that, somehow the old popup behavior has to be restored in codeblocks itself - at least until 3.1.3. Looking over the codeblocks sources, I think the easiest way to do that is to define a popup class in src/sdk/wxscintilla/src/PlatWX.cpp between
--- Code: ---#if wxUSE_POPUPWIN //-----------------------------------
#include "wx/popupwin.h"
--- End code ---
and
--- Code: ---// A popup window to place the wxSCIListBox upon
class wxSCIListBoxWin : public wxPopupWindow
--- End code ---
Here's the a cut and paste of the old popupwindow code with a few minor modifications:
--- Code: ---#ifdef __WXMSW__
#include "wx/msw/private.h" // for GetDesktopWindow()
class wxNonActivatingPopupWindow : public wxPopupWindowBase
{
public:
wxNonActivatingPopupWindow() { }
wxNonActivatingPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE)
{ (void)Create(parent, flags); }
bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
virtual void SetFocus() wxOVERRIDE;
virtual bool Show(bool show = true) wxOVERRIDE;
// return the style to be used for the popup windows
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const wxOVERRIDE;
// get the HWND to be used as parent of this window with CreateWindow()
virtual WXHWND MSWGetParent() const wxOVERRIDE;
};
bool wxNonActivatingPopupWindow::Create(wxWindow *parent, int flags)
{
// popup windows are created hidden by default
Hide();
return wxPopupWindowBase::Create(parent) &&
wxWindow::Create(parent, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
flags | wxPOPUP_WINDOW);
}
WXDWORD wxNonActivatingPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const
{
// we only honour the border flags, the others don't make sense for us
WXDWORD style = wxWindow::MSWGetStyle(flags & wxBORDER_MASK, exstyle);
if ( exstyle )
{
// a popup window floats on top of everything
*exstyle |= WS_EX_TOPMOST | WS_EX_TOOLWINDOW;
}
return style;
}
WXHWND wxNonActivatingPopupWindow::MSWGetParent() const
{
// we must be a child of the desktop to be able to extend beyond the parent
// window client area (like the comboboxes drop downs do)
//
// NB: alternative implementation would be to use WS_POPUP instead of
// WS_CHILD but then showing a popup would deactivate the parent which
// is ugly and working around this, although possible, is even more
// ugly
return (WXHWND)::GetDesktopWindow();
}
void wxNonActivatingPopupWindow::SetFocus()
{
// Focusing on a popup window does not work on MSW unless WS_POPUP style is
// set (which is never the case currently, see the note in MSWGetParent()).
// We do not even want to try to set the focus, as it returns an error from
// SetFocus() on recent Windows versions (since Vista) and the resulting
// debug message is annoying.
}
bool wxNonActivatingPopupWindow::Show(bool show)
{
if ( !wxWindowMSW::Show(show) )
return false;
if ( show )
{
// raise to top of z order
if (!::SetWindowPos((HWND)GetHWND(), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE))
{
wxLogLastError(wxT("SetWindowPos"));
}
// and set it as the foreground window so the mouse can be captured
::SetForegroundWindow((HWND)GetHWND());
}
return true;
}
// temporarily define wxPopupWindow to be the new class
#define wxPopupWindow wxNonActivatingPopupWindow
#endif //__WXMSW__
--- End code ---
The class can obviously be renames as needed. I've tested this with wxSTC, but I don't know how to compile codeblocks to see if it works there too.
oBFusCATed:
Thanks, for us it would probably be easier if we patch our version of wx3.1.2 after your fixes are approved.
ollydbg:
--- Quote from: New Pagodi on January 06, 2019, 06:47:36 am ---I've started a thread on the problems with autocompletion on the wxdev list here if anyone wants to join in.
But I guess none of those changes proposed there will help with with getting codeblocks to work with wxWidgets 3.1.2. In order to do that, somehow the old popup behavior has to be restored in codeblocks itself - at least until 3.1.3. Looking over the codeblocks sources, I think the easiest way to do that is to define a popup class in src/sdk/wxscintilla/src/PlatWX.cpp between
--- Code: ---#if wxUSE_POPUPWIN //-----------------------------------
#include "wx/popupwin.h"
--- End code ---
and
--- Code: ---// A popup window to place the wxSCIListBox upon
class wxSCIListBoxWin : public wxPopupWindow
--- End code ---
Here's the a cut and paste of the old popupwindow code with a few minor modifications:
...
The class can obviously be renames as needed. I've tested this with wxSTC, but I don't know how to compile codeblocks to see if it works there too.
--- End quote ---
Hi, I just tested it with you suggested changes, it works without crash with wx3.1.2, thanks!
Miguel Gimenez:
I'm using C::B with New Pagodi's patch and CC works OK, but sometimes the caret disappears while editing: you can't see it, but typing works normally. The only way to make it visible again is changing focus to another window and then to the current window.
If I disable CC this does not happen. I can't test without the patch because C:B crashes.
Using Windows 7 64 bits, wx3.1.2 32 bits, revision 11552.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version