View Issue Details

IDProjectCategoryView StatusLast Update
0001539JEDI VCL00 JVCL Componentspublic2004-04-01 08:39
ReporterDierkAssigned Touser72 
PrioritynormalSeveritytrivialReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0001539: TJvXPBarItem new bug
DescriptionAdded changes in "ActionChange" makes no sense.
Belongs to changes in issue 0001535
"if (CheckDefaults or .... )" and
"if not CheckDefaults or .... "

Should be:
procedure TJvXPBarItem.ActionChange(Sender: TObject;
  CheckDefaults: Boolean);
begin
  if Action is TCustomAction then

    with TCustomAction(Sender) do
    begin
      if (not CheckDefaults or Update()) then // mw added to update action
      begin
        if Self.Caption = '' then
          Self.Caption := Caption;
        if Self.Enabled then
          Self.Enabled := Enabled;
        if Self.Hint = '' then
          Self.Hint := Hint;
        if Self.ImageIndex = -1 then
          Self.ImageIndex := ImageIndex;
        if Self.Visible then
          Self.Visible := Visible;
        if not Assigned(Self.OnClick) then
          Self.OnClick := OnExecute;
      end;
    end;
end;

Regards

Dierk
TagsNo tags attached.

Activities

remkobonte

2004-03-29 13:06

developer   ~0003501

Why should the "not CheckDefaults" checks be removed?

Dierk

2004-03-29 22:33

reporter   ~0003503

Ok, maybe like this:
Without "not", nothing would taken from actions in runtime!

 if Action is TCustomAction then
    with TCustomAction(Sender) do
    begin
      if((not CheckDefaults) or Update()) then // mw added to update action <<-- It must be "not checkDefaults"
      begin
        if not CheckDefaults or (Self.Caption = '') then
          Self.Caption := Caption;
        if not CheckDefaults or Self.Enabled then
          Self.Enabled := Enabled;
        if not CheckDefaults or (Self.Hint = '') then
          Self.Hint := Hint;
        if not CheckDefaults or (Self.ImageIndex = -1) then
          Self.ImageIndex := ImageIndex;
        if not CheckDefaults or Self.Visible then
          Self.Visible := Visible;
        if not CheckDefaults or not Assigned(Self.OnClick) then
          Self.OnClick := OnExecute;
      end;
    end;

user72

2004-03-30 11:51

  ~0003521

See also 0001533

user72

2004-04-01 00:41

  ~0003548

The (not CheckDefaults) check doesn't work: the items aren't updated from their actions at run-time in this case.

Dierk

2004-04-01 00:49

reporter   ~0003549

In my program this works fine.
At runtime
-Creating a new item
-Creating a new action
-assigning the new action to item.action

BTW: What should this be with "not checkDefaults"?

user72

2004-04-01 02:33

  ~0003552

The problem is if you assign actions at design-time, they show up as "(not assigned)" at run-time. I don't fully understand the purpose of the CheckDefaults parameter but using "if not CheckDefaults or Update then" doesn't work in this scenario and assigning at design-time is far more common that doing it at run-time. So until we have a solution that works with both, the current implementation will be kept.

If you can come up with a solution that works both in design and run-time, please post it here.

Dierk

2004-04-01 03:42

reporter   ~0003562

Looking in controls.pas will maybe help.
Shouldn´t it be:

if Sender is TCustomAction then //<<-"Sender" instead of "Action"!
   with TCustomAction(Sender) do
   begin
     if(Update()) then // and in this line only check update??

user72

2004-04-01 04:23

  ~0003565

Duh! Why didn't I think of that?! I'll check...

user72

2004-04-01 04:48

  ~0003566

Seems to work both at design as well as run-time. Neither CheckDefaults nor Update is needed AFAICS

Dierk

2004-04-01 06:41

reporter   ~0003569

Yop! It seems to be good, now. It was a really long track to fix this. :)

user72

2004-04-01 08:39

  ~0003571

> It was a really long track to fix this. :)
Mostly my fault: I should have checked available implementations before posting incomplete solutions :)
Fixed in CVS

Issue History

Date Modified Username Field Change
2004-03-29 01:49 Dierk New Issue
2004-03-29 13:06 remkobonte Note Added: 0003501
2004-03-29 22:33 Dierk Note Added: 0003503
2004-03-30 11:51 user72 Status new => resolved
2004-03-30 11:51 user72 Resolution open => fixed
2004-03-30 11:51 user72 Assigned To => user72
2004-03-30 11:51 user72 Note Added: 0003521
2004-04-01 00:41 user72 Status resolved => feedback
2004-04-01 00:41 user72 Resolution fixed => reopened
2004-04-01 00:41 user72 Note Added: 0003548
2004-04-01 00:49 Dierk Note Added: 0003549
2004-04-01 02:33 user72 Note Added: 0003552
2004-04-01 03:42 Dierk Note Added: 0003562
2004-04-01 04:23 user72 Note Added: 0003565
2004-04-01 04:48 user72 Note Added: 0003566
2004-04-01 06:41 Dierk Note Added: 0003569
2004-04-01 08:39 user72 Status feedback => resolved
2004-04-01 08:39 user72 Resolution reopened => fixed
2004-04-01 08:39 user72 Note Added: 0003571