[Lablgtk-list] An error in making button labels I don't understand

Nicolas FRANCOIS nicolas.francois at free.fr
Wed Feb 18 16:00:42 CET 2015


Hi.

I'd like to show a bridge hand in a window. This is the code for my
class "affichage_main" (in joined file "visu_une_main.ml").

Problem appears here :

  initializer
    for i = 0 to 3 do
      for j = 0 to 9 do
	nom_carte.(i).(j) <- GMisc.label ~width:8 ~height:10 ();
	if j = 0
	then ignore (nom_carte.(i).(j)#set_text (Glib.Utf8.from_unichar
  (9824+i))); let une_carte = GButton.button ~relief:`NONE
	  ~packing:(grille#attach ~top:i ~left:j ~expand:`BOTH) () in
	let une_boite = GPack.hbox ~packing:une_carte#add () in
	  ignore (une_boite#add (nom_carte.(i).(j)));
          *******************************************
This gives the error : 
Error: This expression has type GMisc.label
       but an expression was expected of type GObj.widget
       The second object type has no method angle

I saw a similar example in
http://plus.kaist.ac.kr/~shoh/ocaml/lablgtk2/lablgtk2-tutorial/c669.html#SEC-NORMALBUTTONS

Can someone tell me what I did wrong ?

If you need any complementary explanation on the code, please ask. I
know it's not easy to read others code, even if it is well written,
which is definitely not one of my strong qualities :-(

\bye


-- 

Nicolas FRANCOIS                      |  /\ 
http://nicolas.francois.free.fr       | |__|
				      X--/\\
We are the Micro$oft.		        _\_V
Resistance is futile.		    
You will be assimilated.         darthvader penguin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: visu_une_main.ml
Type: text/x-ocaml
Size: 1362 bytes
Desc: not available
URL: <http://lists.ocamlcore.org/pipermail/lablgtk-list/attachments/20150218/ca2e93b6/attachment.bin>


More information about the Lablgtk-list mailing list