Message-ID: <42F98026.8070602 at compiler.kaist.ac.kr> Date: Wed, 10 Aug 2005 13:18:46 +0900 From: SooHyoung Oh MIME-Version: 1.0 To: Jacques Garrigue CC: lablgtk at math.nagoya-u.ac.jp Subject: Re: Two question about selection References: <42F96DA8.7050003 at compiler.kaist.ac.kr> <20050810.125349.79297434.garrigue at math.nagoya-u.ac.jp> In-Reply-To: <20050810.125349.79297434.garrigue at math.nagoya-u.ac.jp> Content-Type: multipart/alternative; boundary="------------050209080003080200000206" This is a multi-part message in MIME format. --------------050209080003080200000206 Content-Type: text/plain; charset=EUC-KR Content-Transfer-Encoding: 7bit Thank you for your reply. Can you give me more hints about how to convert string to *** atom list ***? As you know, there is method selection_received : |callback:(selection_data -> time:int32 -> unit) -> GtkSignal.id and Gobj.selection_data has | method data : |string and in Gdk.Atom module, there are |val intern : |?dont_create:bool -> string -> Gdk.atom |val name : |Gdk.atom -> string| | ||I don't know what to do with these APIs. ||How can I convert selection_data#data of string type to *** atom list *** as in the Gtk Tutorial example? | Jacques Garrigue wrote: >From: SooHyoung Oh > > > >>I'm planning to update Lablgtk tutorial's "Manageing Selection" part >>as Gtk tutorial http://www.gtk.org/tutorial/ . >>I have two question about how to use "selection" in lablgtk? >>Can anyone help me? >> >>Q1) How to analysis "ATOM" in Lablgtk? >> >> > >See the Gdk.Atom module. > > > >>Q2) On "17.3 Supplying the selection", they uses "gtk_selection_owner_set". >>In lablgtk, we can do the same thing with "misc#grab_selection". >>Then how can we do job such as gtk_selection_owner_set(NULL, ...)? >>Do I have to implement "misc#ungrab_selection" >>or is there any method already implmented? >> >> > >Good point. This is not available. >This often happens when NULL is a special case... >There are various workarounds: specifying the selection to be an empty >string, or destroying the widget which holds the selection. > >Note also that the simplest way to handle the selection is to go >through the GData.clipboard class. >Two of them are predefined: GMain.selection and GMain.clipboard. >And there is a method clipboard#clear. >Which by the way means that GMain.selection#clear () should actually >clear the selection anyway :-) > >Jacques > > > --------------050209080003080200000206 Content-Type: text/html; charset=EUC-KR Content-Transfer-Encoding: 7bit Thank you for your reply.

Can you give me more hints about how to convert string to *** atom list ***?
As you know, there is
method selection_received : callback:(selection_data -> time:int32 -> unit) -> GtkSignal.id

and Gobj.selection_data has

method data : string

and in Gdk.Atom module, there are 

val intern : ?dont_create:bool -> string -> Gdk.atom
val name : Gdk.atom -> string

I don't know what to do with these APIs.
How can I convert selection_data#data of string type to *** atom list ***
as in the Gtk Tutorial example?

Jacques Garrigue wrote:
From: SooHyoung Oh <shoh@compiler.kaist.ac.kr>

  
I'm planning to update Lablgtk tutorial's "Manageing Selection" part
as Gtk tutorial http://www.gtk.org/tutorial/ .
I have two question about how to use "selection" in lablgtk?
Can anyone help me?

Q1) How to analysis "ATOM" in Lablgtk?
    

See the Gdk.Atom module.

  
Q2) On "17.3 Supplying the selection", they uses "gtk_selection_owner_set".
In lablgtk, we can do the same thing with "misc#grab_selection".
Then how can we do job such as gtk_selection_owner_set(NULL, ...)?
Do I have to implement "misc#ungrab_selection"
or is there any method already implmented?
    

Good point. This is not available.
This often happens when NULL is a special case...
There are various workarounds: specifying the selection to be an empty
string, or destroying the widget which holds the selection.

Note also that the simplest way to handle the selection is to go
through the GData.clipboard class.
Two of them are predefined: GMain.selection and GMain.clipboard.
And there is a method clipboard#clear.
Which by the way means that GMain.selection#clear () should actually
clear the selection anyway :-)

Jacques

  

--------------050209080003080200000206--