Class: VREdit

Inherits:
VRStdControl show all
Defined in:
lib/vr/vrcontrol.rb,
lib/vr/compat/vrcontrol.rb

Direct Known Subclasses

VRText

Constant Summary collapse

WINCLASSINFO =

VREdit

Edit Control.

Methods

--- text Gets Text in the control. Line break(\r\n) is translated by this method. --- text=(str) Sets Text in the control. Line break is translated by this method. --- getSel Returns [start_pos,end_pos] of the selected area. --- setSel(st,en,noscroll=0) Sets the selected area specified by ((|st|)) as start point and ((|en|)) as end point and Scrolls to show the area. When ((|noscroll|)) is 1, it doesn't scroll. --- setCaret(r) Sets cursor point at ((|r|)) --- replaceSel(newstr) Replaces text in the selected area with ((|newstr|)). --- readonly=(b) Sets readonly flag as boolean ((|b|)) --- limit Gets the length limit of this Editbox. --- limit=(lmt) Sets the length limit of this Editbox. --- modified Returns true if the editbox text is modified by user. --- modified=(f) Sets modified flag of the editbox. --- cut Cuts the selected area into clipboard. --- copy Copies the selected area into clipboard. --- paste Paste the clipboard text into the editbox. --- clear Clears selected area text. Use (()) method to set the text into clipboard. --- undo Undo the previous cut/copy/paste/clear action.

Event handlers

Editboxes invoke the following method of parent window. --- ????_changed This parent's method is fired when editbox text is modified.

["EDIT",WStyle::ES_AUTOHSCROLL,WExStyle::WS_EX_CLIENTEDGE]
VR_REGEXPNEWLINE =

change linebreak code caption,caption= methods is raw methods

"\r\n"

Instance Attribute Summary

Attributes inherited from VRControl

#handlers, #name, #parent

Attributes inherited from VRWinComponent

#parent, #screen

Instance Method Summary collapse

Methods inherited from VRStdControl

#_vr_cmdhandlers, #addCommandHandler, #deleteCommandHandler

Methods inherited from VRControl

Controltype, #add_parentcall, #call_parenthandler, #create, #setFont

Methods inherited from VRWinComponent

#_init, #create, #exwinstyle, #hide, #maximizebox, #maximizebox=, #minimizebox, #minimizebox=, #setscreen, #sizebox, #sizebox=, #tabstop, #tabstop=, #winstyle

Instance Method Details

#clear ⇒ Object



421
422
423
# File 'lib/vr/vrcontrol.rb', line 421

def clear
  sendMessage 0x303,0,0  #CLEAR
end

#copy ⇒ Object



415
416
417
# File 'lib/vr/vrcontrol.rb', line 415

def copy
  sendMessage 0x301,0,0  #COPY
end

#cut ⇒ Object

for clipboard and so on..



412
413
414
# File 'lib/vr/vrcontrol.rb', line 412

def cut
  sendMessage 0x300,0,0  #CUT
end

#getSel ⇒ Object



362
363
364
365
# File 'lib/vr/vrcontrol.rb', line 362

def getSel
  r=sendMessage(0xb0,0,0)
  return LOWORD(r),HIWORD(r)
end

#limit ⇒ Object



387
388
389
# File 'lib/vr/vrcontrol.rb', line 387

def limit
  sendMessage 0xd5,0,0
end

#limit=(lmt) ⇒ Object



384
385
386
# File 'lib/vr/vrcontrol.rb', line 384

def limit=(lmt)
  sendMessage 0xc5,lmt.to_i,0
end

#modified ⇒ Object Also known as: modified?



391
392
393
394
# File 'lib/vr/vrcontrol.rb', line 391

def modified
  r=sendMessage 0xb8,0,0              #GETMODIFY
  if r==0 then false else true end
end

#modified=(f) ⇒ Object



396
397
398
399
# File 'lib/vr/vrcontrol.rb', line 396

def modified=(f)
  r= if f then 1 else 0 end
  sendMessage 0xb9,r,0
end

#paste ⇒ Object



418
419
420
# File 'lib/vr/vrcontrol.rb', line 418

def paste
  sendMessage 0x302,0,0  #PASTE
end

#readonly=(b) ⇒ Object



379
380
381
382
# File 'lib/vr/vrcontrol.rb', line 379

def readonly=(b)
  f= (b)? 1 : 0
  sendMessage 0xcf,f,0
end

#replaceSel(newstr) ⇒ Object



375
376
377
# File 'lib/vr/vrcontrol.rb', line 375

def replaceSel(newstr)
  sendMessage(0xc2,0,newstr.to_s)
end

#setCaret(r) ⇒ Object



367
368
369
# File 'lib/vr/vrcontrol.rb', line 367

def setCaret(r)
  setSel(r,r)
end

#setSel(st, en, noscroll = 0) ⇒ Object



371
372
373
# File 'lib/vr/vrcontrol.rb', line 371

def setSel(st,en,noscroll=0)
  sendMessage(0xb1,st,en)
end

#text ⇒ Object



405
# File 'lib/vr/vrcontrol.rb', line 405

def text() self.caption.gsub(/#{VR_REGEXPNEWLINE}/,$/); end

#text=(str) ⇒ Object



406
407
408
# File 'lib/vr/vrcontrol.rb', line 406

def text=(str) 
  self.caption = str.gsub(/([^\r])\n/,'\1'+VR_REGEXPNEWLINE)
end

#undo ⇒ Object



424
425
426
# File 'lib/vr/vrcontrol.rb', line 424

def undo
  sendMessage 0x304,0,0  #UNDO
end

#vrinit ⇒ Object



357
358
359
360
# File 'lib/vr/vrcontrol.rb', line 357

def vrinit
  super
  addCommandHandler(0x300,"changed",MSGTYPE::ARGNONE,nil)
end

#vrinitnew ⇒ Object



6
7
8
9
# File 'lib/vr/compat/vrcontrol.rb', line 6

def vrinit
  super
  addCommandHandler(0x300,"changed",MSGTYPE::ARGNONE,nil)
end