Recent

Author Topic: Stringgrid validate How ?  (Read 3970 times)

k1attila1

  • Full Member
  • ***
  • Posts: 105
Stringgrid validate How ?
« on: November 28, 2014, 12:25:42 pm »
Hi

Stringgrid :

How can i validate the content of a cell and how can i prevent to move to the next cell
if the result of validate is FALSE.

thanks


Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Stringgrid validate How ?
« Reply #1 on: November 28, 2014, 12:43:52 pm »
You can use event OnValidateEntry. If NewValue is not valid, you can change it to OldValue or to some valid default value. Although I don't know how to prevent the move (other than setting AutoAdvance to aaNone).
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

k1attila1

  • Full Member
  • ***
  • Posts: 105
Re: Stringgrid validate How ?
« Reply #2 on: November 28, 2014, 01:12:55 pm »

So, Abort; method in OnValidateEntry prevent to leave the actual cell.

But using Abort; procedure in Lazarus very chaotic.

for example :

Field.OnValidate - Abort doesn't prevent to leave the actual dbcontrol
Edit.onExit - ABORT doesn't prevent to move the cursor to the next field

etc....

Sometimes works , sometimes not....








Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Stringgrid validate How ?
« Reply #3 on: November 28, 2014, 06:29:21 pm »
IMO Abort; is not intended to be used in GUI apps.at all.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Stringgrid validate How ?
« Reply #4 on: November 29, 2014, 01:26:28 am »
IMO Abort; is not intended to be used in GUI apps.at all.

Abort is the only silent exception that the library supports it is supposed to be used everywhere. The problem is that when an event is raised does it give the ability to the end user to stop the action in its tracks? If not why not?
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

k1attila1

  • Full Member
  • ***
  • Posts: 105
Re: Stringgrid validate How ?
« Reply #5 on: November 29, 2014, 10:12:26 am »

for example work well Abort :

- DataSet : -beforedelete
                -beforeinsert
                - beforepost
                  etc.
But not work absoultely in visual components (which have text input tedit, tmemo, tdbedit etc. ) - onexit method




               

mangakissa

  • Hero Member
  • *****
  • Posts: 1131
Re: Stringgrid validate How ?
« Reply #6 on: December 01, 2014, 09:09:38 am »
use stringgrid as readable records. For editing use Other GUI controls which are not related to multiple records.
Lazarus 2.06 (64b) / FPC 3.0.4 / Windows 10
stucked on Delphi 10.3.1

 

TinyPortal © 2005-2018