wxSTC Multicursor edit Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2259
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

wxSTC Multicursor edit

Post by evstevemd » Mon Mar 14, 2016 9:31 pm

Hi,
does wxStyledTextCtrl Support for multicursor edit?
I could not find anything in documentation
Attachments
Suplemon_multi_cursor_editing_in_action.gif
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 19.04/Windows 10 Pro/MacOS 10.13 - GCC/MinGW/Clang, CodeLite IDE]

New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 307
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: wxSTC Multicursor edit

Post by New Pagodi » Tue Mar 15, 2016 12:26 am

I've never done any thing like this, but I think what you'd want to do is call:

Code: Select all

SetAdditionalSelectionTyping(true);
Then add extra cursors with

Code: Select all

AddSelection(n1,n1);
m_stc->AddSelection(n2,n2);
...

where n1,n2,... are the positions you want the cursors to be. Then I think any typing will occur at all the cursors. When done, call

Code: Select all

ClearSelections();
to clean up the extra cursors.

You may have to start with a call to

Code: Select all

SetMultipleSelection(true);
to let multiple selections happen.

User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2259
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Re: wxSTC Multicursor edit

Post by evstevemd » Tue Mar 15, 2016 12:29 am

Thank you. I will apply that!
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 19.04/Windows 10 Pro/MacOS 10.13 - GCC/MinGW/Clang, CodeLite IDE]

eranif
Moderator
Moderator
Posts: 606
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Re: wxSTC Multicursor edit

Post by eranif » Tue Mar 15, 2016 5:19 pm

wxSTC supports this:


Adding another selection (Ctrl-K in CodeLite):
https://github.com/eranif/codelite/blob ... .cpp#L5245

You need to enable multiple carets:
https://github.com/eranif/codelite/blob ... r.cpp#L498

And also, enable multiple selection and paste (the ability to paste the same text at multiple locations):
https://github.com/eranif/codelite/blob ... r.cpp#L512
https://github.com/eranif/codelite/blob ... r.cpp#L513

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2259
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Re: wxSTC Multicursor edit

Post by evstevemd » Tue Mar 15, 2016 5:23 pm

Thanks Eran. CL is a really inspiration!
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 19.04/Windows 10 Pro/MacOS 10.13 - GCC/MinGW/Clang, CodeLite IDE]

Post Reply