Why this code does work in GTK and not in GTK2? lazarus / 1-Linux ---------------------------------------------------------------------- fab25 · 2006-02-16 04:15 Hi, I have a little piece of code that refuses to work correctly when I compile to GTK2 but works like a breeze on GTK1. I have an edit that is used to fill a stringgrid. The code is the following : Quoteprocedure TForm1.SEcatChange(Sender: TObject); begin   EDcatname.Text:=SGcats.cells[1,SEcat.value]; end;   SEcat being the SpinEdit and EDcatname the edit field, SGcats the stringgrid. Is the change event for a spinedit not well supported yet on GTK2 or is there something in this code wrong or in my settings? When I use it both on windows and GTK, it works... I set the compiler option to GTK2, it compiles with no messages but then this doesn't work. I would really appreciate some help on that since I'm absolutely clueless of where this comes from... Thanks for reading ---------------------------------------------------------------------- CCRDude · 2006-02-16 09:05 Well, could you specify "refuses to work correctly" a bit more? Is a field not updating, is the computer turning yellow, ...? First let me verify the fields: SEcat: TSpinEdit EDcatname: TEdit SGcats: TStringGrid Now, the code you mentioned does update the TEdit from the TStringGrid. You have not posted any code for filling the TStringGrid like you mentioned. Did you really mean you would update the TEdit from the TStringGrid and not vice versa? In that case, there's still a lot of information missing: does the change function gets called at all? Does it update the TEdit with scrambled text, or not at all? Sorry for all the questions, but I hate incomplete bug reports, have to deal with too many myself, and "does not work" is... ---------------------------------------------------------------------- fab25 · 2006-02-16 12:24 Sorry if this wasn't clear enough. The principle is the following, I have a TEdit coupled with a SpinEdit to enter data in a Stringgrid. The user enters data, then moves to the next row by clicking on the spinedit and increasing its value. If there's already a value stored in the StringGrid, then it should be loaded into the Tedit (EDcatname). In GTK1, the value is loaded without any problem. When I compile to GTK2, the value from the last row remains in the TEdit (is not updated with the stringgrid record). I add a showmessage('hello'); to see if the event was triggered and it's not whereas it is in GTK1. I don't know where this could come from... Quoteprocedure TForm1.SEcatChange(Sender: TObject); begin showmessage('hello');   EDcatname.Text:=SGcats.cells[1,SEcat.value]; end;   The code to update the TEdit is the following, it also update a combolist values on a second tab and is working : Quoteprocedure TForm1.EDcatnameKeyUp(Sender: TObject; var Key: Word;   Shift: TShiftState);   var i: integer; begin Combobox1.Clear;   if Secat.value >1 then begin        if Sgcats.cells[1,SEcat.value-1]='' then showmessage('The following category is empty :'+' '+inttostr(Secat.value-1)+chr(13)+chr(10)+'Please fill it.');   end;    SGcats.cells [0,SEcat.value]:=inttostr(SEcat.value);    SGcats.cells [1,SEcat.value]:=Edcatname.Text;    Combobox1.items.add('Select a category for this item');   for  i:=1 to 10 do begin    if SGcats.cells[1,i]<>'' then   combobox1.items.add(SGcats.cells[1,i]);   end; end; ---------------------------------------------------------------------- fab25 · 2006-02-22 01:28 Did anyone was more successful that I was triggering this onchange event out of a spinedit on GTK2? I'm really curious to see if the problem comes from my settings, options and so on or the event is still not well implemented on Lazarus on the top of GTK2... Thanks for any tip... ---------------------------------------------------------------------- CCRDude · 2006-02-22 16:24 I'm afraid I don't even get todays snapshot compiled under Ubuntu, and my previously used one was missing a Gdk2something unit when recompiling the IDE for Gtk2. I'll try again tomorrow or so