Solved

Building Infopower TwwDBGrids at runtime

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Mydac connection data base issue 3 158
Send message from delphi to whatsapp, is it possible? 3 1,448
FMX enumerated colours 2 101
SUM 2 INTEGER ARRAYS INTO 1 10 100
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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 …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 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