Dear all,
in a GUI, I want to display some text from inside a text file in a text
field.
When starting the application, it looks roughly like this
################
filelist window
################
contents of file:
################
text field
################
Now, as the user chooses some file from above, its text should
appear inside the text field (which it does) and the name of the
file should appear above it, changing
contents of file: to contents of file: my_file.txt, if that’s
the name of the file.
I’ve searched the archive of the mailing lists, and found
a way to add a label , to recalc everything and to create the
whole frame anew:
class YourWidget < FXVerticalFrame
def addLabel(parent,text)
FXLabel.new(parent, text) do |label|
label.create
end
self.recalc
end
end
So I use :
class Mainwindow
def initialize
…
@header=‘contents of file’
@topFrame = FXVerticalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y)
@header_line=FXLabel.new(@topFrame, @header, nil, LAYOUT_FILL_X)
…
end
def loadFile
…
@header=self.addLabel(@topFrame,'Contents of file ’ + @filename)
…
end
end
but I can’t change the content of @header in its original place. How
could
that
be done ?
Thank you very much!
Best regards,
AXel