wxSTC: Writing custom Autocomplete Box

102 views
Skip to first unread message

evstevemd

unread,
Dec 27, 2011, 12:13:07 PM12/27/11
to wx-users
Hi,
can anyone point a place I can start to implement my own Autocomplete
Box? The wxSTC native is good but very limited one and I will be happy
to write custom one. s there a class to inherit and override
something?
Thanks,
Stefano

Eran Ifrah

unread,
Dec 27, 2011, 1:23:11 PM12/27/11
to wx-u...@googlegroups.com
You might want to have a look at codelite's completion box which is a
custom one.

http://codelite.svn.sourceforge.net/viewvc/codelite/trunk/LiteEditor/cc_box.cpp?revision=5375&view=markup
http://codelite.svn.sourceforge.net/viewvc/codelite/trunk/LiteEditor/cc_box.h?revision=5375&view=markup

It works on all major platforms.
Under Windows / Linux it derives from wxPopupWindow, while under Mac
it derives from wxPanel (which has its implications, like the
completion box can not exceed the editor boundaries)

> --
> Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
>
> To unsubscribe, send email to wx-users+u...@googlegroups.com
> or visit http://groups.google.com/group/wx-users

--
Eran Ifrah
Author of the cross platform, open source C++ IDE: http://www.codelite.org
TimeWarden, a parental control software: http://www.smartkoders.com

evstevemd

unread,
Dec 27, 2011, 1:42:00 PM12/27/11
to wx-users
Thanks Eran, let me have a look.

On Dec 27, 9:23 pm, Eran Ifrah <eran.if...@gmail.com> wrote:
> You might want to have a look at codelite's completion box which is a
> custom one.
>
> http://codelite.svn.sourceforge.net/viewvc/codelite/trunk/LiteEditor/...http://codelite.svn.sourceforge.net/viewvc/codelite/trunk/LiteEditor/...
>
> It works on all major platforms.
> Under Windows / Linux it derives from wxPopupWindow, while under Mac
> it derives from wxPanel (which has its implications, like the
> completion box can not exceed the editor boundaries)
>
> On Tue, Dec 27, 2011 at 7:13 PM, evstevemd <mwinjili...@gmail.com> wrote:
> > Hi,
> > can anyone point a place I can start to implement my own Autocomplete
> > Box? The wxSTC native is good but very limited one and I will be happy
> > to write custom one. s there a class to inherit and override
> > something?
> > Thanks,
> > Stefano
>
> > --
> > Please readhttp://www.wxwidgets.org/support/mlhowto.htmbefore posting.
>
> > To unsubscribe, send email to wx-users+u...@googlegroups.com
> > or visithttp://groups.google.com/group/wx-users

evstevemd

unread,
Dec 28, 2011, 9:42:45 AM12/28/11
to wx-users
Hi Eran,
how can Integrate to my app using wxSTC instead of wxScintilla?

On Dec 27, 9:23 pm, Eran Ifrah <eran.if...@gmail.com> wrote:
> You might want to have a look at codelite's completion box which is a
> custom one.
>
> http://codelite.svn.sourceforge.net/viewvc/codelite/trunk/LiteEditor/...http://codelite.svn.sourceforge.net/viewvc/codelite/trunk/LiteEditor/...
>
> It works on all major platforms.
> Under Windows / Linux it derives from wxPopupWindow, while under Mac
> it derives from wxPanel (which has its implications, like the
> completion box can not exceed the editor boundaries)
>
> On Tue, Dec 27, 2011 at 7:13 PM, evstevemd <mwinjili...@gmail.com> wrote:
> > Hi,
> > can anyone point a place I can start to implement my own Autocomplete
> > Box? The wxSTC native is good but very limited one and I will be happy
> > to write custom one. s there a class to inherit and override
> > something?
> > Thanks,
> > Stefano
>
> > --
> > Please readhttp://www.wxwidgets.org/support/mlhowto.htmbefore posting.
>
> > To unsubscribe, send email to wx-users+u...@googlegroups.com
> > or visithttp://groups.google.com/group/wx-users

Eran Ifrah

unread,
Dec 28, 2011, 4:27:45 PM12/28/11
to wx-u...@googlegroups.com
On Wed, Dec 28, 2011 at 4:42 PM, evstevemd <mwinj...@gmail.com> wrote:
> Hi Eran,
> how can Integrate to my app using wxSTC instead of wxScintilla?

I never used wxSTC, but I am pretty sure that it uses the same or
similar API as wxScintilla.

