Solved

Insufficient memory error adding and removing buttons

Posted on 2013-01-10
7
645 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
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 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