#1 2011-06-15 07:50:57

corchi72
Member
Registered: 2010-12-10
Posts: 232

Error To compile SQLite3UIEdit version 1.14

Today I downloaded the "6f2a76894f" Synops of, but completing an error occurs in file "SQLite3UIEdit"at line

aCaption: = CaptionName (OnCaptionName, @ P ^. Name);

I saw that you have modified the file "SQLite3i18n" and you have replaced

text: = TranslateOne (CompName, ppi ^. Name);

with

text: = TranslateOne (CompName, ppi ^. ShortName);

Thank corchi

Offline

#2 2011-06-15 11:50:13

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,232
Website

Re: Error To compile SQLite3UIEdit version 1.14

Yes, you're right.

Corrected in http://synopse.info/fossil/info/b4c00d1253

Offline

#3 2011-06-15 12:00:59

corchi72
Member
Registered: 2010-12-10
Posts: 232

Re: Error To compile SQLite3UIEdit version 1.14

ok thanks

Offline

#4 2011-06-16 01:39:50

Leander007
Member
From: Slovenia
Registered: 2011-04-29
Posts: 113

Re: Error To compile SQLite3UIEdit version 1.14

I have test it your TRecordEditForm with sources dating 2011-06-11. I saw that sets (TGroupBox implementation) could not be editable (the result was not really set to the TSQLRecord on BtnSaveClick).
So I changed the code that it works (at least it looks like that smile) and "render" properly and nothing else (several calls to InheritsFrom, this could be changed).

I have done four changes in SetRecord procedure:

procedure TRecordEditForm.SetRecord(aClient: TSQLRestClient;
  aRecord: TSQLRecord; CSVFieldNames: PUTF8Char=nil; Ribbon: TSQLRibbon=nil;
  FieldHints: string=''; FieldNamesWidth: integer=0; aCaption: string='');
var i,j, aID, Y, aHeight, aWidth, CW: integer;
    (...)
    C: TWinControl;
    Group: TGroupBox absolute C; // -----------------------------------------------------> CHANGE 1
    (...)
begin
         (...)    
          sftSet: begin
            (...)
            for j := 0 to E^.MaxValue do
              with TCheckBox.Create(Scroll) do begin // add set checkboxes
                (...)
              end;
            inc(Y,Group.Height+12);
            //continue; // --------------------------------------------------------------> CHANGE 2
          end;
          (...)
      if (C<>nil) and (C<>self) and (C<>Scroll) then begin
        (...)
        if not C.InheritsFrom(TCheckBox) then
        if C.InheritsFrom(TLabeledEdit) then begin
          (...)
        end else if not C.InheritsFrom(TGroupBox) then // -------------------------------> CHANGE 3
        with TLabel.Create(Scroll) do begin // add label left-sided to the field
          (...)
        if C.InheritsFrom(TDateTimePicker) then begin
          (...)
        end
        else if not C.InheritsFrom(TGroupBox) then // -----------------------------------> CHANGE 4
          C.SetBounds(FieldNamesWidth,Y,200,22);
        fFieldComponents[i] := C;
        inc(Y,aHeight);
      end;
    end;
  end;

Last edited by Leander007 (2011-06-16 01:47:27)


"Uncertainty in science: There no doubt exist natural laws, but once this fine reason of ours was corrupted, it corrupted everything.", Blaise Pascal

Offline

#5 2011-06-16 05:34:48

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,232
Website

Re: Error To compile SQLite3UIEdit version 1.14

I forget about this poor little sftSet kind of field.
Sorry for him!

But your fix is not working as expected.
By commenting the continue keyword, you will override a lot of specific behavior of set.
The continue should remain here.
IMHO just one line (setting fFieldComponents[] array) is missing:

            inc(Y,Group.Height+12);
            fFieldComponents[i] := C;
            continue;

See http://synopse.info/fossil/info/2efd86b189

Thanks for the feedback.

Offline

#6 2011-06-16 09:52:19

Leander007
Member
From: Slovenia
Registered: 2011-04-29
Posts: 113

Re: Error To compile SQLite3UIEdit version 1.14

Yes, that was my comment about "several calls to InheritsFrom, this could be changed" smile , because I realized that fFieldComponents was not assigned for sets smile.
I did not realized if commenting continue will break something, because I changed the flow control (dirty and long version) where is not set related.
I will test it later if all works with your new version.


"Uncertainty in science: There no doubt exist natural laws, but once this fine reason of ours was corrupted, it corrupted everything.", Blaise Pascal

Offline

#7 2011-06-16 12:07:40

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,232
Website

Re: Error To compile SQLite3UIEdit version 1.14

Leander007 wrote:

I did not realized if commenting continue will break something, because I changed the flow control (dirty and long version) where is not set related.

For instance, with the "long version", Tag value was overridden, OnComponentCreated was trigerred twice, Hint property wrongly set, and so on...

Offline

#8 2011-06-16 14:06:26

Leander007
Member
From: Slovenia
Registered: 2011-04-29
Posts: 113

Re: Error To compile SQLite3UIEdit version 1.14

You missed the first change:

C: TWinControl;
Group: TGroupBox absolute C;

Without this the code does not work, because you are assigning different "C" control.

You are still having minor compile errors in SQLite3i18n unit.
Please could you check version in fossil (I must synch each way when I download smile), maybe you are having right working copy, but wrong check-in in fossil version control. 

unit SQLite3i18n:

procedure ExtractAllResources...

line 2850 is

