09.03.2015 Views

An IVIB Primer - Unicon

An IVIB Primer - Unicon

An IVIB Primer - Unicon

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

handle_cut<br />

Create a new file myeditabletextlist.icn and copy in the following code:<br />

_____________________________________<br />

#<br />

# myeditabletextlist subclass of EditableTextList to<br />

# allow clipboard operation in Cut/Copy?paste<br />

#<br />

import gui<br />

link graphics<br />

import undo<br />

$include "guih.icn"<br />

class myeditabletextlist : EditableTextList()<br />

method handle_cut(e)<br />

start_handle(e)<br />

if has_region() then {<br />

copy_to_clipboard(get_region())<br />

delete_region(e)<br />

}<br />

end_handle(e)<br />

end<br />

method handle_copy(e)<br />

start_handle(e)<br />

if has_region() then {<br />

copy_to_clipboard(get_region())<br />

}<br />

end_handle(e)<br />

end<br />

#_______________________________________________________________<br />

method copy_to_clipboard(l)<br />

local large_str, i<br />

if /l | *l = 0 then fail<br />

large_str := l[1]<br />

every i := 2 to *l do<br />

large_str ||:= l[i]<br />

WAttrib("selection=" || large_str)<br />

return large_str<br />

end<br />

#________________________________________________________________<br />

method get_list_from_clipboard()<br />

local large_str, l, str,start,blank1,tab1,p<br />

blank1 := ' '<br />

36

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!