Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 27 Apr 2024, 19:24

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: 18 Oct 2013, 10:26 
Offline

Joined: 14 Oct 2013, 08:27
Posts: 32
First of all I must congratulate you for your grid component. I'm really impressed.

I've made a general purpose browse form using your grid. I load data from a TkbmMemTable using MemTableEh.LoadFromDataSet. I have included ehLibMTE for automatic sorting.
Testing it I've noticed the following:

1- Sorting is case sensitive: if I set descending order I get first invoice (lowercase) and second Valid (uppercase). I don't think this is correct. Could this behavior be changed setting any property or define somewhere?

2- If I move a column sorting does not work any more. It's like if sorting were based in original columns' indexes. If I replace the column to its original position it works again. It's really weird. Do I have to set anything in my code?

I´m using ehLib version 6.2.152 without sources in C++ Buiilder XE2 Update 4 hotfix 1.
Thank you for your help.

Edorta.


Top
 Profile  
 
PostPosted: 22 Oct 2013, 09:03 
Offline

Joined: 14 Oct 2013, 08:27
Posts: 32
Hello? No hints? Am I doing something wrong or is it the expected behavior? Can I change it anyhow?

Thanks in advance.


Top
 Profile  
 
PostPosted: 22 Oct 2013, 09:33 
Offline
Администратор

Joined: 22 Dec 2011, 20:19
Posts: 335
Hello

About (1): Set mtoTextFieldsCaseInsensitive value to TMemTableEh.Options property.

About (2): Could you write how to reproduce the error or send a project that demonstrate the error.

Best regards
Admin

_________________
Best regards
Admin


Top
 Profile  
 
PostPosted: 22 Oct 2013, 16:08 
Offline

Joined: 14 Oct 2013, 08:27
Posts: 32
I enclose a test project.

I load data from another DataSet with data already loaded (csv file). MemTableEh is set to mtoTextFieldsCaseInsensitive.

Code:
     
UnBrowse->MemTableEh1->Options << mtoTextFieldsCaseInsensitive;
UnBrowse->MemTableEh1->LoadFromDataSet(TblBrowse, -1, lmCopy, false);


Steps to reproduce:
Run the exe.
Sort the column named Observaciones clicking on the header. I get first uppercases and the lowercases.

For the second case, first check that the numeric columns Haber and Saldo sort properly clicking on their headers. Now move the column Saldo and place it in first place (before columna Nº).
I you try now to sort the columns Saldo and Haber it won't do it properly.

I look forward to hear from you soon.
Thanks in advance.


Attachments:
EHGrid_Sort.zip [32.35 KiB]
Downloaded 405 times
Top
 Profile  
 
PostPosted: 28 Oct 2013, 08:11 
Offline

Joined: 14 Oct 2013, 08:27
Posts: 32
Hello,

Have you been able to reproduce the issue?

Thanks in advance.

Edorta


Top
 Profile  
 
PostPosted: 28 Oct 2013, 16:56 
Offline

Joined: 14 Oct 2013, 08:27
Posts: 32
Hello,

After some testing I think the sorting and/or filtering problems I have could be related with the way I manage the color of certain rows.

In my DataSet I can have a special column named KOLOR, not visible.
I use the event OnDrawColumnCell of the grid. There I check if the field KOLOR has a color asigned. In that case I assign the color to the cells of that row:

Code:
  if (useColors)
  {
    TFont *TipoLetra= DBGridEh1->Canvas->Font;
    String sColor= MemTableEh1->FieldByName(NombreCampoColor)->AsString;

    TColor color= clBlack;
    if (sColor== "clAqua")
      color= clAqua;
    else...

    TipoLetra->Color= color;
    DBGridEh1->DefaultDrawColumnCell(Rect, DataCol, Column, State);
  }


When testing sorting/filtering sometimes I found the colored rows are not affected (for example they appear in the grid when they shouldn't).
Could you tell me if I am doing something wrong or if there is a better way of setting row colors based in the value of a field in the DataSet?.

Thank you very much in advance.

Edorta.


Top
 Profile  
 
PostPosted: 28 Oct 2013, 18:56 
Offline
Администратор

Joined: 22 Dec 2011, 20:19
Posts: 335
Hello

1.
I can't compile project because of the next components
// TkbmMemTable *QueryBr;
// TXLSDbRead4 *XLSDbRead41;
// TXLSReadWriteII4 *XLSReadWriteII41;
// TkbmCSVStreamFormat *fCSV_dummy;

2. There are no project file in the archive.

Best regards
Admin

_________________
Best regards
Admin


Top
 Profile  
 
PostPosted: 07 Nov 2013, 15:20 
Offline

Joined: 14 Oct 2013, 08:27
Posts: 32
Hello and sorry for the inconveniences.
I've downgraded the test project, taking off the components and leaving basic functionality.
As I said previously this is what I noticed.

1- Despite setting MemTable with mtoTextFieldsCaseInsensitive flag, sorting is still case sensitive.
Looking at column Observaciones if I set descending order I get "vsiento", ... "asiento", "Vsiento", ... "Asiento".
I don't think this is correct.

2- If I move a column, sorting does not work any more. It's like if sorting were based in original columns' indexes. If I replace the column to its original position it works again. It's really weird.
For example I order by column "Haber" and it works fine. Now, if I move column "Haber" to the left, just before column "Debe" and try to order again it does not work again until I replace the column to its original position.

I'm sending you the same test project but including the exe to your support email.
I'm using ehLib version 6.2.153 with sources in C++ Buiilder XE2 Update 4 hotfix 1.


Thank you very much for your help.

Edorta.


Attachments:
EHGrid_Sort2.zip [26.07 KiB]
Downloaded 238 times
Top
 Profile  
 
PostPosted: 07 Nov 2013, 17:27 
Offline
Администратор

Joined: 22 Dec 2011, 20:19
Posts: 335
Hello

1. There is a C++ Builder Bug (Or may be it is a feature)
Code:
    MemTableEh1->Options << mtoTextFieldsCaseInsensitive;

doesn't call TCustomMemTableEh.SetOptions

Use similar code

Code:
      TMemTableOptionsEh Options;
      Options << mtoTextFieldsCaseInsensitive;
      UnBrowse->MemTableEh1->Options =
                   UnBrowse->MemTableEh1->Options + Options;


2. Call
DBGrid1->Columns->AddAllColumns(True);
right before
AjustarGrid(DBGrid1, memTable, gbFiltroPorColumnas, gbAgrupar, gbPanelBusquedaArriba);

It will cause DBGrid1 to create persistent columns.
Dynamic columns somehow make FieldIndex in the DataSet invalid.

Best regards
Admin

_________________
Best regards
Admin


Top
 Profile  
 
PostPosted: 08 Nov 2013, 11:23 
Offline

Joined: 14 Oct 2013, 08:27
Posts: 32
It works like a charm.
Thank you very much!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 68 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group