AddOnceDynArray(WinAnsiString(TSQLRecord.CaptionName(@P^.Name)));

should be

AddOnceDynArray(WinAnsiString(TSQLRecord.CaptionName(@P^.ShortName)));

line 2890 is

AddOnceDynArray(WinAnsiString(CaptionName(@P^.Name)));

should be

AddOnceDynArray(WinAnsiString(CaptionName(@P^.ShortName)));

"Uncertainty in science: There no doubt exist natural laws, but once this fine reason of ours was corrupted, it corrupted everything.", Blaise Pascal

Offline

#9 2011-06-16 15:43:26

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,232
Website

Re: Error To compile SQLite3UIEdit version 1.14

Leander007 wrote:

You missed the first change:

Group: TGroupBox absolute C;

Without this the code does not work, because you are assigning different "C" control.

I didn't miss this one, but the correct missing line was this one:

fFieldComponents[i] := Group;
Leander007 wrote:

You are still having minor compile errors in SQLite3i18n unit.

Yes, I didn't try compiling it with EXTRACTALLRESOURCES conditional on!!!

I didn't work on the UI part for some weeks... sorry...

Should work with this commit: http://synopse.info/fossil/info/215dfe5ac7

Offline

#10 2011-06-17 03:05:03

coblongpamor
Member
From: Bali-Indonesia
Registered: 2010-11-07
Posts: 130
Website

Re: Error To compile SQLite3UIEdit version 1.14

i don't know how to implement TOnComponentCreated, TOnComponentCreate, TOnComponentValidate in SQLite3UIEdit, and
what is coresponding with SQLite3UIOption.

how i can to override just bound of component coresponding field that setted in SetRecord(..)?
plase give me simple sample code so i can learn it..

and could you fix the SQLitel3UIOption since it's still depend on TAdvGlowButton.?

thanks.

Last edited by coblongpamor (2011-06-17 03:19:59)

Offline

#11 2011-06-17 10:37:42

Leander007
Member
From: Slovenia
Registered: 2011-04-29
Posts: 113

Re: Error To compile SQLite3UIEdit version 1.14

coblongpamor, if you need really customized look of edit form, then don't use TRecordEditForm, but develop custom GUI by "hand" (using Delphi RAD approach) as is done in Main Demo in FileEdit.pas (TEditForm) and manipulate with TSQLRecord as you wish.

Looking at the code should be enough, because basics of the framework are used in it.


"Uncertainty in science: There no doubt exist natural laws, but once this fine reason of ours was corrupted, it corrupted everything.", Blaise Pascal

Offline

#12 2011-06-17 11:01:56

Leander007
Member
From: Slovenia
Registered: 2011-04-29
Posts: 113

Re: Error To compile SQLite3UIEdit version 1.14

Arnaud you made lapsus in 215dfe5ac7.

Unit SQLite3UIEdit

line 394:

if E^.MaxValue>31 then // up to 32 elements in tkSet (GetOrdValue)
  SetMax := 31 else
  SetMax := E^.MaxValue;
Sets := P^.GetOrdValue(aRecord);
E := P^.PropType^^.SetEnumType;

should be:

Sets := P^.GetOrdValue(aRecord);
E := P^.PropType^^.SetEnumType;
if E^.MaxValue>31 then // up to 32 elements in tkSet (GetOrdValue)
  SetMax := 31 else
  SetMax := E^.MaxValue;

I saw that you did some cleanup in this procedure smile, but excluding this, is there any real difference with

Group: TGroupBox absolute C;

approach as you did for other controls and this latest code when you assign Group directly?


"Uncertainty in science: There no doubt exist natural laws, but once this fine reason of ours was corrupted, it corrupted everything.", Blaise Pascal

Offline

#13 2011-06-17 12:02:47

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,232
Website

Re: Error To compile SQLite3UIEdit version 1.14

Leander007 wrote:

... is there any real difference with

Group: TGroupBox absolute C;

approach as you did for other controls and this latest code when you assign Group directly?

Yes, the TGroupBox is not handled as the active component, but every internal TCheckBox is.
As I stated above:

ab wrote:

For instance, with the "long version", Tag value was overridden, OnComponentCreated was trigerred twice, Hint property wrongly set, and so on...

Offline

#14 2011-06-17 12:36:19

Leander007
Member
From: Slovenia
Registered: 2011-04-29
Posts: 113

Re: Error To compile SQLite3UIEdit version 1.14

ab wrote:
Leander007 wrote:

You missed the first change:

Group: TGroupBox absolute C;

Without this the code does not work, because you are assigning different "C" control.

I didn't miss this one, but the correct missing line was this one:

fFieldComponents[i] := Group;

With first code excerpt goes this too:

fFieldComponents[i] := C;
continue;

I was not thinking about the "long" version, but only about upper comparison, because later you use continue word, so the flow control is changed and the "extra" code

if (C<>nil) and (C<>self) and (C<>Scroll) then begin

is never reached in set case.
So It seems that you were using C only for common handling of controls and TGroupBox does not count in it.
From technical aspect usage of the upper is the same, but cleaner design is assigning Group, not the C.


"Uncertainty in science: There no doubt exist natural laws, but once this fine reason of ours was corrupted, it corrupted everything.", Blaise Pascal

Offline

#15 2011-06-17 14:27:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,232
Website

Re: Error To compile SQLite3UIEdit version 1.14

Various minor fixes or changes for this unit.
See http://synopse.info/fossil/info/bdf1f00225

Offline

Board footer

Powered by FluxBB