` Printed Icetips Article

Icetips Article



Templates: Template to save column widths in a browse
2001-07-13 -- Casey Rippon
 
Newsgroups: softvelocity.products.c55ee

Editors note:  Please note that some lines may wrap in the template code.

I have a application that needs to allow the user to save column width
changes but not the whole FORMAT of a list box between sessions.  Somewhat
unusual, but others probably face it too sometimes.  I wrote this template
to do the job for ABC procedures.  Feel free to use, change it as you wish.
It uses PUTINI and GETINI rather than the INI manager class.  I have never
undersood the purpose of the INI manager when the direct functions are so
simple.


#!----------------------------------
#EXTENSION(ColumnWidthSave,'Save and Restore List Column Widths - cjr'),WINDOW,MULTI
#DISPLAY('Saves and restores the user chosen column widths')
#DISPLAY('for a specified list box')
#PROMPT('List Box',CONTROL),%ListControl
#DISPLAY('Enter these with quotes')
#PROMPT('Ini File',@s20),%IniFile
#PROMPT('Ini Section',@s20),%IniSection
#LOCALDATA
ListColumn  SHORT
#ENDLOCALDATA
#AT(%WindowManagerMethodCodeSection, 'Open', '()'),PRIORITY(5001)
!Retrieve colum widths for list box
LOOP ListColumn = 1 to 255
  IF %ListControl{PROPLIST:Exists,ListColumn} = 1
    %ListControl{PROPLIST:Width,ListColumn} =| 
     
GETINI(%IniSection,%ListControl&ListColumn,%ListControl{PROPLIST:Width,ListColumn},%IniFile)
  ELSE
    BREAK
  END
END
#ENDAT
#AT(%WindowManagerMethodCodeSection, 'Kill', '(),BYTE'),PRIORITY(8500)
!Save column widths of list box
LOOP ListColumn = 1 to 255
  IF %ListControl{PROPLIST:Exists,ListColumn} = 1
   
PUTINI(%IniSection,%ListControl&ListColumn,%ListControl{PROPLIST:Width,ListColumn},%IniFile)
  ELSE
    BREAK
  END
END
#ENDAT
#!-----------------------------------------------



Printed April 28, 2024, 5:23 pm
This article has been viewed/printed 35108 times.
Google search has resulted in 20 hits on this article since January 25, 2004.