Link to home
Start Free TrialLog in
Avatar of John86a
John86a

asked on

DevExpress Bars 5 to 6 - BarByName is gone, BarByComponentName not functioning properly. Help?

I use the method to introduce new elements to the bar during run time, when I say BarByComponent name, I mean that I need to invoke the name of the bar into a variable so I can call it whenever I want it, however I suspect this is not the case.

Issue: Instead of introducing the new element, a blank space is introduced instead, when clicked upon it generates an access violation error.

Example of my code:

var
  BarX: TdxBar;
begin
BarX := mainBar.BarByComponentName('barMenuList');
...

Thank you.
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image


Your question is not very clear
However yo need to test the validity of the BarX
Assuming MainBar is type TdxBarManager

var
  BarX: TdxBar;
begin
  BarX := MainBar.BarByComponentName('barMenuList');
  if Assigned(BarX) then
  begin
      //do your stuff  
Avatar of John86a
John86a

ASKER

I was using that correctly, but after studying mad except logins I found out the reason for the error..

exception class   : EAccessViolation
exception message : Access violation at address 0064BEA0 in module 'RF8.exe'. Read of address 000000A0.

Main ($9c8):
0064bea0 +00000 RF8.exe      dxBar              32483   +0 TdxBar.GetItemLinks
006497b5 +00005 RF8.exe      dxBar              32483   +0 TdxBar.GetControl

At this exact point inside dxBar.pas:

function TdxBarItemControl.GetItem: TdxBarItem
begin
 Result := GetItemByLink(FItemLink)
end;
Would you test following code please and show what's the result:
var
  BarX : TdxBar;
  Found : Boolean;
  i : integer;
begin
  Found := False;
  for i := 0 to MainBar.Bars.Count-1 do
    begin
      if MainBar.Bars[i].Name = 'barMenuList' then
        begin
          Found := True;
          //BarX := MainBar.Bars[i];
          break;
        end;
    end;

  if Found then
    Showmessage('barMenuList found')
  else
    Showmessage('barMenuList not found')
end;

Open in new window

SOLUTION
Avatar of jimyX
jimyX

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of John86a

ASKER

That's not the origin of the error, this is:

try
 dxbarManager.LockUpdate := true;
 DeleteMenus;
 RecreateMenus(mainBar);
 Finally
 try
 dxBarManager.LockUpdate := False;
 Except
 end;
end;
@ ewangoya
What to say man, over 12 hours looking at the screen, my brain is fried.

@jimmyX
I know the feeling, happens to all of us one time or another
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of John86a

ASKER

Update or refresh does not exist. Do you have msn? I have separated its and bits of the parts where debugger accused the error. I do not wish to post it here.
Avatar of John86a

ASKER

I'll accept your msn as a solution, and then we can go on from there.
Avatar of John86a

ASKER

Issue unresolved, going to be doing some debugging to get to the bottom of it. Might post another question later.