entry.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
---------------------------> Sather 1.1 source file <--------------------------
-- entry.sa: Entry widget
-- Author: Benedict A. Gomes <gomes@samosa.ICSI.Berkeley.EDU>
-- Copyright (C) 1995, International Computer Science Institute
-- entry.sa,v 1.1 1995/11/15 03:36:40 gomes Exp
--
-- COPYRIGHT NOTICE: This code is provided WITHOUT ANY WARRANTY
-- and is subject to the terms of the SATHER LIBRARY GENERAL PUBLIC
-- LICENSE contained in the file: Sather/Doc/License of the
-- Sather distribution. The license is also available from ICSI,
-- 1947 Center St., Suite 600, Berkeley CA 94704, USA.


class TK_ENTRY_CFG

class TK_ENTRY_CFG is include TK_WIDGET_CFG_INCL background->background, foreground->foreground, font->font, char_width->char_width, borderwidth->borderwidth, justify_left->justify_left,justify_right->justify_right, justify_center->justify_center, relief_none->relief_none,relief_raised->relief_raised, relief_sunken->relief_sunken, relief_flat->relief_flat,relief_ridge->relief_ridge, relief_groove->relief_groove, highlightcolor->highlightcolor, highlightbackground->highlightbackground, highlightthickness->highlightthickness, insertwidth->insertwidth, insertborderwidth->insertborderwidth, text->text, width->width, selectforeground->selectforeground, selectbackground->selectbackground, selectborderwidth->selectborderwidth; std: SAME is return new.relief_sunken end; variable(v:TK_VAR) is config("textvariable",v.str) end; variable(v:TK_VAR):SAME is variable(v); return self; end; end;

class TK_ENTRY < $TK_WIDGET

class TK_ENTRY < $TK_WIDGET is -- Entry widget -- Example usage: -- e := #TK_ENTRY; -- e.set_text("Some initial text"); -- e.bind_enter_key(bind(entered_text)); -- The routine "entered_text" may be defined as below -- entered_text is -- #OUT+"Entered text into entry widget:"+e.get_data+"\n"; -- end; include TK_WIDGET_INCL{TK_ENTRY_CFG}; private attr command: ROUT; -- Redefined from TK_WIDGET_INCL const tk_widget_type: STR := "entry"; private default_config: TK_ENTRY_CFG is return TK_ENTRY_CFG::std end; bind_enter_key(action: ROUT{TK_EVENT_INFO}) is bind_event(TK_KEY_EVENT::Press.Return,action); end; set_text(s:STR) is length: INT := GUI_APP_END::eval(widget_name+" get").length; eval(widget_name,"delete 0",length); eval(widget_name,"insert 0",quote(s)) end; get_text: STR is return GUI_APP_END::eval(widget_name+" get") end; end; -- class TK_ENTRY