Results 1 to 7 of 7

Thread: How to save the current settings from a DbGrid

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    How to save the current settings from a DbGrid

    Hi,

    when the User of my program change for example the width of a column how can I safe this settings?

    (I tried DefColWidth = 0 but it is not true what the MSDN say that it makes autosize.)

    nice greetings
    Franky

  2. #2
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Devon, UK
    Posts
    311
    i don't know about in a dbgrid but in a flexgrid typw this in the form load code.

    databasename.colwidth(column number 0 is first) = a number

    for example

    database.colwidth(0) = 700
    Sam.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Hi

    I know this, but that is the problem.

    I want that the user move with the mouse the column to the requested width and then when he leaves that it just save the position of the width.

    Or how to autosize would be nice.

    any ideas from anybody?
    Franky
    Last edited by Franky; Sep 24th, 2002 at 09:26 PM.

  4. #4
    Fanatic Member WorkHorse's Avatar
    Join Date
    Jul 2002
    Location
    Where you live.
    Posts
    591
    Why don't you write the settings to an ini or text file then load the settings when the program starts and set the grid?

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Hi Workhose

    This would be possible, BUT the DbGrids are always different and they get created from the Enduser at runtime. There is no limitation ofDbGrids, so it is really a work to write that. I would be interested for a easier way. I don't understand why the autosize that Microsoft promise doesn't work ..........

    nice greetings
    Franky

  6. #6
    Fanatic Member WorkHorse's Avatar
    Join Date
    Jul 2002
    Location
    Where you live.
    Posts
    591
    I'm not sure about the AutoSize. Don't use DBgrid too much. But if you want to save user settings, then I think you'll have to...well, save the user settings somewhere. It's not endless. When the form/app closes, write the data source and loop the columns and write the widths. When the form/app opens, read the data and set the grid.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    It is unfortunatly a lot of work ...

    Because as I said I (can) have many DBGrids. I use them only for Users who need to create them. But the columns are diffferent in every DBGrid. I could store for every DBGrid the column sizes of all columns in a field but that would be not the most elegant way.

    nice greetings
    Franky

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width