TwwDBGrid question

856 views
Skip to first unread message

Eugene Goldberg

unread,
Sep 9, 2013, 9:28:23 AM9/9/13
to woll2woll...@googlegroups.com
Hello,

I have D5 application with InfoPower 3000 TwwDBGrid.

I need to be able to save columns order on user exit to INI.

I see there are IniAttributes properties, however i cant get them working.

I have UseTFields set to False for the grid. Then, i see the INI gets created on app exit, however it doesnt save the columns the way i re-arrange them during run-time.

Its always design-time order. I have set IniAttributes.Enabled to True and FileName to desired file.

How do i save them after re-arrange?

Thanks.

Roy Woll

unread,
Sep 9, 2013, 6:46:46 PM9/9/13
to woll2woll...@googlegroups.com
I cannot reproduce your problem. Does our IniAttributes demo exhibit similar problems for you?  Perhaps your design time IDE is interfering with the ini file.  Try running it outside the delphi ide to see if you exhibit similar problems (directly run the executeable)

Roy

Eugene Goldberg

unread,
Sep 9, 2013, 11:35:12 PM9/9/13
to woll2woll...@googlegroups.com
Well, i dont see this demo in my Demos folder.

Anyway i have created simple test application and it works as expected, but not within my application.

What wwDBGrid properties could affect this? It always save the columns the way it was design-time, does not honor the way i re-arranged them on run-time.

I made sure UseTFields = False, and the same checkbox is not marked for every field in Column Designer at design-time.

My IP controls version 3000.04.01.

Thanks.

Eugene Goldberg

unread,
Sep 10, 2013, 2:54:40 AM9/10/13
to woll2woll...@googlegroups.com
Here are the properties.

object grdJailAllInmates: TwwDBGrid
              Left = 5
              Top = 36
              Width = 1031
              Height = 197
              Selected.Strings = (
                'MASTER_ID'#9'10'#9'Master ID'#9'F'
                'FULL_NAME'#9'78'#9'Full Name'#9'F'
                'RACE'#9'15'#9'Race'#9'F'
                'SEX'#9'15'#9'Sex'#9'F'
                'DOB'#9'18'#9'DOB'#9'F')
              IniAttributes.Delimiter = ';;'
              TitleColor = clBtnFace
              FixedCols = 0
              ShowHorzScrollBar = True
              EditControlOptions = [ecoCheckboxSingleClick, ecoSearchOwnerForm]
              DataSource = dmJail.dsArrestNames
              Font.Charset = DEFAULT_CHARSET
              Font.Color = clBlack
              Font.Height = -13
              Font.Name = 'Arial'
              Font.Style = [fsBold]
              Options = [dgEditing, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgRowSelect, dgAlwaysShowSelection, dgConfirmDelete, dgCancelOnExit, dgWordWrap]
              ParentFont = False
              PopupMenu = mnuArrestNames
              ReadOnly = True
              TabOrder = 3
              TitleAlignment = taCenter
              TitleFont.Charset = DEFAULT_CHARSET
              TitleFont.Color = clBlack
              TitleFont.Height = -13
              TitleFont.Name = 'Arial'
              TitleFont.Style = [fsBold]
              TitleLines = 1
              TitleButtons = True
              UseTFields = False
              OnCalcCellColors = grdJailCalcCellColors
              OnTitleButtonClick = grdJailTitleButtonClick
              PaintOptions.ActiveRecordColor = clBlack
            end

Eugene Goldberg

unread,
Sep 10, 2013, 2:55:42 AM9/10/13
to woll2woll...@googlegroups.com
And the code:

with grdJailAllInmates, grdJailAllInmates.
IniAttributes do
  begin
    Enabled := True;
    FileName := ExtractFilePath(Application.EXEName) + 'jailgrids.ini';
    SectionName := gUserName + '_grdJailAllInmates';
    SaveToIniFile
  end;

Eugene Goldberg

unread,
Sep 10, 2013, 2:58:22 AM9/10/13
to woll2woll...@googlegroups.com
I have tried to run the EXE outside of IDE, the result is just the same...the columns goes in design-time order, not the way i arranged them on run-time.

Roy Woll

unread,
Sep 11, 2013, 12:33:11 PM9/11/13
to woll2woll...@googlegroups.com
Its not clear to me where your code that calls SaveToIniFile is located.  In what event is this code added.

To run our demo, open up our prjdemo in the maindemo folder.  Then click on the button on the bottom right of the grid demos.

The demo form is GrdIniHint in the grid folder of the maindemo. It does not require any code to save to the inifile. Please let me know the results of running our demo.

-Roy

Eugene Goldberg

unread,
Sep 12, 2013, 3:07:34 AM9/12/13
to woll2woll...@googlegroups.com
Hi Roy,

Yes i have found the demo and it works as expected.

However i still cant get it working in my application.

Last thing i tried is removed the code, and set the properties on design-time like this

IniAttributes.Enabled = True
IniAttributes.SaveToRegistry = True
IniAttributes.FileName = my registry key

I saw in source code it should save it on destroy and load back automatically.

However even this way, it saves in some pre-defined order, even not the one i had design-time.


Eugene Goldberg

unread,
Sep 12, 2013, 3:36:07 AM9/12/13
to woll2woll...@googlegroups.com
I apologize, i got it working.
Reply all
Reply to author
Forward
0 new messages