Chuck, all of my listbox code was written a while ago.. so I am a bit fuzzy but for the predesigned listbox, as I recall since you are 'stepping around' the native sort function of the header button (listbox setting 'sortable', I think this is what is causing the header button to not change value.
I think if you explicitly assign the header button the correct value it will display properly and you can then count on it for the current state (ascending/descending), additionally you do not include under what form event you are executing the sort, the sort you are trying to implement needs to be done in the ON AFTER SORT event. Again as I recall, if you place your sorting code in the header button method, or execute it during the ON CLICKED event *your code* runs, then 4Ds native sort occurs undoing your sort. Chip On Tue, 25 Jun 2019 11:32:32 -0400, Charles Miller via 4D_Tech wrote: > HI all, > > I have not had this problem before but it must be something dumb I am > doing. I have listbox 1 where I have columns created through code and > on header click event. When I enter on header click event I do a > customer sort on column 2. The code looks like this > case of > : (Form event=On Header Click) > C_TEXT($nameofObj_txt) > C_LONGINT($dumTbl_L;$dumFld_L) > RESOLVE POINTER(Self;$nameofObj_txt;$dumTbl_L;$dumFld_L) > if(: ($nameofObj_txt="LB_Header2_l") > If (Self->=1) > ORDER BY FORMULA([TIN_Inspections];NTI_SortByFormula (Self->);>) > Else > ORDER BY FORMULA([TIN_Inspections];NTI_SortByFormula (Self->);<) > End if > > This works every time the value of LB_Header2_l variable changes as > it should > > I have another listbox form where columns not created by code where > C_TEXT($nameofObj_txt) > C_LONGINT($dumTbl_L;$dumFld_L) > RESOLVE POINTER(Self;$nameofObj_txt;$dumTbl_L;$dumFld_L) > > Case of > > : ($nameofObj_txt="LB_Header2_l") > If (Self->=1) > ORDER BY FORMULA([TIN_Inspections];NTI_SortByFormula (Self->);>) > COPY NAMED SELECTION([TIN_Inspections];"NTI_TunnelInspSet") > > Else > ORDER BY FORMULA([TIN_Inspections];NTI_SortByFormula (Self->);<) > COPY NAMED SELECTION([TIN_Inspections];"NTI_TunnelInspSet") > > End if > $0:=-1 > The value of LB_Header2_l never changes so sorting does not work > Additionally no other sort works either. Any ideas? > > Thanks and regards > Chuck > > -- > ----------------------------------------------------------------------------------------- > Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064 > Informed Solutions, Inc. > Brookline, MA 02446 USA Registered 4D Developer > Providers of 4D, Sybase & SQL Server connectivity > https://www.informed-solutions.com > ----------------------------------------------------------------------------------------- > This message and any attached documents contain information which may > be confidential, subject to privilege or exempt from disclosure under > applicable law. These materials are intended only for the use of the > intended recipient. If you are not the intended recipient of this > transmission, you are hereby notified that any distribution, > disclosure, printing, copying, storage, modification or the taking of > any action in reliance upon this transmission is strictly prohibited. > Delivery of this message to any person other than the intended > recipient shall not compromise or waive such confidentiality, > privilege or exemption from disclosure as to this communication. > ********************************************************************** > 4D Internet Users Group (4D iNUG) > Archive: http://lists.4d.com/archives.html > Options: https://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ********************************************************************** --------------- Gas is for washing parts Alcohol is for drinkin' Nitromethane is for racing ********************************************************************** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************