Demo's for IWJQAccordion and IWJQPageControl

<< Click to Display Table of Contents >>

Navigation:  Forum >

Demo's for IWJQAccordion and IWJQPageControl

Forum link

 

Pages: 1 2

 


 

04-19-2023, 08:05 AM:

 

Hi Alexandre,

 

Would it be possible to get some demo's for IWJQAccordion and IWJQPageControl?

 

Whatever I try, I constantly get Access Violations.

 

Thanks in advance!

 

Cheers, Paul

 


 

04-19-2023, 10:59 PM:

 

Are you using the latest version? Where exactly do you get those AVs?

 

I'll be publishing a demo later today, with both components anyway, but it would be good to know in advance if I can recreate the issue here.

 


 

04-20-2023, 07:46 AM:

 

Hi Alexandre,

 

I'm using Delphi 11.3, patch 1 with IW 15.3.3.

 

When creating my form, I have an empty Accordion and dynamically create Sections with:

 

    ...

 

    s := TIWJQSection.Create(AccordionRemarks);

 

    s.Name := 'Section_' + IntToStr(i);

 

    s.Caption := 'Section_' + IntToStr(i);

 

    s.SectionIndex := i;

 

    AccordionRemarks.AddSection(s);

 

    Inc(i, 1);

 

   ...

 

When publishing the form, I get an AV.

 


 

04-21-2023, 12:39 AM:

 

Here is how you can easily create this. Use methods CreatePage and CreateSection of the IWjQPageControl and IWjQAccordion:

 

Code:

 

newSection := AccordionRemarks.CreateSection('Caption of the section here');

 

newPage := YourPageControl.CreatePage('Caption of the page here');

 

 

 

CreatePage and CreateSection do lots of things under the hood to guarantee that the new page or section will work correctly.

 

You also don't need to worry about index and name of the section. The methods will do that for you and you only need set these if you need to change.

 


 

04-21-2023, 01:29 AM:

 

(04-20-2023, 07:46 AM)PaulWeem Wrote: [ -> ]Hi Alexandre,

 

I'm using Delphi 11.3, patch 1 with IW 15.3.3.

 

When creating my form, I have an empty Accordion and dynamically create Sections with:

 

    ...

 

    s := TIWJQSection.Create(AccordionRemarks);

 

    s.Name := 'Section_' + IntToStr(i);

 

    s.Caption := 'Section_' + IntToStr(i);

 

    s.SectionIndex := i;

 

    AccordionRemarks.AddSection(s);

 

    Inc(i, 1);

 

   ...

 

When publishing the form, I get an AV.

 

Pardon my aside on the subject, but I'm sure you know all the names must be unique to the entire page (DOM).  Otherwise strange things happen (not that I've ever made that mistake  ).   But, I don't remember it causing an AV.  Probably not your problem, but definitely worth keeping in mind when you're building names at runtime.

 

Dan

 


 

04-21-2023, 02:53 PM:

 

(04-21-2023, 12:39 AM)Alexandre Machado Wrote: [ -> ]Here is how you can easily create this. Use methods CreatePage and CreateSection of the IWjQPageControl and IWjQAccordion:

 

Code:

 

newSection := AccordionRemarks.CreateSection('Caption of the section here');

 

newPage := YourPageControl.CreatePage('Caption of the page here');

 

 

 

CreatePage and CreateSection do lots of things under the hood to guarantee that the new page or section will work correctly.

 

You also don't need to worry about index and name of the section. The methods will do that for you and you only need set these if you need to change.

 

Thank you, unfortunately, this isn't working in my app.

 

I'll wait for the demo and see what that does.

 

 

 

(04-21-2023, 01:29 AM)DanBarclay Wrote: [ -> ]Dan

 

Hi Dan,

 

Thanks for the heads up, but I'm pretty sure the names I created are unique.

 

Paul

 


 

04-21-2023, 03:09 PM:

 

I tested it with IW15.2.69 but also get an AV using CreateSection().

 

Steps to reproduce:

 

New project

 

 

 

Add an empty TIWjQAccordion and a TIWButton to the project.

 

 

 

TIWButton.OnAsyncClick with following code

 

 

 

 

 

Code:

 

procedure TIWForm1.IWButton1AsyncClick(Sender: TObject; EventParams: TStringList);

 

begin

 

  // gives an AV

 

  IWjQAccordion1.CreateSection('Testing');

 

end;

 

 

 

I also tested \Demos\15\Delphi\AsyncRender and that example (other use case) is working.

 


 

04-21-2023, 10:17 PM:

 

The demo is here and it works as expected:

 

https://github.com/Atozed/IntraWeb/tree/...ontrolDemo

 

@jeroen.rottink I'll test this other scenario and let you know.

 

Cheers

 


 

04-21-2023, 11:31 PM:

 

@jeroen.rottink, the case where a new page is created in an async request (and the IWjQPageControl has been created before) fails with an AV, yes.

 

There is an easy workaround though:

 

procedure TIWForm1.IWButton1AsyncClick(Sender: TObject; EventParams: TStringList);

 

var

 

aPage: TIWjQTabPage;

 

begin

 

aPage := IWjQAccordion1.CreateSection('Testing');

 

Self.ComponentRemoved(aPage, '');

 

end;

 

The issue happens because the TIWjQTabPage shouldn't be rendered as a separate control, which is effectively happening in this case.

 

We will fix it in the next release, but in the meantime the workaround above can be safely used.

 


 

04-24-2023, 07:49 AM:

 

Hi Alexandre,

 

I have taken the liberty take the IWPageControlDemo and create an IWAccordionDemo (attached).

 

What isn't working:

 

When starting the browser, sections are created, but activating the 1st section doesn't work.

 

 

 

When changing sections, the OnAsyncBeforeSectionChange is triggered, but the OnAsyncSectionChanged is not.

 

 

 

 

 

But the most annoying thing is, when you create a section in the IDE at design time and later on, when you delete this section and save the project, an AV presents itself (see attachment 2).