Alternate for Richedit

Working on new editor enhancements?
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Alternate for Richedit

Post by GPI »

This one could be intressting:

http://www.scintilla.org/

I don't have now a deeper look, but there is talking about folding and many more stuff.

Code: Select all

o Text retrieval and modification
o Searching and replacing
o Overtype
o Cut, copy and paste
o Error handling
o Undo and Redo
o Selection and information
o Scrolling and automatic scrolling
o White space
o Cursor
o Mouse capture
o Line endings
o Styling
o Style definition
o Caret, selection, and hotspot styles
o Margins
o Other settings
o Brace highlighting
o Tabs and Indentation Guides
o Markers
o Indicators
o Autocompletion
o User lists
o Call tips
o Keyboard commands
o Key bindings
o Popup edit menu
o Macro recording
o Printing
o Direct access
o Multiple views
o Folding
o Line wrapping
o Zooming
o Long lines
o Lexer
o Notifications
o Deprecated messages
o Edit messages never supported by Scintilla
o Building Scintilla
and the best one: For windows and linux. So it could be chance to make one editor for both versions.

Take a look

GPI
User avatar
fsw
Addict
Addict
Posts: 1572
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

As easy as...

Post by fsw »

Code: Select all

; test of using the Schintilla library for an editor
; all Scintilla commands can be used by Sendmessage_(bla,bla...
; or directly with pointers to the Scintilla commands...

Procedure SciEditGadget(hwndParent,x,y,w,h)
  hmod = OpenLibrary(1, "SciLexer.dll") 
  If (hmod) = 0
    MessageRequester( "Error loading Scintilla", "The Scintilla DLL could not be loaded.", #MB_OK | #MB_ICONERROR)
  Else
    hInstance = GetModuleHandle_(0)
    hwndScintilla = CreateWindowEx_(0, "Scintilla"," ", #WS_CHILD|#WS_VISIBLE|#WS_TABSTOP,x,y,w,h,hwndParent,0,hInstance,0)
  EndIf
  ProcedureReturn hwndScintilla
EndProcedure

If OpenWindow(0, 100, 100, 320,240, #PB_Window_SystemMenu ,"PureBasic Test Window")

;create Edit Gadget
SciEditGadget(WindowID(),10,10,300,200)

  Repeat
    EventID.l = WaitWindowEvent()
  Until EventID = #PB_EventCloseWindow
EndIf

End
Franco
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

How can i set the Focus to the Scitella-Editor, so that the user can start to write without click in the gadget...

SerFocus_() doesn't work!
User avatar
fsw
Addict
Addict
Posts: 1572
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

GPI wrote:How can i set the Focus to the Scitella-Editor, so that the user can start to write without click in the gadget...

SerFocus_() doesn't work!
Hi GPI, SetFocus works fine for me.
What you have to do before using SetFocus is to tell Scintilla on which line he is...
For Windows use this:

Code: Select all

  SendMessage_(hwndScintilla, #SCI_GOTOLINE, 0, 0)
  SetFocus_(hwndScintilla)
This works for me.

I have already build an Editor with Scintilla and it works great!
The File stuff and the Edit stuff (undo,redo,cut,copy,paste etc.) was really easy to implement. Also to set the LineNumber Margin.
The only thing I have to find out now is how to initialize the Lexer for the Keywords and the other gimmicks.
If you have a tip - I would be very thankful :wink:

Franco
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

Now SetFocus works, but it doesn't (and i had set the pos with gotopos...)

As always: Don't ask -> Acept.

Btw: Try to Tab and Shift+Tab. It doesn't work, but i found a workaround to get work this.

About Lexer: I'm read at the moment the complete doc and create functions for easier calls.

At the moment i'm at the tab-section!

(Brace-highlightning works :)
User avatar
fsw
Addict
Addict
Posts: 1572
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

AutoCompletition works :D
User avatar
fsw
Addict
Addict
Posts: 1572
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

If somebody has to much free time on his hand, he could test this:

fsw.home.attbi.com/fsw-editor.zip

Some (a lot... :wink: ) things are not yet implemented, such as:
auto highlight of keywords, tab-key, folding etc.

But it's a start...
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

Ok, i will test.

btw: Auto-instert-Spaces at the beginning after IF, While, Repeat, Procedure,IF, etc. and remove spaces after endif, etc. For automatic formated sourcodes :)
User avatar
fsw
Addict
Addict
Posts: 1572
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

GPI wrote: btw: Auto-instert-Spaces at the beginning after IF, While, Repeat, Procedure,IF, etc. and remove spaces after endif, etc. For automatic formated sourcodes :)
:o 8)

It seems you are way ahead pal... :wink:
User avatar
fsw
Addict
Addict
Posts: 1572
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Please be patient with me, I'm a old slow learner :?
User avatar
fsw
Addict
Addict
Posts: 1572
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

ARGH, tabs are really not working - hope this is the only bug in Scintilla ...

UPDATE
Got a workaround working for tabs :idea:
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

Create, for example, a buttongadget and try Shift+Tab :)

GPI
User avatar
fsw
Addict
Addict
Posts: 1572
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

GPI wrote:Create, for example, a buttongadget and try Shift+Tab :)

GPI
You lost me :?

What do you mean :?:

Shift+Tab on the PureBasic Editor (even GPI mod 5b) and nothing happens...
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

Btw: My very, very experimental version:
http://caosandkin.bei.t-online.de/pureb ... r-test.zip

When you past lines, these lines are also new-formated.

When you select some text and the press TAB. This will start a reformat of the beginning of the lines.

try to write something like this:
if
asdfasdf
else
asdffas
endif


GPI
User avatar
fsw
Addict
Addict
Posts: 1572
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

GPI wrote:Btw: My very, very experimental version:
http://caosandkin.bei.t-online.de/pureb ... r-test.zip
just downloaded it
When you past lines, these lines are also new-formated.
try to write something like this:
if
asdfasdf
else
asdffas
endif
hmm, this seems to work fine 8)
When you select some text and the press TAB. This will start a reformat of the beginning of the lines.
nothing special happens here (Win2K)
Also pressing the test button - nothing happens.

have to take more time and look at your code...

Wenn du was erklaeren willst (kannst das aber nicht so gut in englisch) dann kannst du es auch in deutsch schreiben)
PS - sorry, aber ich kenn mich nicht aus mit der neuen rechtschreibreform.

BTW. GPI Editor 5b crashes on Win2K after some minutes
Post Reply