Jump to content


Photo

Capture item's childs changes


  • Please log in to reply
8 replies to this topic

#1 array81

array81

    Senior Member

  • Members
  • PipPip
  • 290 posts
  • Gender:Male

Posted 27 January 2016 - 05:31 PM

I use a NextInspector, on this I have a item added on design-time called "customers".

On run-time I add subitems to this "customers" item with this code:

 

      for i := 1 to 10 do
        begin
          itemCustomers.AddChild(TNxCheckBoxItem, 'Customer' + IntToStr(i));
        end;
 
Now I need understand how the user change check status of itemCustomers childs.
 
I have try with this code:
 
  if itemCustomers.Items.IndexOf(Item) > 0 then
    begin
      // my code
    end;
 
both on Edit and Change event of NextInspector but it doen't work.
 
Any idea?
 
Thanks

 



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 28 January 2016 - 10:13 PM

Hi,

 

OnChange event should work fine. If you can send me mini-demo I can see where it stops (and why it won't trigger in your case).

 

You can also use OnToolButtonClick event of Item too.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 array81

array81

    Senior Member

  • Members
  • PipPip
  • 290 posts
  • Gender:Male

Posted 31 January 2016 - 05:35 PM

If I use the code inside OnChange I have 2 problems:

1. The code is call for all item and not only for itemCustomers childs.

2 The code is call also on form creation when I put default value to NextInspector items.



#4 array81

array81

    Senior Member

  • Members
  • PipPip
  • 290 posts
  • Gender:Male

Posted 01 February 2016 - 02:00 AM

A have create a small demo.

As you can see when the form is create you show message about "client changed" besides you can see the same message if you edit any items of NextInspector.

 

I have add also 3 button to report another problem, this time with TNxButton, as you can see if I sett ShowArrow the caption (and the image) is not centered. I think in this case you must move caption and image on leftto try to avoid the arrow.

Attached Files



#5 array81

array81

    Senior Member

  • Members
  • PipPip
  • 290 posts
  • Gender:Male

Posted 14 February 2016 - 06:37 PM

I have attached the demo application! See preview message.



#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 14 February 2016 - 06:49 PM

Hi, 

 

Sorry for delay,

 

I will work on it today.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#7 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 19 February 2016 - 07:27 PM

Hi,

 

Sorry again for delay,

 

I have altered your sample bellow.

 

CheckBox item include event from ToolbarItem. I didn't liked this for v6 so I added OnCheck event for CheckBox item only.

 

unit Unit1;
 
interface
 
uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, NxPropertyItemClasses, NxPropertyItems,
  NxScrollControl, NxInspector, NxCollection;
 
type
  TForm1 = class(TForm)
    insExample: TNextInspector;
    insMainItemGeneral: TNxToolbarItem;
    insItemGeneralTitle: TNxTextItem;
    insItemGeneralType: TNxComboBoxItem;
    insItemGeneralDate: TNxDateItem;
    insMainItemClients: TNxToolbarItem;
    btnPoligoni: TNxButton;
    NxButton1: TNxButton;
    NxButton2: TNxButton;
    procedure FormCreate(Sender: TObject);
    procedure insExampleChange(Sender: TObject; Item: TNxPropertyItem;
      Value: WideString);
    procedure DoToolButtonClick(Sender: TNxPropertyItem; ButtonIndex: Integer);
 
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
procedure TForm1.DoToolButtonClick(Sender: TNxPropertyItem; ButtonIndex: Integer);
begin
  ShowMessage('checkbox click');
end;
 
procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
  Child: TNxPropertyItem;
begin
  for i := 1 to 5 do
    begin
      Child := insMainItemClients.AddChild(TNxCheckBoxItem, 'Client' + IntToStr(i));
      TNxToolbarItem(Child).OnToolButtonClick := DoToolButtonClick;
    end;
end;
 
procedure TForm1.insExampleChange(Sender: TObject; Item: TNxPropertyItem;
  Value: WideString);
begin
  if insMainItemClients.Items.IndexOf(Item) > 0 then
    begin
      ShowMessage('Client item changed!');
    end;
end;
 
end.

boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#8 array81

array81

    Senior Member

  • Members
  • PipPip
  • 290 posts
  • Gender:Male

Posted 28 February 2016 - 04:32 PM

Thanks, It's work.

Please fix also image button bug (see my demo) in next version.

 

I'd like know your position about v5 version of your components.

V5 will still be developed or your will devote only to v6?

In this second case (which it is understandable) you think to add all component of v5 to v6 and release a tool to help migration from v5 to v6?



#9 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 28 February 2016 - 08:40 PM

Hi,

I am continuing to support v5 as long there are users. This include bug fixes and smaller features that can be easily moved into v5 from v6.

But I hope that more and more there will be v6 users since the code is much more easier to maintain and expand. I think that things are moving slowly into right direction. Soon I will publish new Users Area so downloading different versions will be easier.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users