Forked from anonymous/FXRuby FXText syled text bug.rb
Created
January 2, 2013 11:07
-
-
Save larskanis/4433842 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#encoding: utf-8 | |
require 'fox16' | |
include Fox | |
class HelloWindow < FXMainWindow | |
def initialize(app) | |
ventana = super(app, "Hello, World!", width: 600, height: 400) | |
MiFXText.new(ventana) | |
end | |
def create | |
super | |
show(PLACEMENT_SCREEN) | |
end | |
end | |
###################################################################################### | |
class MiFXText < FXText | |
def initialize(widget_padre) | |
super(widget_padre, opts: TEXT_READONLY|TEXT_WORDWRAP|TEXT_AUTOINDENT|LAYOUT_FILL|LAYOUT_FIX_WIDTH, width: 550) | |
self.styled = true | |
appendStyledText('Observaciones: ', FXText::STYLE_UNDERLINE, true) | |
insertStyledText(4, 'LALA', FXText::STYLE_BOLD) | |
appendText('The text widget supports editing of multiple lines of text. An optional style table can provide text coloring based on the contents of an optional parallel style buffer, which is maintained as text is edited. In a typical scenario, the contents of the style buffer is either directly written when the text is added to the widget, or is continually modified by editing the text via syntax-based highlighting engine which colors the text based on syntactical patterns.') | |
changeStyle(0, 5, FXText::STYLE_UNDERLINE) | |
#p styled? | |
p getStyle(54) #HERE! EVERYTHING CRASH!, the other comments are for seeing purpose, make it code and you will see what happen | |
#p textStyle | |
#p FXText::STYLE_UNDERLINE | |
#p FXText::STYLE_BOLD | |
#textStyle=(4) | |
#p textStyle | |
#styled=(true) | |
end | |
end | |
###################################################################################### | |
if __FILE__ == $0 | |
FXApp.new do |app| | |
HelloWindow.new(app) | |
app.create | |
app.run | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Lars, I've been aside of FXRuby for a while, was giving a walk across here and see this open yet. Jeroen answered that this is fixed en 1.7.* version. Since we are using 1.6.* here(not very sure) this will continue.