Jump to content

Serge_G

Members
  • Content Count

    310
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Serge_G

  1. Serge_G

    Simple LiveBindings usage questions

    It's been a long time since I've looked into livebindings, outside database links and even, less in VCL being much more FMX 🙄 So, this question caught my attention. My first idea "its a VCL fact", but, writing the same sample in FMX, I got the same point 3 behaviour. My second clue was to notify BindingList a change, in memory my firsts steps with livebindings procedure TForm1.Button1Click(Sender: TObject); begin Checkbox1.Checked:=not Checkbox1.Checked; BindingsList1.Notify(Checkbox1,'checked'); end; But, unsuccessfully. My guess, checkbox state is changed after the drawing ? For that sort of, unusual, thing I used a one record ProtypeBindSource component with a boolean field And this code procedure TForm1.Button1Click(Sender: TObject); begin PrototypeBindSource1.DataGenerator.Fields.Items[0].SetTValue(not checkbox1.Checked); end; Project22.zip
  2. Serge_G

    Docking Example

    When I first learn about docking, I view these two Alister Christie's videos https://learndelphi.tv/60-movie-32-dockable-forms https://learndelphi.tv/61-movie-33-dockable-forms-2
  3. MyDac can use macro https://docs.devart.com/mydac/work_macros.htm Something like this code (sorry, I don't use Mydac but Firedac) Query1.SQL.Text := 'SELECT * FROM user Where ID IN (&list)'; Query1.MacroByName('list').asString := '1,2,3'; Query1.Open; Otherwise, you can use a format string sqlstring:='SELECT * FROM users WHERE id IN (%s)'; inlist := '1,2,3' query.sql.text:=Format(sqlstring,[inlist]); Ok, it's really a very poor code !
  4. Hi, This is a question I can't respond easily, I have to write one Android application to check that. I will be back 😄 Meanwhile, check/ask on ZeosLib Portal
  5. My way : 1 - Open ZEOSDBO.groupProj. (not bpl ) 2 - Compile each package (in order) and, for design one, install. Long time ago I start writing a French tutorial, unfinished because I use now Firedac in priority.
  6. That's why I write MyTable.Filtered := not Mytable.Filter.isEmpty;
  7. A retired champion for now so I have time. I don't remember if I install ZEOS on my D11 version, but I always use SVN (http://svn.code.sf.net/p/zeoslib/code-0/trunk) version of ZEOSDBO, perhaps this is why I don't mind this compatibility trouble 😄 as you can see also ready for Delphi 12 Athenes Best wishes for new year
  8. Serge_G

    fmx advanced tutorials

    Not only I think, my last pro applications were written with fmx (even for windows) in mind Linux (not MacOS) distribution. Tutorials ? I don't think there is much. I wrote some French ones for Livebindings, TListview and building components you can find here, take a look at my blog too 😉 My first steps with fmx were watching all videos I can found from Embarcadero events and others. I don't use all that getit template stuff but think there is something to dig there And remember there are a lot of samples in demo directory Fresh retired, my top ten to-do list is to finish my tutorial "writing fmx components : RadioGroupBox" and beginning a book on FMX Styles
  9. Not sure, but take a look at ZEOSDBO components . (portal)
  10. Serge_G

    Custom color not in color property list

    For each question (first one) I suggest you to indicate Delphi version. use a TPageControl linked to a TImageList. You can change for each tab the imageindex property (-1 to "hide" image) If Delphi 11, for the Font Color problems, with new versions you have to take care of StyleElements property, if you have set some appearance (style) to the project and don't remove seFont from the array then color you set at runtime should not be taken into account. Here, appearance is set to "Windows10 blue", button1.click code Label1.font.Color:=clred; is inefficient except if you set Label1.StyleElements:=Label1.StyleElements-[seFont]
  11. Serge_G

    Help to find database error

    so, use this one not only dat2.sqlite. you can also use '..\..\Data\dat2.sqlite' (second ..\ go up one level win32 first ..\ to project) if you want to use only dat2.sqlite database have to be in this directory
  12. Serge_G

    Help to find database error

    Are you sure of that? Program in debug mode is in a xxx\win32\debug directory where xxx is where are your project, unit and dfm path
  13. Serge_G

    Help to find database error

    You can add parameters , just adding an array FDQuery1.Open('SELECT * FROM DAT2 WHERE <Column>=:V',[<aValue>]); easy, and quick, no need to close FDQuery1
  14. Serge_G

    Help to find database error

    'D:\Database=Delphi 11 Community\My Projects\FDTest\Data\dat2.sqlite' Problem is here. I don't think path is correct. First this = is somehow perturbing me, and those white spaces 🙄 don't help I suspect you use part of the info here but, don't use 'Database' just the database file path Then I am not sure your database is disconnected when you run program (set option ActiveStoredUsage to [] or only [auDesignTime] as @haentschman simplify your code, code can be only FDquery1.Open(query); or FDquery1.Open('Select * from DAT2'); And last but not least, you will be confronted with a "locking" problem if you don't set connexion option LockingMode to Normal
  15. Serge_G

    Removing String

    Did you consider using regular expressions ? uses system.regularexpressions; procedure TForm1.Button1Click(Sender: TObject); var reg : TRegEx; r : String; const s = 'This is (string) which need to (remove)'; begin reg:=TRegEx.Create('\([^()]*\)'); r:=reg.Replace(s,''); showmessage(r); end;
  16. Serge_G

    Help to find database error

    Hum, looking at your dfm, I saw you use DBX components (hate those 😄). I was wondering why till I click on the link ! My suggestion still the same, use Firedac components 😉 As samples, you can find some clues in C:\Users\Public\Documents\Embarcadero\Studio\22.0\Samples\Object Pascal\Database\FireDAC\Samples\Getting Started\SQLite and more Let me show you my version of your objective unit1.dfm and .pas object Form1: TForm1 Left = 0 Top = 0 Width = 686 Height = 501 AutoScroll = True Caption = 'SQlite test' Color = clAqua Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -12 Font.Name = 'Segoe UI' Font.Style = [] OnCreate = FormCreate TextHeight = 15 object DBGrid1: TDBGrid Left = 0 Top = 0 Width = 672 Height = 177 Align = alTop DataSource = DataSource1 TabOrder = 0 TitleFont.Charset = DEFAULT_CHARSET TitleFont.Color = clWindowText TitleFont.Height = -12 TitleFont.Name = 'Segoe UI' TitleFont.Style = [] end object DBNavigator1: TDBNavigator Left = 0 Top = 177 Width = 672 Height = 25 DataSource = DataSource1 Align = alTop TabOrder = 1 ExplicitTop = 183 end object Button1: TButton Left = 120 Top = 208 Width = 75 Height = 25 Caption = 'Button1' TabOrder = 2 OnClick = Button1Click end object Memo1: TMemo Left = 0 Top = 237 Width = 672 Height = 229 Align = alBottom Lines.Strings = ( 'This will be fed via Button1 click') ScrollBars = ssVertical TabOrder = 3 end object FDConnection1: TFDConnection Params.Strings = ( 'Database=C:\Users\Public\Documents\Embarcadero\Studio\22.0\Sampl' + 'es\Data\fddemo.sdb' 'LockingMode=Normal' 'DriverID=SQLite') ConnectedStoredUsage = [] Connected = True LoginPrompt = False Left = 288 Top = 16 end object FDTable1: TFDTable IndexFieldNames = 'CategoryID' Connection = FDConnection1 ResourceOptions.AssignedValues = [rvEscapeExpand] TableName = 'Categories' Left = 176 Top = 32 end object DataSource1: TDataSource DataSet = FDTable1 Left = 376 Top = 48 end end unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.DBCtrls, Vcl.Grids, Vcl.DBGrids, Vcl.StdCtrls, Data.DB, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.SQLite, FireDAC.Phys.SQLiteDef, FireDAC.Stan.ExprFuncs, FireDAC.Phys.SQLiteWrapper.Stat, FireDAC.VCLUI.Wait, FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt, FireDAC.Comp.DataSet, FireDAC.Comp.Client ; type TForm1 = class(TForm) FDConnection1: TFDConnection; DBGrid1: TDBGrid; DBNavigator1: TDBNavigator; Button1: TButton; Memo1: TMemo; FDTable1: TFDTable; DataSource1: TDataSource; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); private { Déclarations privées } public { Déclarations publiques } end; var Form1: TForm1; implementation {$R *.dfm} uses StrUtils; procedure TForm1.Button1Click(Sender: TObject); var I: Integer; S : String; begin fdtable1.First; memo1.Lines.Clear; while not Fdtable1.EOF do begin memo1.Lines.Add('knowing fieldnames and type'); memo1.Lines.Add(Format('%s %s %s',[fdtable1.FieldByName('CategoryID').asString, fdtable1.FieldByName('CategoryName').asString, fdtable1.FieldByName('Description').asString])); memo1.Lines.Add('using fielddefs'); S:=''; for I := 0 to FdTable1.FieldDefs.Count - 1 do begin if FDtable1.Fields[i].DataType=ftBlob // not readable data then S:=S+' (GRAPHIC)' else S:=S+Ifthen(I>0,' ','')+ // no separator for for first field FDtable1.Fields[i].asString; end; Memo1.Lines.Add(S); fdtable1.Next; end; fdtable1.First; end; procedure TForm1.FormCreate(Sender: TObject); begin fdtable1.Open(); end; end. Note. Table used contains only a few records so it is acceptable to use this sort of code, with huge one a thread should be considered, but, for a beginner it's a big piece
  17. Serge_G

    TFDBatchMove with non NULL column in target table

    One other way is to use a Query as datasource, then you can rename columns or set columns and so on i.e SELECT ...., KASE_EINSTELLUNGEN as DRAWBACK_CALCULATION, 0 AS PRINT_SMALLBONS .... FROM You said you use onNewRecord but, did you try onBeforePost ? (I don't check if this event is called)
  18. Serge_G

    Konopka and Parnassus for Delphi 12?

    Think this page is for Delphi Community version
  19. Serge_G

    Help to find database error

    Agree @Stano Firebird SQL is a very good RDBMS, all my pro GPAO suite use it. SQLite has also some advantages for mono-station programs ZeosLib can be used with many database system, not only firebird ones You have only to change Zconnection.protocol parameter to sqlite (or sqlite-3). If you find more doc ZEOSDBO+Firebird you can apply all (or at least a good part of) the doc to SQlite as well. Effectively when I wrote (never finished, but on the web) a (French) tutorial about ZEOS components my samples was Firebid ones also
  20. Ah, the "synch" one ! I never search for this one. In my mind you need at least to declare in your code procedure ObserverToggle(const AObserver: IObserver; const Value: Boolean); protected function CanObserve(const ID: Integer): Boolean; override; Then check a unit like FMX.Listview.pas (searching 'observer') EditLinkID, PositionLinkID and IteratorLinkID (from System.Classes) seems to be the keys
  21. have a look at http://docwiki.embarcadero.com/RADStudio/Seattle/en/Tutorial:_Creating_LiveBindings-Enabled_Components in short, you need to declare these procedures and function in your component code procedure ObserverToggle(const AObserver: IObserver; const Value: Boolean); protected function CanObserve(const ID: Integer): Boolean; override; procedure ObserverAdded(const ID: Integer; const Observer: IObserver); override; and do some register observable members If you read French, I wrote some tutorials (part I, part II)
  22. Serge_G

    Raize TRZCheckBox and CustomGlyphImages

    Got same issue. As workaround, I force UseCustomGlyphs to true at runtime. procedure TForm1.FormCreate(Sender: TObject); begin for var ctrl in GetControls() do begin if ctrl is TRzCheckBox then TRZCheckBox(ctrl).UseCustomGlyphs:=true; end; end;
  23. Serge_G

    Help to find database error

    Can I make two suggestions? First one, if you absolutely want to keep Delphi 7 use, try to install ZEOSLIB (aka &nbsp;ZEOSDBO) and use this data access component suite instead of DBExpress Second, try Delphi 11 community, with his Firedac components,
  24. Serge_G

    New Firebird 4 datatype "TIMESTAMP WITH TIMEZONE"

    Same thing for me ! I tried your sample, giving me a 326 value for a GMT one Then I wrote this simple code procedure TForm1.FDQuery1MONCREATION_DATEGetText(Sender: TField; var Text: string; DisplayText: Boolean); begin text:=sender.asString; end; Giving me an "Incorrect argument for time encoding. " error with my french version
  25. Serge_G

    New Firebird 4 datatype "TIMESTAMP WITH TIMEZONE"

    @Dmitry Arefiev My tests was with Delphi 12 first. Some links or clues ? Agree, even if I rarely use FDTable 😉
×