From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d7cf74c4bc43088a,start X-Google-Attributes: gid103376,public From: Ada2001 Subject: TASH question about binding command to button Date: 1999/10/20 Message-ID: <7ukl1k$8oa$1@nnrp1.deja.com>#1/1 X-Deja-AN: 538323809 X-Http-Proxy: 1.0 x24.deja.com:80 (Squid/1.1.22) for client 205.175.225.22 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Wed Oct 20 14:53:46 1999 GMT X-MyDeja-Info: XMYDJUIDada2001 Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.51 [en]C-CCK-MCD (WinNT; U) Date: 1999-10-20T00:00:00+00:00 List-Id: Hello, I am attempting to use TASH for the first time. My objective is to create a Tk interface for a game written in Ada. I have created a 10x5 array of Ada objects of type Cell as defined here. type Cell_Type is record Name : String(1..4); Color : Peg_Type; Button : Tcl.Tk.Ada.Button; end record; I want to bind the cell buttons to a command that will cycle the button color through the available values using something like the following demo-derived code (which doesn't yet work): function Cycle_Color_Command ( Clientdata : in Integer; Interp : in Tcl.Tcl_Interp; Argc : in C.Int; Argv : in Cargv.Chars_Ptr_Ptr ) return C.Int is begin -- Cycle_Color_Command Tcl.Tk.Ada.Set_Trace (True); Cell(I,J).Color := Next_Color(Cell(I,J).Color)); Tcl.Tk.Ada.Configure (Cell(I,J).Button, "-background " & Peg_Type'Image(Cell(I,J).Color) & " -command Cycle_Color"); return Tcl.Tcl_Ok; end Cycle_Color_Command; My question is: If I bind all 50 Cell(I,J). Button objects to the single Cycle_Color_Command function, is there a way to pass in the identity (i.e. I and J) of the particular Cell(I,J).Button where the mouse click occurred? I don't want to create 50 distinct commands, one per button, if I can avoid it. I suspect the identity is encoded in the Argv function argument but I don't know how to decipher it. Thanks, F. Britt Snodgrass (britt@acm.org) Sent via Deja.com http://www.deja.com/ Before you buy.