In general, whenever you need to show the completion box just call
CCBox::Show() this method will do the adjustments needed (mainly
positioning)
Obviously you will need to adjust some of the code to fit your needs...

> --
> Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.


>
> To unsubscribe, send email to wx-users+u...@googlegroups.com

> or visit http://groups.google.com/group/wx-users

evstevemd

unread,
Dec 29, 2011, 11:11:39 AM12/29/11
to wx-users
Thanks Eran.
After trying to dig the sources and some google I'm getting the
feeling may be it is hard task to do.
I'm convinced that I have skipped or missed something while diging the
code!


On Dec 29, 12:27 am, Eran Ifrah <eran.if...@gmail.com> wrote:
> On Wed, Dec 28, 2011 at 4:42 PM, evstevemd <mwinjili...@gmail.com> wrote:
> > Hi Eran,
> > how can Integrate to my app using wxSTC instead of wxScintilla?
>
> I never used wxSTC, but I am pretty sure that it uses the same or
> similar API as wxScintilla.
>
> In general,  whenever you need to show the completion box just call
> CCBox::Show() this method will do the adjustments needed (mainly
> positioning)
> Obviously you will need to adjust some of the code to fit your needs...
>
>
>
>
>
>
>
>
>
>
>
> > On Dec 27, 9:23 pm, Eran Ifrah <eran.if...@gmail.com> wrote:
> >> You might want to have a look at codelite's completion box which is a
> >> custom one.
>
> >>http://codelite.svn.sourceforge.net/viewvc/codelite/trunk/LiteEditor/......

Navaneeth

unread,
Dec 31, 2011, 9:40:09 PM12/31/11
to wx-u...@googlegroups.com
If you are ok to choose different control, i think it can be done easily with wxTextCtrl. Look for wxTextCtrl::PositionToCoords. It can give you screen coordinates from a point. Get the caret position from the text control and pass it to the above method. Obtained result can be used to position your custom control.

This is implemented only for wxGtk and wxMSW.

Navaneeth

unread,
Dec 31, 2011, 9:40:12 PM12/31/11
to wx-u...@googlegroups.com

evstevemd

unread,
Jan 1, 2012, 11:59:18 PM1/1/12
to wx-users
Hello Navaneeth and all,
my main problem is how can I replace an AC Box so that I can extend
the functionality like the one Eran provided. as for now I cannot get
how to replace it
I have tried to dig into sources (I will give another try today again)
to see how it is implemented and see if I can do anything but have not
seen it. My plan is not to re write whole autocomplete feature but
replace the box and let STC manage all other stuffs!
Thanks for replying

evstevemd

unread,
Jan 7, 2012, 11:19:02 PM1/7/12
to wx-users
I have tried to dig sources and trace autocomplete and found that
listbox is defined in scintilla as ListBox class. Yet I cannot see the
wxWidgets implementation.
Where can I find the wx implementation? is it the wxListView defined
as wxSTCListBox?

Robin Dunn

unread,
Jan 9, 2012, 3:56:48 PM1/9/12
to wx-u...@googlegroups.com
On 1/7/12 8:19 PM, evstevemd wrote:
> I have tried to dig sources and trace autocomplete and found that
> listbox is defined in scintilla as ListBox class. Yet I cannot see the
> wxWidgets implementation.
> Where can I find the wx implementation? is it the wxListView defined
> as wxSTCListBox?

Yes, plus a few other classes. It all starts here:

http://trac.wxwidgets.org/browser/wxWidgets/trunk/src/stc/PlatWX.cpp#L760

and continues through about line 1360.


--
Robin Dunn
Software Craftsman
http://wxPython.org

evstevemd

unread,
Jan 10, 2012, 8:11:47 AM1/10/12
to wx-users
Great thanks Robin!

On Jan 9, 11:56 pm, Robin Dunn <ro...@alldunn.com> wrote:
> On 1/7/12 8:19 PM, evstevemd wrote:
>
> > I have tried to dig sources and trace autocomplete and found that
> > listbox is defined in scintilla as ListBox class. Yet I cannot see the
> > wxWidgets implementation.
> > Where can I find the wx implementation? is it the wxListView defined
> > as wxSTCListBox?
>
> Yes, plus a few other classes.  It all starts here:
>
> http://trac.wxwidgets.org/browser/wxWidgets/trunk/src/stc/PlatWX.cpp#...
Reply all
Reply to author
Forward
0 new messages