ExDev001
asked on
Insufficient memory error adding and removing buttons
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:
On 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
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:
On 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
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Some EE posts concerning your problem...
Not enough storage is available to process this command - when opening report builder
Not enough storage?
Not enough storage is available to process this command - when opening report builder
Not enough storage?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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(itemN ame);
listSave.Items.Add(itemNam e);
listDelete.Items.Add(itemN ame);
except
showMessage('Error ' +IntToStr(GetLastError)+ ' - Message: ' + SysErrorMessage(GetLastErr or));
end;
end;
procedure TForm10.removeMyItem(itemI ndex : integer);
begin
try
listSelect.Items.Delete(it emIndex);
listSave.Items.Delete(item Index);
listDelete.Items.Delete(it emIndex);
except
showMessage('Error ' +IntToStr(GetLastError)+ ' - Message: ' + SysErrorMessage(GetLastErr or));
end;
end;
procedure TForm10.editAddKeyDown(Sen der: 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(Se nder: TObject);
begin
removeMyItem(listDelete.It emIndex);
end;
procedure TForm10.listSelectClick(Se nder: TObject);
begin
editChangeMe.Text := listSelect.Items[listSelec t.ItemInde x];
end;
Adding the second item rise exception. In your opinion, it's a delphi\devexpress issue or I'm going wrong somewhere?
Thanks again
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
begin
try
listSelect.Items.Add(itemN
listSave.Items.Add(itemNam
listDelete.Items.Add(itemN
except
showMessage('Error ' +IntToStr(GetLastError)+ ' - Message: ' + SysErrorMessage(GetLastErr
end;
end;
procedure TForm10.removeMyItem(itemI
begin
try
listSelect.Items.Delete(it
listSave.Items.Delete(item
listDelete.Items.Delete(it
except
showMessage('Error ' +IntToStr(GetLastError)+ ' - Message: ' + SysErrorMessage(GetLastErr
end;
end;
procedure TForm10.editAddKeyDown(Sen
var
name : string;
begin
if(Key = 13) then
begin
name := TdxBarEdit(Sender).CurText
addMyItem(name);
end;
end;
procedure TForm10.listDeleteClick(Se
begin
removeMyItem(listDelete.It
end;
procedure TForm10.listSelectClick(Se
begin
editChangeMe.Text := listSelect.Items[listSelec
end;
Adding the second item rise exception. In your opinion, it's a delphi\devexpress issue or I'm going wrong somewhere?
Thanks again
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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(Sen der: 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.
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(Sen
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.
first chance exception: system error 8: not enough storage space to perform the command