One property missing in laptop, why?

Post

Posted
Rating:
#1 (In Topic #1303)
Regular
sergioabreu is in the usergroup ‘Regular’
I have gambas in two machines: a PC and a laptop
Both run Xubuntu 18. In PC is all right. In laptop strangelly the property TextEditor.Styles[ selection (2) ]  is not available.
The property value 2 there turns CurrentLine, which is actulally 3 in PC.

Results of this: In the laptop, I can not customize the selection color  (broken component?) and all properties are shifted the value "1 less".

If I dump TextEditor.Style, it jumps Selection property in laptop:

Code

On PC:                        ON laptop:
---------------------------------------------------
Normal = 0                    Normal = 0
Background = 1                Background = 1
Selection = 2                 Currentline = 2
Currentline = 3               Breakpoint = 3
Breakpoint = 4

Any ideas why and how to fix?
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
Different versions of gambas.
Laptop has a newer version.

Highlight.Selection is now depreciated and no longer a settable property.

Try is a good way to handle it…

Code (gambas)

  1. Try hStyle[Highlight.Selection].Color = iWhatever
  2.  

then it works on older gambas and fails without an error on newer versions.

Or just do not use it.

Read this reply from Benoit…  Re: TextEditor themes, Selection and IDE Background
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
sergioabreu is in the usergroup ‘Regular’
Benoit: The TextEditor checks its background color to see if it is light or dark, and normally adapts the selection background color so that it is still visible.

Still visible but <COLOR color="#0000FF">no longer customizable</COLOR>. Older version became better than the new one.

This <COLOR color="#BF0040">brought another inconvenient</COLOR>: as the Styles list<COLOR color="#0000BF"> has changed the number and order of indexes</COLOR>!!  String is 16 in one project and 15 in other

They could stop implementing the selection, but WHY TO REMOVE the array item changing order and length of an important object ???

If the white background uses <COLOR color="#0000FF">blue</COLOR> selection I think that dark themes should (as inversion) use something towards yellow, not the same as white background.
Online now: No Back to the top

Post

Posted
Rating:
#4
Regular
sergioabreu is in the usergroup ‘Regular’
How do I copy the older version to Laptop ? :D
Online now: No Back to the top

Post

Posted
Rating:
#5
Guru
BruceSteers is in the usergroup ‘Guru’
The way forward is to stop using TextEditor.Styles completely, the method changed to using the TextEditor.Theme property instead.

Due to the new nature of gb.highlight that can use many custom state names the Styles constants are kinda obsoleted.

Instead of Style constants we use the theme state keywords.
so not
TextEditor1.Style[Highlight.Background].Color

Now it's…
TextEditor1.Theme["Background"].Color

you can list the available State names with TextHighlighter[sName].States something like this…

Code (gambas)

  1. Dim sCurrentTheme As String = TextEditor1.Highlight  ' get TextEditor1 current theme name.
  2. If Not sCurrentTheme Or If sCurrentTheme = "none" Then Return
  3.  
  4. Dim aStates As String[] = TextHighlighter[sCurrentTheme].States
  5.  
  6. For Each sStateName As String In aStates
  7.   Print sStateName, "Color=";; TextEditor1.Theme[aStateName].Color
  8.  


Yeah I wasn't too keen on loosing Selection property but hey ho,

For the most part gb.highlight and the custom theme ability is a big improvement to the old method of a few hard coded highlight themes.
Online now: No Back to the top

Post

Posted
Rating:
#6
Guru
BruceSteers is in the usergroup ‘Guru’

sergioabreu said

How do I copy the older version to Laptop ? :D

Haha , DON'T DO IT!!!!

Upgrade the code to the new way and upgrade the older gambas :)
Online now: No Back to the top
1 guest and 0 members have just viewed this.