Class: FileSelector
- Inherits:
-
Object
- Object
- FileSelector
- Defined in:
- lib/libGUIb16.rb,
lib/libGUIb16.rb,
lib/libGUIb14.rb,
lib/libGUIb14.rb
Instance Attribute Summary collapse
-
#__foxGUIb__last__ ⇒ Object
Returns the value of attribute __foxGUIb__last__.
-
#browse ⇒ Object
Returns the value of attribute browse.
-
#currentPattern ⇒ Object
Returns the value of attribute currentPattern.
-
#directory ⇒ Object
Returns the value of attribute directory.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#FileSelector ⇒ Object
Returns the value of attribute FileSelector.
-
#label ⇒ Object
Returns the value of attribute label.
-
#onNewFilenameBlock ⇒ Object
Returns the value of attribute onNewFilenameBlock.
-
#patterns ⇒ Object
Returns the value of attribute patterns.
-
#relative_path ⇒ Object
Returns the value of attribute relative_path.
-
#textfield ⇒ Object
Returns the value of attribute textfield.
-
#title ⇒ Object
Returns the value of attribute title.
-
#topwin ⇒ Object
Returns the value of attribute topwin.
Instance Method Summary collapse
- #construct_widget_tree(parent) ⇒ Object
- #description ⇒ Object
- #description=(text) ⇒ Object
- #init ⇒ Object
-
#initialize(parent) ⇒ FileSelector
constructor
A new instance of FileSelector.
- #onBrowse(*args) ⇒ Object
Constructor Details
#initialize(parent) ⇒ FileSelector
Returns a new instance of FileSelector.
1122 1123 1124 1125 |
# File 'lib/libGUIb16.rb', line 1122 def initialize(parent) (parent) init if respond_to? :init end |
Instance Attribute Details
#__foxGUIb__last__ ⇒ Object
Returns the value of attribute __foxGUIb__last__.
1161 1162 1163 |
# File 'lib/libGUIb16.rb', line 1161 def __foxGUIb__last__ @__foxGUIb__last__ end |
#browse ⇒ Object
Returns the value of attribute browse.
1161 1162 1163 |
# File 'lib/libGUIb16.rb', line 1161 def browse @browse end |
#currentPattern ⇒ Object
Returns the value of attribute currentPattern.
1180 1181 1182 |
# File 'lib/libGUIb16.rb', line 1180 def currentPattern @currentPattern end |
#directory ⇒ Object
Returns the value of attribute directory.
1180 1181 1182 |
# File 'lib/libGUIb16.rb', line 1180 def directory @directory end |
#filename ⇒ Object
Returns the value of attribute filename.
1180 1181 1182 |
# File 'lib/libGUIb16.rb', line 1180 def filename @filename end |
#FileSelector ⇒ Object
Returns the value of attribute FileSelector.
1161 1162 1163 |
# File 'lib/libGUIb16.rb', line 1161 def FileSelector @FileSelector end |
#label ⇒ Object
Returns the value of attribute label.
1161 1162 1163 |
# File 'lib/libGUIb16.rb', line 1161 def label @label end |
#onNewFilenameBlock ⇒ Object
Returns the value of attribute onNewFilenameBlock.
1181 1182 1183 |
# File 'lib/libGUIb16.rb', line 1181 def onNewFilenameBlock @onNewFilenameBlock end |
#patterns ⇒ Object
Returns the value of attribute patterns.
1180 1181 1182 |
# File 'lib/libGUIb16.rb', line 1180 def patterns @patterns end |
#relative_path ⇒ Object
Returns the value of attribute relative_path.
1180 1181 1182 |
# File 'lib/libGUIb16.rb', line 1180 def relative_path @relative_path end |
#textfield ⇒ Object
Returns the value of attribute textfield.
1161 1162 1163 |
# File 'lib/libGUIb16.rb', line 1161 def textfield @textfield end |
#title ⇒ Object
Returns the value of attribute title.
1180 1181 1182 |
# File 'lib/libGUIb16.rb', line 1180 def title @title end |
#topwin ⇒ Object
Returns the value of attribute topwin.
1161 1162 1163 |
# File 'lib/libGUIb16.rb', line 1161 def topwin @topwin end |
Instance Method Details
#construct_widget_tree(parent) ⇒ Object
1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 |
# File 'lib/libGUIb16.rb', line 1127 def (parent) @topwin = FX::HorizontalFrame.new(parent) { |w| @FileSelector = w w.padLeft = 0 w.frameStyle = 0 w.padRight = 0 w.hSpacing = 2 w.height = 21 w.layoutHints = 1024 FX::Label.new(@FileSelector) { |w| @label = w w.text = "File:" w.width = 24 w.x = 0 } FX::TextField.new(@FileSelector) { |w| @textfield = w w.width = 297 w.y = 0 w.layoutHints = 1024 w.x = 26 } FX::Button.new(@FileSelector) { |w| @browse = w w.text = "Browse..." w.padLeft = 4 w.width = 59 w.padRight = 4 w.y = 0 w.x = 325 } } end |
#description ⇒ Object
1186 1187 1188 |
# File 'lib/libGUIb16.rb', line 1186 def description @label.text end |
#description=(text) ⇒ Object
1182 1183 1184 |
# File 'lib/libGUIb16.rb', line 1182 def description=text @label.text = text end |
#init ⇒ Object
1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 |
# File 'lib/libGUIb16.rb', line 1170 def init @title = "File Dialog" @relative_path = false @filename = "" @directory = Dir.getwd @dialog = Fox::FXFileDialog.new(@topwin, @title) @patterns = ["All Files (*)"] @currentPattern = 0 @browse.connect(Fox::SEL_COMMAND, method(:onBrowse)) end |
#onBrowse(*args) ⇒ Object
1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 |
# File 'lib/libGUIb16.rb', line 1190 def onBrowse(*args) @dialog.title = @title @dialog.directory = @directory @dialog.patternList = @patterns @currentPattern = 0 if @currentPattern >= @patterns.size @dialog.currentPattern = @currentPattern @dialog.filename = filename.to_s if @dialog.execute != 0 @filename = @textfield.text = if @relative_path rel_path(Dir.getwd, @dialog.filename) else @dialog.filename end @onNewFilenameBlock.call if @onNewFilenameBlock.respond_to? :call end end |