?
Solved

Insufficient memory error adding and removing buttons

Posted on 2013-01-10
7
Medium Priority
?
653 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 334 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 38

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 334 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 332 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

770 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