Solved

Insufficient memory error adding and removing buttons

Posted on 2013-01-10
7
639 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 36

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

16 Experts available now in Live!

Get 1:1 Help Now