Date: Thu, 19 Aug 2004 10:29:38 -0500 From: Michael Halcrow To: lablgtk at kaba.or.jp Subject: Combo entry_completion? Message-ID: <20040819152938.GA6894 at halcrow.us> Reply-To: Michael Halcrow Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="6TrnltStXW4iwmi0" Content-Disposition: inline Sender: Michael Halcrow --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I am just learning Objective Caml, so if you feel inclined to critique my ocaml coding style, please do so. I am working on a project where I view records in a database. I would like the user to be able to search the contents of the data set based on a person's name and display the record. Here is what I have so far: http://cvs.sourceforge.net/viewcvs.py/ldsdps/src_ocaml/ldsdps_stage.ml?rev=1.15&view=auto Basically, I want this behavior: As the user types into the entry widget of the combo widget, the first element in the combo list for which the text typed so far matches is auto-completed and highlighted, so that the next character typed replaces the auto-completed remainder and re-does the auto completion. Let's do an example: Combo list contents: [ "abc"; "123"; "abcdef"; "abcxyz"; "abcxyzw" ] Entry widget contents: "" User enters the entry widget and types "a". "abc" gets automatically put into the widget. The cursor is after the "a" and before the "b", and "bc" is highlighted. User types "b". Contents are still "abc", with the cursor after the "b" and before the "c", with "c" highlighted. User types "c". Contents are "abc", with the cursor after the "c" and nothing highlighted. User types "x". Now the contents are "abcxyz", with the cursor after the "x" and before the "y", with "yz" highlighted. User hits "enter", and the search is made for the record with "abcxyz" as the key, etc., etc. Alternatively, I would like the combo box to be dropped down for the entire process, and the contents of the entry widget matched against the list, with the closest matching element highlighted. As it stands, I am hooking the activate signal, which is sent when the user hits ``enter'', but that also drops down the combo box, which I don't really want at that point... I tried referencing entry_completion in my code, but I got that run-time error that one gets when linking against the wrong version of gtk (although I checked carefully, and I think I am linking against gtk 2.4). In any case, I'm not sure how to use entry_completion to get this functionality. Thanks, Mike --6TrnltStXW4iwmi0 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFBJMdiLTz92j62YB0RArEaAKCX0oTVkhbEY/yJejmSU8JyZMsftwCgxaJ3 iyebTOr31CXMOTzFHFw/bNg= =Vj82 -----END PGP SIGNATURE----- --6TrnltStXW4iwmi0--