(SOLVED) IUPScintilla problem

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
Post Reply
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

(SOLVED) IUPScintilla problem

Post by VANYA »

Hi All!

In the image below I showed:
1) In one line, I type 1 TAB (TAB size = 8 spaces on default)
2) In the second line I type 8 spaces

Why such a difference in levels, they have to level off?

Image

---------------------------------------------

And the second question: why, after the reset IupSetAttribute(ih, "STYLECLEARALL", "Yes") , does not the backlighting appear?

Simple code from Joshy:

Code: Select all

#include "crt.bi"
#LibPath "."
#include once "IUP/iup.bi"
#include once "IUP/iup_scintilla.bi"


IupOpen(0,0)
IupScintillaOpen()

var ih = IupScintilla()

IupSetAttribute(ih, "STYLEFONT32", "Consolas")
IupSetAttribute(ih, "STYLEFONTSIZE32", "11")

IupSetAttribute(ih, "STYLECLEARALL", "Yes") ' Problem!!!!!!!!

IupSetAttribute(ih, "LEXERLANGUAGE", "freebasic")

IupSetAttribute(ih, "KEYWORDS0", "dim if print then var")

IupSetAttribute(ih, "STYLEFONT32", "Consolas")
IupSetAttribute(ih, "STYLEFONTSIZE32", "11")

' some styles
IupSetAttribute(ih, "STYLEFGCOLOR1", "0 160 0")    ' comment
IupSetAttribute(ih, "STYLEFGCOLOR2", "0 160 160")  ' number
IupSetAttribute(ih, "STYLEFGCOLOR3", "0 0 160")    ' keywords
IupSetAttribute(ih, "STYLEFGCOLOR4", "160 0 0")    ' string
IupSetAttribute(ih, "STYLEFGCOLOR6", "255 128 0")  ' operator
IupSetAttribute(ih, "STYLEFGCOLOR7", "128 128 0")  ' preprocessor
IupSetAttribute(ih, "STYLEFGCOLOR19", "128 128 128")  ' block comment

IupSetAttribute(ih, "MARGINWIDTH0", "50")
IupSetAttribute(ih, "MARGINSENSITIVE1", "YES")

IupSetAttributes(ih,"EXPAND = YES")

IupSetAttribute(ih, "VALUE",  !"' comment\nvar number = 123\nprint \"hello world\"\n#if 0\n nothing\n#endif\n/' block comment '/\n\if number >= 10 then print \">=10\"")

var dlg = IupDialog(ih)
IupSetAttributes( dlg, "TITLE = IupDialog, RASTERSIZE = 640x480" )
IupShow(dlg)
IupMainLoop()

IupClose()
At what I do not think, that business in library, after all at the author FreeBasic IDE-poseidonFB everything works fine. There is some kind of cunning, but what kind?

P.S. I use the current version IUP. Tried on three OS, everywhere the result is unsatisfactory :(
Last edited by VANYA on Sep 15, 2017 6:13, edited 1 time in total.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: IUPScintilla problem

Post by VANYA »

I found this trick :))))))))))))))))))

For those who will face such a problem:

All scintilla attributes should be set after the call and showing of the main dialog!

That's how it works as it should:

Code: Select all

#include "crt.bi"
#LibPath "."
#include once "IUP/iup.bi"
#include once "IUP/iup_scintilla.bi"

IupOpen(0,0)
IupScintillaOpen()

var ih = IupScintilla()

Var dlg = IupDialog(ih)
IupSetAttributes( dlg, "TITLE = IupDialog, RASTERSIZE = 640x480" )
IupShow(dlg)

'----------------- Only now you need to set the attributes scintilla!!! --------------------------------

IupSetAttribute(ih, "STYLEFONT32", "Courier new")
IupSetAttribute(ih, "STYLEFONTSIZE32", "11")

IupSetAttribute(ih, "STYLECLEARALL", "Yes") ' ...............No Problem!!!!!!!!

IupSetAttribute(ih, "LEXERLANGUAGE", "freebasic")

IupSetAttribute(ih, "KEYWORDS0", "dim if print then var")

' some styles
IupSetAttribute(ih, "STYLEFGCOLOR1", "0 160 0")    ' comment
IupSetAttribute(ih, "STYLEFGCOLOR2", "0 160 160")  ' number
IupSetAttribute(ih, "STYLEFGCOLOR3", "0 0 160")    ' keywords
IupSetAttribute(ih, "STYLEFGCOLOR4", "160 0 0")    ' string
IupSetAttribute(ih, "STYLEFGCOLOR6", "255 128 0")  ' operator
IupSetAttribute(ih, "STYLEFGCOLOR7", "128 128 0")  ' preprocessor
IupSetAttribute(ih, "STYLEFGCOLOR19", "128 128 128")  ' block comment

IupSetAttribute(ih, "MARGINWIDTH0", "50")
IupSetAttribute(ih, "MARGINSENSITIVE1", "YES")

IupSetAttributes(ih,"EXPAND = YES")

IupSetAttribute(ih, "VALUE",  !"' comment\nvar number = 123\nprint \"hello world\"\n#if 0\n nothing\n#endif\n/' block comment '/\n\if number >= 10 then print \">=10\"")

'-----------------------------------------------------------------------------------------------

' main loop

IupMainLoop()

IupClose()
Kuan Hsu
Posts: 586
Joined: Sep 16, 2007 15:12
Location: Taiwan

Re: IUPScintilla problem

Post by Kuan Hsu »

If scintilla is not expand as we want, use iupRefresh to refresh our attributes setting
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: IUPScintilla problem

Post by VANYA »

Kuan Hsu wrote:If scintilla is not expand as we want, use iupRefresh to refresh our attributes setting
Thanks for the advice
Post Reply