Solved

Insufficient memory error adding and removing buttons

Posted on 2013-01-10
7
640 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

943 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now