Class: ValueRap
- Inherits:
-
Object
- Object
- ValueRap
- Defined in:
- ext/ae-rad/ae-rad-inspector.rb
Overview
class PTkEntryButton
def initialize(_host, _agobj, _prop)
do_update = proc{
@etextvalue = @prop['type'].procReturn
@agobj.updatep(@prop['name'], @etextvalue)
@propobj.configure('text'=>@etextvalue, 'background'=>@etextvalue)
}
@button = TkButton.new(_host){
text '...'
font $arcadia['conf']['inspectors.inspector.value.font']
place('x' => 20 ,'relheight'=>1, 'relwidth'=>0.5, 'bordermode'=>'outside', 'anchor'=>'e')
}
@etext = TkVariable.new(_prop['get'].call.to_s)
@entry = TkEntry.new(_host, 'textvariable'=>@etext){
relief 'groove'
font $arcadia['conf']['inspectors.inspector.value.font']
place('relheight'=>1, 'relwidth'=>0.5, 'bordermode'=>'outside')
}
end
def setpropvalue(_value)
@propobj.configure('text'=>_value)
@etextvalue = _value
end
def destroy
@entry.destroy
@etext.destroy
@button.destroy
end
end
Instance Attribute Summary collapse
-
#handlervalue ⇒ Object
readonly
Returns the value of attribute handlervalue.
-
#labelkey ⇒ Object
readonly
Returns the value of attribute labelkey.
-
#labelvalue ⇒ Object
readonly
Returns the value of attribute labelvalue.
Instance Method Summary collapse
- #do_manage(_type) ⇒ Object
- #free ⇒ Object
-
#initialize(_parent, _prop, _text = nil) ⇒ ValueRap
constructor
A new instance of ValueRap.
- #recicle(_family, _agobj, _prop) ⇒ Object
- #reset_last ⇒ Object
- #updatevalue(_text) ⇒ Object
Constructor Details
#initialize(_parent, _prop, _text = nil) ⇒ ValueRap
Returns a new instance of ValueRap.
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'ext/ae-rad/ae-rad-inspector.rb', line 258 def initialize(_parent, _prop, _text = nil) @parent = _parent; #@host = _parent.pwind.right_frame #Tk.messageBox('message'=>_prop) @agobj = _parent.agobj @family = _parent.family @prop = _prop if _text == nil _text = _prop['get'].call.to_s end @text = _text if !defined? @parent.lasthandlervalue @parent.lasthandlervalue = 0 end @labelkey = TkLabel.new(@parent.right_text,Arcadia.style('label').update({ 'text' => _text, 'justify' => 'right', 'anchor' => 'w', #'width'=>15, #'font'=> $arcadia['conf']['inspectors.inspector.value.font'], 'borderwidth'=>'1', 'relief'=>'groove' })) TkTextWindow.new(@parent.right_text, 'end', 'window'=> @labelkey) @labelkey.pack('fill'=>'x',:padx=>0, :pady=>0) @parent.right_text.insert('end',"\n") @labelkey.bind("ButtonPress-1", proc{ if @prop['set'] != nil do_manage(@prop['type'].class.to_s) else do_manage('ReadOnly') end }) end |
Instance Attribute Details
#handlervalue ⇒ Object (readonly)
Returns the value of attribute handlervalue.
256 257 258 |
# File 'ext/ae-rad/ae-rad-inspector.rb', line 256 def handlervalue @handlervalue end |
#labelkey ⇒ Object (readonly)
Returns the value of attribute labelkey.
257 258 259 |
# File 'ext/ae-rad/ae-rad-inspector.rb', line 257 def labelkey @labelkey end |
#labelvalue ⇒ Object (readonly)
Returns the value of attribute labelvalue.
256 257 258 |
# File 'ext/ae-rad/ae-rad-inspector.rb', line 256 def labelvalue @labelvalue end |
Instance Method Details
#do_manage(_type) ⇒ Object
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'ext/ae-rad/ae-rad-inspector.rb', line 328 def do_manage(_type) if @parent.lasthandlervalue != 0 @parent.lasthandlervalue.free(defined? @labelkey) end case _type when 'EnumType' @handlervalue = TkEnumType.new(@labelkey, @family, @agobj, @prop) when 'ProcType' @handlervalue = TkProcType.new(@labelkey, @family, @agobj, @prop) when 'StringType' @handlervalue = TkStringType.new(@labelkey, @family, @agobj, @prop) when 'EnumProcType' @handlervalue = TkEnumProcType.new(@labelkey, @family, @agobj, @prop) when 'ReadOnly' @handlervalue = TkReadOnly.new(@labelkey) else @handlervalue = TkStringType.new(@labelkey, @family, @agobj, @prop) end @parent.lasthandlervalue = @handlervalue end |
#free ⇒ Object
302 303 304 305 306 307 |
# File 'ext/ae-rad/ae-rad-inspector.rb', line 302 def free _reset_last = @handlervalue == @parent.lasthandlervalue @labelkey.destroy if defined? @labelkey @handlervalue.free if @handlervalue == @parent.lasthandlervalue @parent.lasthandlervalue = 0 if _reset_last end |
#recicle(_family, _agobj, _prop) ⇒ Object
309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'ext/ae-rad/ae-rad-inspector.rb', line 309 def recicle(_family, _agobj, _prop) @agobj = _agobj @family = _family @prop = _prop if _prop['value'] != nil @text = _prop['value'] else @text = _prop['get'].call.to_s end @parent.lasthandlervalue = 0 if @parent.lasthandlervalue == @handlervalue @handlervalue.free(false,@text) if defined? @handlervalue @labelkey.configure('text' => @text) end |
#reset_last ⇒ Object
298 299 300 |
# File 'ext/ae-rad/ae-rad-inspector.rb', line 298 def reset_last @parent.lasthandlervalue = 0 end |
#updatevalue(_text) ⇒ Object
323 324 325 326 |
# File 'ext/ae-rad/ae-rad-inspector.rb', line 323 def updatevalue(_text) @labelkey.configure('text'=>_text) @text = _text end |