Change TabStops to customize indent function

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Change TabStops to customize indent function

Post by BackupUser »

Code updated for 5.20+

Restored from previous forum. Originally posted by Eddy.

My 2nd contribution :)
usefull for IDE development

Code: Select all

;**********************************************
    SIZE_TAB = 100 *15 ; 100px = 1500 twip

    pf.PARAFORMAT
    pf\cbSize = SizeOf(PARAFORMAT)
    pf\dwMask = #PFM_TABSTOPS
    pf\cTabCount = #MAX_TAB_STOPS

    For i = 0 To pf\cTabCount-1 ; Set tab stops every SIZE_TAB
     pf\rgxTabs[i] = (i+1) * SIZE_TAB
    Next
    SendMessage_(*MyGadget,#EM_SETPARAFORMAT,#MAX_TAB_STOPS,@pf)
;**********************************************



;To specify TAB_SIZE With spaces width..:)
;**********************************************
    StartDrawing(WindowOutput(0))
    DrawingFont(FontID(0))
    SIZE_TAB = TextWidth(Space(EditorTabSize)) *15
    StopDrawing() 
special thanks to PLOUF

-> sig removed
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by plouf.

offcource dont forget to StopDrawing() after you started it
i.e. here, after
SIZE_TAB = TextLength(Space(EditorTabSize)) *15
:)

Christos
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Eddy.

yes

PB BB IDE
Post Reply