Hi all, I have a form with two listboxes. I wrote some code to manage automatic column width (OBJECT GET BEST SIZE, LISTBOX SET COLUMN WIDTH).
I build listbox1 with records from Table1 (fill by SQL) ; code for automatic width is executed for LB1. When I click on a row of LB1, I fill listbox2 with records from TableN (always by SQL) ; code for automatic width is executed for LB2. Why LB1 is redrawn with default width* ? * I don't understand column width given by 4D : neither leader with, neither data width... I did a new test with automatic width for the two LB : same issue. Here is the code (simplified) : LISTBOX GET ARRAYS(Listbox1;$Column_ta;$Header_ta;$Column_pa;$Header_pa;$Col_visible_ba;$Style_pa) For($i;1;Size of array($Column_pa)) OBJECT GET BEST SIZE($Column_pa{$i}->;$Width_best1_l;$Height_best_l) OBJECT GET BEST SIZE($Header_pa{$i}->;$Width_best2_l;$Height_best_l) $Width_best_l:=MTH_Maximum($Width_best1_l;$Width_best2_l)+10 LISTBOX SET COLUMN WIDTH($Column_pa{$i}->;$Width_best_l) LISTBOX SET COLUMN WIDTH($Header_pa{$i}->;$Width_best_l) LISTBOX SET COLUMN WIDTH(*;$Header_ta{$i};$Width_best_l) LISTBOX SET COLUMN WIDTH(*;$Column_ta{$i};$Width_best_l) End for LISTBOX GET ARRAYS(Listbox2;$Column_ta;$Header_ta;$Column_pa;$Header_pa;$Col_visible_ba;$Style_pa) For($i;1;Size of array($Column_pa)) OBJECT GET BEST SIZE($Column_pa{$i}->;$Width_best1_l;$Height_best_l) OBJECT GET BEST SIZE($Header_pa{$i}->;$Width_best2_l;$Height_best_l) $Width_best_l:=MTH_Maximum($Width_best1_l;$Width_best2_l)+10 LISTBOX SET COLUMN WIDTH($Column_pa{$i}->;$Width_best_l) LISTBOX SET COLUMN WIDTH($Header_pa{$i}->;$Width_best_l) LISTBOX SET COLUMN WIDTH(*;$Header_ta{$i};$Width_best_l) LISTBOX SET COLUMN WIDTH(*;$Column_ta{$i};$Width_best_l) End for I tried also : $Listbox_t:="Listbox1" LISTBOX GET ARRAYS(*;"$Listbox_t";$Column_ta;$Header_ta;$Column_pa;$Header_pa;$Col_visible_ba;$Style_pa) Same behavior. I see that the second LB takes column width from first LB A track : pointer is form.3C.4357. I suppose 3C is object ID ; pointers on objects of LB1 and LB2 have same ID... ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************