preventing paint of DbctrlGrid panel or deleting after fill

Posted on 2009-07-16
Medium Priority
Last Modified: 2013-11-23
I am developing an application which queries a db for a file/exe path, among other things.  If the application exists, the grid should be populated.  If the application does not, I need to skip the resultset row or delete/hide the filled panel.  (ex. if quickbooks exist on a client machine, paint else move to the next rs row or delete the painted panel.

For the life of me, I can't work this out.  

I'm hoping someone here may have some suggestions.

*btw, I tried an alternative in iterating through the result set for the apppath; if the exe exists, proceed; else delete/filter the resultset row -no luck here either.....

Thanks in advance,

R Davis
Question by:brparrish
  • 3
  • 3
  • 2

Expert Comment

ID: 24877198
You could this :

1) Add a flag field into the table that stores the exe's path. Let's say APP_EXISTS type integer
    App Exists value = 1, App does not exist value = 0.
2) Write a procedure that updates the flag according to the existance of the file

3)Select from the database only the records that the application exists using the flag in the query
Select * from TABLENAME where APP_EXISTS = 1
and you will get only the records you want to display without trying to override the paint procedure of the grid.

Author Comment

ID: 24877397
Yep, I thought about that, trouble is 100 people will use this daily, so modifying the DB isn't really an option.  I thought about an ADOtable on the form also, drop the dataset there, then read the results to appropriate fields.....that doesn't really seem viable either, but may be my only option.  -Thanks for your input

Expert Comment

ID: 24878577
Well in my opinion you can implement this making a thread that will run to update the DB.
If you have to mofidy this table daily you could make a separate exe to run as a service
and make a scheduler to run on a spesific interval.

AdoTable is good but pretty slow try to do it using SQL and AdoTables this will speed up 100% the proccess specially if the DB Engine is MS SQL,MySQL generally a good DB engine.

If you could explain more the logic you want to implement maybe more ideas will appear.

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Author Comment

ID: 24878718
Well, in a nutshell....we write a lot of software which is pushed out to our users.  Historically, we publish the shortcuts for these apps via GPO.  I'm trying to overcome that.  A db will host the name, appGroup, description and path of the exe.  Additionally, this app will also include apps like, IE, Outlook, Word, Excel etc....(in effort to clean the desktop).

So changing the DB isn't really a good option for me as up to 100 users will hit this app between 8:30 -9:00a.

What happens now (and this all works, w/exception of hiding local apps that aren't installed ex; Quickbooks).

query: select * from desktop_ui >> open dataset >> while not eof, fill panel fields w/the app name, description and group membership >> In an onpaintpanel event, take the exe path from the dataset; extract the icon or associated icon (if the object is a file, .pdf etc) and fill image1 w/it.

This all works great w/exception of the panels I'd like omitted/not-painted or skipped.

For example:  I've set an erroneous path for IE7  -however, db fields are populated -only image1 is skipped (because the icon can't be found)

I've tried checks such as fileexists()   -no dice.

For kicks, I've set silly behavior like changing the back color if the app is not found  -this works, so I know the if statement is good.  I just can't seem to find a way to remove or omit cells that don't apply to the respective user.

It is that dead end that got me focusing on a table to filter the rows prior to filling.

Hope this helps,

R Davis
LVL 38

Expert Comment

by:Geert Gruwez
ID: 24884945
you have a form which is prepolutated with panels for all your apps ?

why not just change the visibilty of the panel ?

this is a little obscure as to what your form looks like
LVL 38

Expert Comment

by:Geert Gruwez
ID: 24890751
the first time you load this thing, i agree it would take some time to find all the apps installed
why not save a TClientDataSet to a local file once processed
and then load from this local file the next time

you would use a thread to load all the possible apps from the db
and process which ones are available in this thread
within this thread you can then recreate the local file

opening the app the first time would be slow possibly
the second time, instant, and in the background it would be running the thread to check for new versions

Accepted Solution

brparrish earned 0 total points
ID: 24897459
I actually received some help w/this via the delphi forums.....silly how simple is was:

procedure TForm1.rsFilterRecord(DataSet: TDataSet; var Accept: Boolean);
  Accept := FileExists(rs.FieldByName('AppExePath').AsString);

in the form create:

rs.Filtered := True;  -crazy!

Thanks to all for your input.

R Davis
LVL 38

Expert Comment

by:Geert Gruwez
ID: 24897489
it will still take a while to load your dataset
and will take a time to show your form as you do this in the formcreate
you may have to add a waiting cursor or even a form displaying it's busy

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

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

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
Suggested Courses

578 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