* Help Needed for Win32 GtkAda "Paste" to Clipboard
@ 2001-03-05 2:06 Warren W. Gay VE3WWG
2001-03-05 10:09 ` David C. Hoos, Sr.
0 siblings, 1 reply; 2+ messages in thread
From: Warren W. Gay VE3WWG @ 2001-03-05 2:06 UTC (permalink / raw)
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,"<TEST-PASTE>");
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 "<TEST-PASTE>" 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Help Needed for Win32 GtkAda "Paste" to Clipboard
2001-03-05 2:06 Help Needed for Win32 GtkAda "Paste" to Clipboard Warren W. Gay VE3WWG
@ 2001-03-05 10:09 ` David C. Hoos, Sr.
0 siblings, 0 replies; 2+ messages in thread
From: David C. Hoos, Sr. @ 2001-03-05 10:09 UTC (permalink / raw)
You might get a quicker and more knowledgeable response from
the GTKAda list AT gtkada@gtkada.eu.org.
Information on subscribing is at
http://gtkada.eu.org/mailman/listinfo/gtkada
David C. Hoos, Sr.
W1DCH
"Warren W. Gay VE3WWG" <ve3wwg@home.com> wrote in message
news:3AA2F492.FD660389@home.com...
> 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,"<TEST-PASTE>");
> 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 "<TEST-PASTE>" 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-03-05 10:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-05 2:06 Help Needed for Win32 GtkAda "Paste" to Clipboard Warren W. Gay VE3WWG
2001-03-05 10:09 ` David C. Hoos, Sr.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox