Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Building Infopower TwwDBGrids at runtime

Posted on 2004-09-09
4
921 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
tidtcpserver connection lost handle 2 100
Performance of SQL statement 37 124
how to update exe applicatio from internet ? 6 85
Tvertscrollbox like a whatsapp layout 5 34
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

765 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