Jump to content


Photo

dbgrid color problem


  • Please log in to reply
37 replies to this topic

#21 allenchow

allenchow

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 189 posts

Posted 14 June 2018 - 07:20 AM

Also when you open main.dfm with notepad, you'll see the column of company is 64 :

       item
          FieldName = 'Company'
          Title.Caption = 'Company'
          Width = 64
        end
        item
 
But when open inside Delphi , it changes to 184 automatically 

  • 0

#22 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4987 posts

Posted 14 June 2018 - 07:47 AM

 

Also when you open main.dfm with notepad, you'll see the column of company is 64 :

       item
          FieldName = 'Company'
          Title.Caption = 'Company'
          Width = 64
        end
        item
 
But when open inside Delphi , it changes to 184 automatically 

 

 

TColumn has a method named DefaultWidth (64), which is called in particular when the width hasn't been explicitly assigned to the column (which is true for the dynamically created grid columns).

Basically, it takes the column's associated field's display width (in chars) and multiplies it by the width of the 0 character (in pixels), using the corresponding font.

It then compares the result to the width of the title (in pixels) and returns the greater value.

 

https://stackoverflo...dths-to-display


  • 0

#23 allenchow

allenchow

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 189 posts

Posted 14 June 2018 - 07:53 AM

Did you try the method that I mentioned in #20 ?


  • 0

#24 allenchow

allenchow

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 189 posts

Posted 14 June 2018 - 08:03 AM

Maybe try this one, you will see spaces in page 1 or page 2 

Attached Files


  • 0

#25 allenchow

allenchow

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 189 posts

Posted 14 June 2018 - 08:04 AM

 

TColumn has a method named DefaultWidth (64), which is called in particular when the width hasn't been explicitly assigned to the column (which is true for the dynamically created grid columns).

Basically, it takes the column's associated field's display width (in chars) and multiplies it by the width of the 0 character (in pixels), using the corresponding font.

It then compares the result to the width of the title (in pixels) and returns the greater value.

 

https://stackoverflo...dths-to-display

 

Thanks, in that case, I can't set width 64 ! Otherwise it will change to other width. 

I change to width 65 now . Try project 1 above


  • 0

#26 allenchow

allenchow

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 189 posts

Posted 14 June 2018 - 08:09 AM

But in another application , I've set the first column width to 120 and save. But when I open it again , it changed back to 64 ! 


  • 0

#27 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4987 posts

Posted 14 June 2018 - 08:12 AM

Maybe try this one, you will see spaces in page 1 or page 2 

 

Yes, I see the issue

 

Please report to support portal with this testcase


  • 0

#28 allenchow

allenchow

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 189 posts

Posted 14 June 2018 - 08:20 AM

Hi,

 

I'm sorry, I don't really understand your request

 

Just like : http://forums.unigui...elected-record/

When I select a row, it supposes to show  the selected color , no matter what that original color it has . ... 


  • 0

#29 allenchow

allenchow

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 189 posts

Posted 14 June 2018 - 08:29 AM

But in another application , I've set the first column width to 120 and save. But when I open it again , it changed back to 64 ! 

Try this test case, I've set the first column width to 120, but when I open main.pas, it changes to 64. 

Attached Files


  • 0

#30 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4987 posts

Posted 14 June 2018 - 08:38 AM

Try this test case, I've set the first column width to 120, but when I open main.pas, it changes to 64. 

 

I couldn't reproduce this issue


  • 0

#31 allenchow

allenchow

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 189 posts

Posted 14 June 2018 - 08:53 AM

Is it due to version that I use : 1.10.0.1460?


  • 0

#32 allenchow

allenchow

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 189 posts

Posted 14 June 2018 - 09:10 AM

Use the latest version , still the same !

Did you try opening the main.pas file and see the first column width is 64 ?

Attached Files


  • 0

#33 allenchow

allenchow

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 189 posts

Posted 15 June 2018 - 03:14 AM

really frustrated ......


  • 0

#34 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4987 posts

Posted 17 June 2018 - 05:51 PM

Yes, I see the issue

 

Please report to support portal with this testcase

 

Can you try to use this approach for now?!:

procedure TMainForm.UniDBGrid1AfterLoad(Sender: TUniDBGrid);
begin
  (Sender as TUniDBGrid).JSInterface.JSCall('view.autoSizeColumn', [0]);
end;

  • 0

#35 allenchow

allenchow

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 189 posts

Posted 18 June 2018 - 02:15 AM

Actually in many cases I want a fixed column width with word wrap inside
  • 0

#36 allenchow

allenchow

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 189 posts

Posted 18 June 2018 - 02:54 AM

I’ve found something like this:

Setting white-space: normal; causes rendering issues when scrolling, using ExtJS 6

You should set cellWrap: true on the column, as pointed out by this thread:

https://www.sencha.c...und-auto-expand

Is it possible to have cellwrap implemented?
  • 0

#37 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4987 posts

Posted 18 June 2018 - 03:56 AM

OK, we will check it


  • 0

#38 allenchow

allenchow

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 189 posts

Posted 19 June 2018 - 02:22 AM

I think implementing cellWrap will solve the problem of white-space : normal inside css


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users