Solved

Building Infopower TwwDBGrids at runtime

Posted on 2004-09-09
4
955 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
[X]
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
  • 3
4 Comments
 
LVL 23

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 23

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 23

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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month6 days, 20 hours left to enroll

623 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