Page 1 of 1

rule EqualTo

PostPosted: 15 May 2017 13:11
by yocko
Hi,

I am experimenting with latest development version 4.0.0.3 (download link is saying 4.0.0.5, but installer says 4.0.0.3).

In your demo (unit CGJQEditFeatures) I added new edit on frame and included this code (I found it as your suggestion in one forum post):

Code: Select all
procedure TCGJQEditFeaturesFrame.IWCGJQFrameCreate(Sender: TObject);
begin
  IWCGJQNewEdit.JQValidateOptions.Enable:= True;
  with IWCGJQNewEdit.JQValidateOptions.Rules.Add do
    begin
      Rule  := jqvorvEqualTo;
      Value := '#' + IWCGJQEdit7.JQHTMLName;
    end;
end;


As you see on video bellow, rule EqualTo doesn't work... After values are equal it still reports error...
Image

Regards

Re: rule EqualTo

PostPosted: 15 May 2017 14:35
by Jorge Sousa
Hi

About

I am experimenting with latest development version 4.0.0.3 (download link is saying 4.0.0.5, but installer says 4.0.0.3).


We cannot confirm this, can you please check again, and tell us wiyyou think is 4.0.0.3 instead of 4.0.0.5

Please try with

Value := '#' + IWCGJQEdit7.HTMLName;

instead

Re: rule EqualTo

PostPosted: 15 May 2017 16:21
by yocko
Jorge Sousa wrote:Hi

About

I am experimenting with latest development version 4.0.0.3 (download link is saying 4.0.0.5, but installer says 4.0.0.3).


We cannot confirm this, can you please check again, and tell us wiyyou think is 4.0.0.3 instead of 4.0.0.5


Installer (downloaded some day back - probably on friday) is reporting 4.0.0.3
Image

I downloaded again today and now it is reporting 4.0.0.5 (also installer size is different)




Jorge Sousa wrote:Please try with

Value := '#' + IWCGJQEdit7.HTMLName;


It does NOT work either :( Same behaviour as in video in my first post.

Re: rule EqualTo

PostPosted: 16 May 2017 15:34
by Alexander Bulei
Hi yocko,

Please send us simple testcase...we've tested here and works as expected.

Best Regards.

Re: rule EqualTo

PostPosted: 17 May 2017 08:30
by yocko
Alexander Bulei wrote:Hi yocko,

Please send us simple testcase...we've tested here and works as expected.

Best Regards.


Reproducing is easy with your original demo.

In your edit demo (unit CGJQEditFeatures) I added new edit on frame and included this code (I found it as your suggestion in one forum post):

Code: Select all
procedure TCGJQEditFeaturesFrame.IWCGJQFrameCreate(Sender: TObject);
begin
  IWCGJQNewEdit.JQValidateOptions.Enable:= True;
  with IWCGJQNewEdit.JQValidateOptions.Rules.Add do
    begin
      Rule  := jqvorvEqualTo;
      Value := '#' + IWCGJQEdit7.JQHTMLName;
      //Value := '#' + IWCGJQEdit7.HTMLName;  --> doesn't work either
    end;
end;


Attached is also a simple demo project. I have two rules created in design time and one rule added in run time. And that run time added rule (EqualTo) doesn't work.

Here is video to show error for rule EqualTo (second edit to first edit) in my demo
Image

Regards

Re: rule EqualTo

PostPosted: 17 May 2017 12:31
by Alexander Bulei
Hi yocko,

Please check your changed demo in attachment.

Best Regards.

Re: rule EqualTo

PostPosted: 17 May 2017 19:03
by yocko
Thanks. Your corrected demo works (if only one frame is used).

Here is my feedback for run time created rule using multiple frames:

If I am using multiple frames I must use real frame name (as you suggested) for every frame I create It can't be just 'Frame' as I saw in your original cgDevTools demo code:
Code: Select all
CGFindUniqueComponentName(Self,'Frame')


That was the reason why run time created rule for new edit I added to your original edit features frame demo didn't work (see video in my first post).

In demo I sent you (and you corrected it) I added another frame and run time created rule works correctly on ALL frames ONLY if I use:
Code: Select all
function TIWComponentForm.CreateNewFrame(AFrameClass: TIWCGFrameClass): TFrame;
var
  NewName: string;
begin
  NewName:= CGFindUniqueComponentName(Self,Copy(AFrameClass.ClassName,2,length(AFrameClass.ClassName)-1)); //not just 'Frame' !!!
  ...
  ...


If I add same code to your original cgDevTools demo (edit features frame with my new edit added) it works too. So obvioulsy run time created rule works correctly ONLY if frame is created with not only correct FrameClass BUT ALSO frame's real name.

Is it OK to create frames that way?
Code: Select all
NewName:= CGFindUniqueComponentName(Self,Copy(AFrameClass.ClassName,2,length(AFrameClass.ClassName)-1));

At least rune time created rules works in that case ;)

I am newbie, learning new cgDevTools stuff every day. Thanks for your help. I really appreciate it.


P.S. (not related to topic)
As a total newbie I am missing some cgDevTools programming tutorial how to do some things. There are so many properties so now I am learning by studying your demo and reading all forums topics, but as there are so many cgDevTools properties it is hard to find out what to change to get some result.

Your support is TOP. No question about that. But I understand we are taking away your time for basic questions which could be described in some tutorial with basic topics (working with frames, validating input...). So here is my +1 vote for such tutorial. :)