Recent

Author Topic: DBGird field dimension block  (Read 953 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
DBGird field dimension block
« on: April 20, 2018, 01:52:37 pm »
Hi guys, can anyone explain how to reduce the size of a dbgrid field from code? I'll explain. I have a field of type varchar (100) and I want to encrypt the text that ends up in it, making it transparent to the user.

For example I have the field called surname of type varchar (100) and from the dbgrid I go to set the value "Hello World" that on the database is written as "GLOd9o4vUJtI755MDoUNh1qRVyl851mu7uJAeuITCs0 =" until the encrypted string is less than 100 characters is OK, but we assume that it exceeds, how can I put a block to the dbgrid for the number of characters that can be entered in the clear?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: DBGird field dimension block
« Reply #1 on: April 20, 2018, 02:43:16 pm »
The field's size is passed as a MaxLength on the editor if that is not enough for you then set the TDBEdit's MaxLength property to what ever you desire. That means that you have to take control of the editor creation or initialization process from the dbgrid.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

 

TinyPortal © 2005-2018