Solved

Insufficient memory error adding and removing buttons

Posted on 2013-01-10
7
647 Views
Last Modified: 2013-01-14
Hi everyone!
First of all, I am using Code Gear Delphi 2007 IDE with DevExpress components.
I have a TdxRibbon with a button (TdxBarSubItem).
Button has 3 sub items  (TdxBarSubItem), each one has got an item (TdxBarListItem, select, save and delete) and one has got a TdxBarEdit.
Here's a sample:
Devexpress ribbonOn form show, I add some items to each TdxBarListItem.
- select button allow me to select an item from the list.
- delete button allow me delete an item from the list (all 3 lists)
- save button allow me to save something into an item, if I write something into TdxBarEdit and press enter I insert a new item in all 3 lists.

Adding 2 or 3 items I got error 8,  insufficient memory to execute command.
I don't know what I should do to avoid this error.

Thanks to everyone
0
Comment
Question by:ExDev001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 19

Assisted Solution

by:Thommy
Thommy earned 167 total points
ID: 38763946
0
 
LVL 19

Expert Comment

by:Thommy
ID: 38763966
Another link suggesting the same solution by changing registry value...
first chance exception: system error 8: not enough storage space to perform the command
0
 
LVL 19

Expert Comment

by:Thommy
ID: 38763988
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 37

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 167 total points
ID: 38766117
have you considered posting on the devexpress forums ?
or opening a ticket with them ?

http://community.devexpress.com/forums/t/26962.aspx

are you using a richedit.
8 out of 10 memory errors seem to happen with that

any code ?
maybe a memory leak or infinite loop ?
0
 

Author Comment

by:ExDev001
ID: 38766376
I'm not using richedit and there's no infinite loops.
Here's my code sample:

type
TForm10 = class(TForm)
    dxBarManager1: TdxBarManager;
    dxRibbon1Tab1: TdxRibbonTab;
    dxRibbon1: TdxRibbon;
    dxBarManager1Bar1: TdxBar;
    dxBarSubItem1: TdxBarSubItem;
    buttonSelect: TdxBarSubItem;
    buttonSave: TdxBarSubItem;
    buttonDelete: TdxBarSubItem;
    listSelect: TdxBarListItem;
    listSave: TdxBarListItem;
    listDelete: TdxBarListItem;
    editAdd: TdxBarEdit;
    editChangeMe: TEdit;
    Label1: TLabel;
    procedure editAddKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure listSelectClick(Sender: TObject);
    procedure addMyItem(itemName :string);
    procedure removeMyItem(itemIndex : integer);
    procedure listDeleteClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;



procedure TForm10.addMyItem(itemName : string);
begin
  try
    listSelect.Items.Add(itemName);
    listSave.Items.Add(itemName);
    listDelete.Items.Add(itemName);
  except
    showMessage('Error ' +IntToStr(GetLastError)+ ' - Message: ' + SysErrorMessage(GetLastError));
  end;
end;

procedure TForm10.removeMyItem(itemIndex : integer);
begin
  try
    listSelect.Items.Delete(itemIndex);
    listSave.Items.Delete(itemIndex);
    listDelete.Items.Delete(itemIndex);
  except
    showMessage('Error ' +IntToStr(GetLastError)+ ' - Message: ' + SysErrorMessage(GetLastError));
  end;
end;

procedure TForm10.editAddKeyDown(Sender: TObject; var Key: Word;Shift: TShiftState);
var
  name : string;
begin
  if(Key = 13) then
  begin
    name := TdxBarEdit(Sender).CurText;
    addMyItem(name);
  end;
end;

procedure TForm10.listDeleteClick(Sender: TObject);
begin
  removeMyItem(listDelete.ItemIndex);
end;

procedure TForm10.listSelectClick(Sender: TObject);
begin
  editChangeMe.Text := listSelect.Items[listSelect.ItemIndex];
end;

Adding the second item rise exception. In your opinion, it's a delphi\devexpress issue or I'm going wrong somewhere?
Thanks again
0
 
LVL 21

Accepted Solution

by:
developmentguru earned 166 total points
ID: 38767910
I would need to be able to see how your events are wired.  Most likely one of them is causing an infinite loop.  Disconnect all of your events except the one that adds the item when enter is pressed.  See if the error still happens.  If it does not then one of the events is causing the issue.  If it still happens then set a break point on the event and see if it is called more than once.

I did notice that your key down event does not set the key to 0 when it handles it...
0
 

Author Comment

by:ExDev001
ID: 38773585
I've disconnected all events except of keydown event but the error still happens.
Break point in keydown event code show me that it's running once pressing enter key.
I should set key to 0 in keydown event?

procedure TForm10.editAddKeyDown(Sender: TObject; var Key: Word;Shift: TShiftState);
var
  name : string;
begin
  if(Key = 13) then
  begin
    name := TdxBarEdit(Sender).CurText;
    addMyItem(name);
  end;
  Key := 0;
end;

Error still happens.
It seems to be a devexpress/delphi issue, I think I'll do it in one other way to avoid error..
Thanks to everyone.

What I should do with solutions? Thanks


EDIT: I did it in one other way, using TdxBarCombo as a list of items. Thanks to everyone who has tried to help me.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question