Jump to content


Photo

NextDBGrid61, Auto Add Fields at runtime.


  • Please log in to reply
9 replies to this topic

#1 FourWhey

FourWhey
  • Members
  • 165 posts

Posted 24 February 2016 - 11:24 PM

I don't seem to be able to get this to work.

 

D6... I dropped the grid, button, query and datasource onto a form. I then set the sql query text, dataset for the datasource to be the query, then in the button click added the following...

NextDBGrid61.DataSource := DataSource1;
NextDBGrid61.ActivationOptions := [aoAutoAddFields, aoAutoSetFields];

with NextDBGrid61.Views.Add(TNxReportGridView6) do
begin
  GridLines := true;
  SelectionStyle := stAlphaBlended;
end;

if not(ADOQuery1.State in [dsBrowse, dsEdit, dsInsert]) then
  ADOQuery1.Open;

After the query is opened the grid has nothing in it.  If the columns are added first at design-time things work fine.

 

Am I missing something, I thought this working with v5, or is adding columns at run-time unsupported now?



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 25 February 2016 - 01:26 AM

Hi,

I will test it now. I hope it's easy.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 25 February 2016 - 01:32 AM

Hi,

Try to set ActiveView to newly added GridView, or set ActiveViewIndex to 0.

Please tell me if it works.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#4 FourWhey

FourWhey
  • Members
  • 165 posts

Posted 25 February 2016 - 07:03 PM

Hi,

Try to set ActiveView to newly added GridView, or set ActiveViewIndex to 0.

Please tell me if it works.

 

That works now, the columns and rows are added. Maybe add this to the User guide that comes with the component or to the developer page? I looked before I asked and couldn't it documented anywhere.

 

Now what happens is once the data is in the grid if I click on any of the cells in the grid I get an exception.

---------------------------
Debugger Exception Notification
---------------------------
Project Text.exe raised exception class EOleException with message 'Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another'. Process stopped. Use Step or Run to continue.
---------------------------
OK   Help   
---------------------------

This occurs in ADODB:3936

procedure TCustomADODataSet.InternalGotoBookmark(Bookmark: Pointer);
begin
  Recordset.Bookmark := POleVariant(Bookmark)^;
end;

Once I click OK to close the error dialog the grid fields are broken.

 

http://i.imgur.com/CyYaiMi.png

 

I tried setting the following for grid...

NextDBGrid61.Editing := false;
for i := 0 to NextDBGrid61.ColCount -1 do
  ShowMessage(BoolToStr(NextDBGrid61.Columns[i].Editing)); 
end;

They're all set to Editing false. That doesn't seem to do anything though. If I set them as

NextDBGrid61.Columns[i].Enabled := false;

or

NextDBGrid61.Columns[i].Selectable := false;

there's no exception, but then they can't be selected.

 

Also, when double clicking a spinColumn it allows the spinbox to be inc/decremented even though...

NextDBGrid61.Columns[i].Selectable = false
NextDBGrid61.Columns[i].Editing = false
NextDBGrid61.Editing = false
NextDBGrid61.SecondClickEditing = false

I'm thinking this grid may not be ready to use with D6. Do you know if it functions better in D7, I can move our main project to that, possibly.



#5 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 25 February 2016 - 08:06 PM

Hi,

You are correct about User Guide. I will include it now. In design-time you will receive alert to set ActiveView, but I will need to note this for run time too.

I didn't give a lot love for Delphi 6 recently, but I will improve it.

Can you please send me mini demo application with ADO to I test it. Most probably there will be easy to fix bugs. Working hard since last year to finally replace v5 with v6.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#6 FourWhey

FourWhey
  • Members
  • 165 posts

Posted 25 February 2016 - 10:37 PM

I created a project to show the error I'm getting when binding to the dbgrid then clicking in a cell, I did so using the Delphi ADOQuery control. What I found is that it doesn't appear to happen when using that. The control I use normally (which worked okay with v5) is one that was built by a group of developers whom the company I work at inherited along with the code base. Since you won't have it, I can't include it.

 

It's acting weird, so I'm trying to figure out if the issue is with the ADO control or something else.

 

I hooked up things using the control I normally use in this test and no exceptions. I'll try and do exactly the same thing as before.

 

Edit: Hmm, ok no errors on either control in the test. It does blank out the values though if I click them. I'll send it to you so you can investigate that. This seems to be related to the query, if I select something from the database from our customer table for example "select top 100 * from customer" if I click cells they are cleared. If I run a sproc, "exec sp_stored_procedures" it just highlights them with a pale blue, and white text.



#7 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 27 February 2016 - 12:10 PM

If you can send it to me, this will be good.

Maybe you can send me stack to the error. This also will help.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#8 FourWhey

FourWhey
  • Members
  • 165 posts

Posted 29 February 2016 - 05:42 PM

If you can send it to me, this will be good.

Maybe you can send me stack to the error. This also will help.

 

I did send it and just noticed that it bounced. I'll try again.

Your message did not reach some or all of the intended recipients.

      Subject:     fourwhey: Test NextDBGrid6
      Sent:  2016-02-25 3:12 PM

The following recipient(s) cannot be reached:

      'boki@bergsoft.net' on 2016-02-25 3:12 PM
            This email message was not sent because of a server problem. Please wait 15 minutes and try again. If the problem continues, please contact your system administrator.


#9 FourWhey

FourWhey
  • Members
  • 165 posts

Posted 29 February 2016 - 05:44 PM

If you can send it to me, this will be good.

Maybe you can send me stack to the error. This also will help.

 

Still bouncing. Is there another way I can send it to you?

 

I posted it to OneDrive...  http://1drv.ms/1TMCrYP

Your message did not reach some or all of the intended recipients.

      Subject:     FW: fourwhey: Test NextDBGrid6
      Sent:  2016-02-29 9:44 AM

The following recipient(s) cannot be reached:

      'boki@bergsoft.net' on 2016-02-29 9:44 AM
            This email message was not sent because of a server problem. Please wait 15 minutes and try again. If the problem continues, please contact your system administrator.


#10 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 29 February 2016 - 05:57 PM

Hi,

Not sure why it bouncing. Maybe because of attachment content. But now I will use from OneDrive.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users