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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,48ddc60f3ebcf8b5,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-04 18:12:05 PST Path: supernews.google.com!sn-xit-03!nntp.cs.ubc.ca!newsfeed.stanford.edu!sn-xit-01!supernews.com!newshub2.rdc1.sfba.home.com!news.home.com!news1.rdc2.on.home.com.POSTED!not-for-mail Message-ID: <3AA2F492.FD660389@home.com> From: "Warren W. Gay VE3WWG" X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Help Needed for Win32 GtkAda "Paste" to Clipboard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Mon, 05 Mar 2001 02:06:19 GMT NNTP-Posting-Host: 24.141.193.52 X-Complaints-To: abuse@home.net X-Trace: news1.rdc2.on.home.com 983757979 24.141.193.52 (Sun, 04 Mar 2001 18:06:19 PST) NNTP-Posting-Date: Sun, 04 Mar 2001 18:06:19 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: supernews.google.com comp.lang.ada:5420 Date: 2001-03-05T02:06:19+00:00 List-Id: Ok.. I surrender. I've beat my brain against the wall to much on this one already.... What I want to do, is paste a password(string) from my GtkAda key_chain app, to the Windows clipboard. I've seen some pretty complicated Drag and Drop code etc., and even some cut and paste code in C, for Gtk+. However, I am still not getting very far in my attempt to paste a simple string to the clipboard. If someone has better GtkAda instructions/example code somewhere, that would help. The GtkAda documentation doesn't tell you enough, and what I could find, the examples don't cut it either. Even worse, I suspect that the "procedure" has changed, but the documentation has not kept pace. DESCRIPTION: In my Main_Win_Pkg, I have: The_Clipboard: Gdk_Selection; delcared in the spec. It is initialized, with: The_Clipboard := Gdk.Property.Atom.Itern("CLIPBOARD"); Later, after the windows 'n widgets are created, I have: Add_Target(Main_Win.Ed_Password,The_Clipboard,Target_String,1); Return_Callback.Connect (Main_Win.Ed_Password, "selection_clear_event", On_Cb_Copy_Password_Selection_Clear_Event'Access); Entry_Callback.Connect (Main_Win.Ed_Password, "selection_get", On_Cb_Copy_Password_Selection_Get'Access); The widget Main_Win.Ed_Password is a Gtk_Entry widget. With these calls in place, I now finally get the "selection_get" event and callback (the C example I had used a checkbox, but they don't get these events anymore it seems). The On_Cb_Copy_Password_Selection_Get callback, looks as follows: procedure On_Cb_Copy_Password_Selection_Get (Object : access Gtk_Entry_Record'Class; Params : Gtk.Arguments.Gtk_Args) is Data : Selection_Data := Selection_Data( To_C_Proxy(Params,1) ); Arg2 : Guint := To_Guint (Params, 2); Arg3 : Guint := To_Guint (Params, 3); begin Selection_Data_Set(Data,Selection_Type_String,8,""); end On_Cb_Copy_Password_Selection_Get; The ownership of the clipboard is established in the toggle-button's callback as follows: Flg := Owner_Set(Gtk_Widget(Main_Win.Ed_Password),The_Clipboard); With this code, I now get a paste of the string "" to appear in notepad. HOWEVER, when I select a piece of text in notepad (or anywhere else), I do _NOT_ get the "selection_clear_event" callback event. Even worse, when I exit my app, and restart it, then attempt to paste into the same notepad (that was still running), it then pauses for a time, and then brings up a printer dialog after I have pressed Shift-INS in notepad. Clearly, things are not working correctly yet. These experiences are occurring under Windows 2000, using GNAT 3.13p using GtkAda 1.2.10. I get the feeling that the whole cut and paste "procedure" underwent some change in GtkAda and/or Gtk+, but can find mightly little documentation on this. I only need to "copy" a string to the clipboard. Nothing else. TIA, Warren. -- Warren W. Gay VE3WWG http://members.home.net/ve3wwg