Solved

Building Infopower TwwDBGrids at runtime

Posted on 2004-09-09
4
892 Views
Last Modified: 2010-04-05
I'm using Inforpower 4000 and Delphi 7

I need to build a TwwDBGrid dynamically at runtime.

I need to control which fields are displayed and column attributes.

Problems I have run into:

The Count property of the Columns collection appears to be hidden so how do you get column count (which can be different from field count)?

To start with a blank grid, do I need to delete all the default fields/ columns created automatically?  If so, how do I do that?

How does one then create the grid columns you want and do you need to just create columns or columns and fields?
0
Comment
Question by:Paul197466
  • 3
4 Comments
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 12015239
what i do is simply to change the selected.strings property and then call Applyselected.

To see the structure of the selected strings, build a wwdbgrid in designtime and see the selected property in the .dfm file

here's a piece of code from a my project where i build an empty grid in runtime (used then with more different tables)...

    grdTabella.Selected.Strings[0] := Prefisso + '_Cx'#9'9'#9'codice'#9'F';
    grdTabella.Selected.Strings[1] := Prefisso + '_Descrizione'#9'32'#9'descrizione'#9'F';
    grdTabella.ApplySelected;
    grdTabella.DataSource := ADataSource;

grdTabella is a TwwDBGrid
every Selected Item is a column, so here i'me creating two columns
now let's see the string '_Cx'#9'9'#9'codice'#9'F' : every #9 is a separator
the first '_Cx' is the fieldname
the second '9' is the columnwidth
the third 'codice' is the displayed columntitle
and the last is the readonly flag F or T (False or True)

finally i call the selcted.applyselected to design the columns and apply them and then the datasource (i've already said that i use it with many similar tables)...

BTW this is quite what you have to do


Hope it helps

F68 ;-)
0
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 500 total points
ID: 12015246
Forgot to say: don't worry about those 'Prefisso'; it's a prefix that i use to pass the table name to the grid (again, for using it with more tables)....

F68 ;-)
0
 

Author Comment

by:Paul197466
ID: 12015254
Thanks a lot

I looked at all the obvious properties but never looked at selected as I assumed it was something to do with current selection!
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 12015294
Every day is a good day to learn some new thing, as i do also :)))

Glad to have helped you :)

F68 ;-)
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now