6 / 6 / 8
Регистрация: 18.09.2014
Сообщений: 124
1
28.10.2014, 22:47. Показов 14734. Ответов 10
Проблема такая. У меня программа через FTP качает файл с данными о версии. Читает. Сравнивает. И если версии такая же что и у оригинала, то просто запускает дальнейшую программу. Если же не такая же, то удаляет все старые файлы (кроме программы обновления, та что работает), а потом скачивает все файлы. Посмотрите код. Скажите что не так.
| Delphi | ||
|
Вот код Dll
| Delphi | ||
|
__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь
0
На чтение 6 мин. Просмотров 127 Опубликовано 15.12.2019
Добрый день друзья. Использую данный метод в своей игре:
Он генерирует слово, разбивает на символы, в случайном порядке их расставляет. Здесь переменная Word определена, в итоге и переменная Hint и Path приходит с кнопки, события OnClick.
Первый раз, при запуске сцены, метод отрабатывает хорошо, без ошибок.
После того, как слово отгадано, я обнуляю все переменные другим методом
В итоге жму на кнопку с уже другими переменными Word, Hint, Path и вываливается ошибка:
ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
Не могу понять, в чём проблема и почему так происходит. Первые строчки точно отрабатывают нормально, так как меняется Path.
Подскажите пожалуйста, что не так делаю, всю голову сломал. Спасибо огромное заранее!
I’m using a TListBox in Firemonkey, and I’m facing a strange issue when it comes to dynamically showing/hiding items. This includes both Delphi XE7 and XE8. The setup, there is a TPopupBox at the top of the form, where user chooses one of the items listed. Depending on which was chosen, the TListBox should show only certain TListBoxItem s, and hide the rest. Part of this consists of resizing each list item height to 0 when not visible (otherwise it would leave an ugly gap between the items).
The problem is that very randomly and spontaneously (no pattern), selecting an item in this TPopupBox (calling OnChange which modifies visibility), produces an EArgumentOutOfRangeException at an unknown point. The code breaks in System.Generics.Collections.TListHelper.SetItemN() on the first line calling CheckItemRangeInline(AIndex); Within there, it’s simply:
The exception continues to be raised over and over and over again with no end (starts with 4 in a row). When I use the debugger to step in, I can never manage to get it to happen.
There are a couple common procedures used here which control item visibility:
Then, when choosing something in the TPopupBox :
(The full procedure is just a lot of the exact same types of calls, too much to post here)
- Nowhere am I adding or removing items — only changing visibility
- There are no events triggered which might be causing some faulty loop
- The TPopupBox is located outside of the TListBox
- Each TListBoxItem has one or two controls (yet it doesn’t matter which ones are being shown/hidden)
- Selecting an item in this TPopupBox may work one time, yet fail the next
- Sometimes it occurs the first time I show/hide these items, sometimes it takes 20-30 tries
- Never able to reproduce while stepping through in Debug
Why would I be receiving this exception, and how do I fix it?
Давно не было статей об исправлении ошибок, и вот настало время. Разбираться мы будем с ошибкой out of range на мониторе. Поговорим том, что это такое, о причинах возникновения и методах исправления этой ошибки.
Содержание
- Ошибка out of range
- Причины ошибки out of range на мониторе
- Как исправить ошибку out of range
- Как убрать out of range – второй монитор
- Решение ошибки out of range через безопасный режим
- Out of range из-за проблем с драйверами
- Out of range из-за неисправности оборудования
- Пример из жизни
Ошибка out of range
Out of range (рус. вне диапазона) – это ошибка указывающая на то, что сигнал получаемый от видеокарты не входит в рабочий диапазон сигналов монитора.

Причины ошибки out of range на мониторе
Существует несколько причин возникновения такой ошибки:
- Изменение частоты обновления экрана на не поддерживаемую монитором.
- Изменения разрешения экрана на не поддерживаемое монитором.
- Проблемы с драйверами видеокарты или монитора.
- Ошибки в работе видеокарты или монитора.
Самые распространенные причины ошибки out of range – первые две, когда монитор не поддерживает разрешение экрана или частоту установленную видеокартой. Такое часто бывает со старым мониторами, или при ручном изменении частоты экрана. Реже выявляются ошибки с драйверами.
Как исправить ошибку out of range
Вот мы и подошли к самой главной части этой статьи, к решению проблемы с out of range на мониторе. Существует несколько возможных способов исправить эту ошибку. Начнем, пожалуй, сразу с самого действенного.
Как убрать out of range – второй монитор
Да это один из почти 100% методов исправления ошибки out of range, если драйвера не при чем, но не у всех есть возможность им воспользоваться, так как нужен второй монитор или телевизор.
1. Подключаете компьютер к другому монитору или домашнему телевизору.
2. Меняете частоту обновления и разрешение экрана на низкие значения, точно поддерживаемые вашим основным монитором.
3. Подключаете компьютер к первому монитору и проверяете. Если всё в порядке, меняете значения частоты и разрешения экрана на поддерживаемые вашим монитором.
Решение ошибки out of range через безопасный режим
Второй способ это использование безопасного режима Windows.
1. Перезагрузите компьютер в безопасном режиме.
2. Измените частоту и разрешение экрана на поддерживаемые вашим монитором.
3. Перезагрузите компьютер, чтобы проверить решило ли это вашу проблему.
Совет: если изменение параметров не сохраняется при загрузке в обычном режиме, заходите в безопасный режим через «режим VGA» («Базовое видео» в Windows 10).
Out of range из-за проблем с драйверами
Другая причина появления ошибки out of range/вне диапазона, это проблемы с драйверами. И если предыдущие способы не помогают, мы рекомендуем переустановить драйвера видеокарты и монитора.
1. Загрузите компьютер в безопасном режиме.
2. Откройте Диспетчер устройств (нажмите Win+Pause, и в левой верхней части окна выберите нужную нам утилиту).
3. В Диспетчере устройств разверните разделы «Видеоадаптеры» и «Мониторы», затем удалите каждое из устройств находящееся в этих разделах. Это можно сделать, выделив устройство и нажав клавишу Delete или кликнув правой кнопкой мыши и выбрав «Удалить».

4. Далее перезагрузите компьютер и позвольте Windows переустановить драйвера для этих устройств, или установите их вручную.
Out of range из-за неисправности оборудования
Бывает и такое, что оборудование ломается или работает неправильно. Один из способов проверить, что вызывает ошибку, монитор или видеокарта, это подключение вашего монитора к другому компьютеру и подключение вашего компьютера к другому монитору.
Пример из жизни
Напоследок вот вам пример из жизни, который и натолкнул нас на написание этой статьи. К нам обратился пользователь Александр с таким сообщением:
«Задал слишком высокую частоту обновления экрана, в результате чего при запуске Виндовс пишет out of range.
Прочитал что надо в безопасном режиме удалить драйвер видеокарты, так и сделал, все запустилось, но после того как я снова устанавливаю драйвер, снова пишет out of range. Как теперь быть?»
После некоторой переписки, в конце концов, Александру помог метод с подключением компьютера к другому монитору или телевизору и уменьшение частоты обновления и разрешения экрана.
Using Delphi 10.4.
I am hoping someone can explain what I am doing wrong with my FMX TTreeView that is causing an EArgumentOutOfRangeException. I am trying to create a custom TTreeViewItem class that allows me to associate some data with each node, as well as provide an in-place editor to allowing changing the node text.
The code below is a stripped down version of what I am doing. The FMX form has a TTreeview and two buttons on it, with the form’s Onshow set to FormShow and the buttons set to the two button events.
The TVLinkTreeViewItem is my custom TTreeViewItem where I add a background and edit component for my in-place editor, which is displayed when a node is double clicked.
When you run the code as is, the program will throw the exception when the logic gets to the TreeView1.EndUpdate call at the end of the FormShow routine. The exception is thrown in FMX.Controls in the TControl.EndUpdate procedure.
If you comment out the ExpandAll call, the exception is not thrown, but if you mess with the expanding and collapsing of the nodes and resizing of the form, sooner or later the exception gets thrown. I left the ExpandAll line in the code below, as I assume the exception is being caused by the same error.
From what I can tell, the problem appears to be how I am setting up the fBackground and fEditor. If I don’t call the AddObject routine and not set the Parent properties, I get no exception.
So can anybody tell me what I am doing wrong? Or is there a better way to do an in-place editor for the FMX TTreeViewItems component?
unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.TreeView, FMX.Layouts, FMX.Controls.Presentation,
FMX.MultiView, FMX.Edit, FMX.Objects, FMX.StdCtrls;
type
TForm1 = class(TForm)
TreeView1: TTreeView;
Button1: TButton;
Button2: TButton;
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
type
TVLinkTreeViewItem = class(TTreeViewItem)
private
fData: string;
fEditor: TEdit;
fBackground: TRectangle;
procedure TreeViewItem1DblClick(Sender: TObject);
procedure EditorExit(Sender: TObject);
procedure EditorKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);
public
property Editor: TEdit read fEditor write fEditor;
property Data: string read fData write fData;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
TreeView1.ExpandAll;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
TreeView1.CollapseAll;
end;
procedure TForm1.FormShow(Sender: TObject);
var
I, c, r, s: Integer;
vNode1,
vNode2,
vNode3,
vNode4: TVLinkTreeViewItem;
begin
TreeView1.BeginUpdate;
TreeView1.Clear;
for I := 0 to 4 do
begin
vNode1 := TVLinkTreeViewItem.Create(TreeView1);
vNode1.Text := 'Level 1 - '+ IntToStr(I);
TreeView1.AddObject(vNode1);
for c := 0 to 4 do
begin
vNode2 := TVLinkTreeViewItem.Create(vNode1);
vNode2.Text := 'Level 2 - '+ IntToStr(c);
vNode1.AddObject(vNode2);
for r := 0 to 4 do
begin
vNode3 := TVLinkTreeViewItem.Create(vNode2);
vNode3.Text := 'Level 3 - '+ IntToStr(r);
vNode2.AddObject(vNode3);
// for s := 0 to 4 do
// begin
// vNode4 := TVLinkTreeViewItem.Create(vNode3);
// vNode4.Text := 'Level 4 - '+ IntToStr(s);
// vNode3.AddObject(vNode4);
// end;
end;
end;
end;
//ExpandAll works when no parent is set for fBackGround and fEditor is not set in "TVLinkTreeViewItem.Create" below"
//If the Parents are set below, ExpandAll/EndUpdate causes "Augument out of range" exception.
TreeView1.ExpandAll;
treeView1.EndUpdate;
end;
{ TVLinkTreeViewItem }
constructor TVLinkTreeViewItem.Create(AOwner: TComponent);
begin
inherited;
fData := '';
fBackground := TRectangle.Create(AOwner);
//When ExpandAll is not called in FormShow,
// Calling "AddObject" or setting parent, as shown below, make all the code work,
// but will get intermident "Augument out of range" exceptions when resizing form,
// or when expanding or collapsing nodes using the buttons.
self.AddObject(fBackGround);
//fBackGround.Parent := self;
fBackGround.Visible := false;
fEditor := TEdit.Create(AOwner);
fBackGround.AddObject(fEditor);
//fEditor.Parent := fBackGround;
fEditor.Visible := false;
fEditor.Align := TAlignLayout.Client;
fEditor.OnKeyDown := EditorKeyUp;
self.OnDblClick := TreeViewItem1DblClick;
fEditor.OnExit := EditorExit;
end;
destructor TVLinkTreeViewItem.Destroy;
begin
inherited;
end;
procedure TVLinkTreeViewItem.TreeViewItem1DblClick(Sender: TObject);
begin
fBackGround.Visible := true;
fBackGround.Width := self.Width - 20;
fBackGround.Height := self.Height;
fBackGround.Position.X := 20;
fEditor.Enabled := true;
fEditor.Visible := true;
fEditor.Opacity := 1;
fBackGround.BringToFront;
fEditor.BringToFront;
fEditor.Text := Text;
fEditor.SetFocus;
fEditor.SelectAll;
end;
procedure TVLinkTreeViewItem.EditorKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);
begin
inherited;
if Key = vkReturn then
begin
Text := fEditor.Text;
fBackGround.Visible := false;
fEditor.Enabled := false;
end
else if Key in [vkEscape, vkCancel, vkTab, vkHardwareBack] then
begin
fBackGround.Visible := false;
fEditor.Enabled := false;
end;
end;
procedure TVLinkTreeViewItem.EditorExit(Sender: TObject);
begin
fBackGround.Visible := false;
fEditor.Enabled := false;
fEditor.Visible := false;
end;
end.
Here’s the fmx content:
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 480
ClientWidth = 640
FormFactor.Width = 320
FormFactor.Height = 480
FormFactor.Devices = [Desktop]
OnShow = FormShow
DesignerMasterStyle = 0
object TreeView1: TTreeView
Align = Left
Size.Width = 269.000000000000000000
Size.Height = 480.000000000000000000
Size.PlatformDefault = False
TabOrder = 0
Viewport.Width = 265.000000000000000000
Viewport.Height = 476.000000000000000000
end
object Button1: TButton
Position.X = 356.000000000000000000
Position.Y = 68.000000000000000000
TabOrder = 2
Text = 'Expand'
OnClick = Button1Click
end
object Button2: TButton
Position.X = 354.000000000000000000
Position.Y = 102.000000000000000000
TabOrder = 1
Text = 'Collapse'
OnClick = Button2Click
end
end
When you have generated a Server and a client Project.
When launching the client, you can «Get» the table content, if you try to refresh the data you will get an Argument out of range exception.
Delphi 10.3.1 SQL Server database.
When you get all tables, all tables are checked, but when you have about 300 tables in your database and if you need only 3 tables it’s a pain to check only those you don’t want.
It would ne nice to have a check all/ uncheck all function in the tool.
amazing work.
Workaround:
If you experience a EArgumentOutOfRangeException copy the Delphi FMX.Grid.Style.pas source file to your project directory and change the two raise lines in the CellRect event to Exit as follows:
function TStyledGrid.CellRect(const ACol, ARow: Integer): TRect;
var
I, X, Y: Integer;
HiddenFound: Boolean;
begin
if (ACol < 0) or (ACol > ColumnCount) then
Exit;//raise EArgumentOutOfRangeException.CreateResFmt(@SInvalidColumnIndex, [ACol]);
if (ARow < 0) or (ARow > RowCount) then
Exit;//raise EArgumentOutOfRangeException.CreateResFmt(@SInvalidRowIndex, [ARow]);
Thanks for your reply.
Unfortunatelly it doesn’t solve the problem.
I still get the error.
But When I add an exit on this line I have no error :
procedure TMainForm.RefreshTable;
var
I: Integer;
ColumnCount: Integer;
ColumnWidth: Integer;
begin
if Closing then Exit;
--->exit;
Добрый день!
Установил XE8, открыл проект собранный на XE7
начались проблемы со стилями (если использовать один стиль на всех формах), это пол беды. пришлось стиль новый для каждой формы ставить…
а ошибка что в названии появилась откуда не ждал, есть TListView, заполняется динамически
1-зачение добавляем
ListView1.ClearItems;
with ListView1.Items.Add do
begin
Text := 'KCell';
Bitmap.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath, 'kcell.png'));
Tag := 3;
end;
with ListView1.Items.Add do
begin
Text := 'Activ';
Bitmap.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath, 'activ.png'));
Tag := 391;
end;
with ListView1.Items.Add do
begin
Text := 'Tele2';
Bitmap.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath, 'tele2.png'));
Tag := 125;
end;
with ListView1.Items.Add do
begin
Text := 'Pathword';
Bitmap.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath, 'pathword.png'));
Tag := 73;
end;
with ListView1.Items.Add do
begin
Text := 'Beeline';
Bitmap.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath, 'beeline.png'));
Tag := 90;
end;
with ListView1.Items.Add do
begin
Text := 'ДОС';
Bitmap.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath,
'beeline-dos.png'));
Tag := 578;
end;
with ListView1.Items.Add do
begin
Text := 'Dalacom';
Bitmap.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath, 'dalacom.png'));
Tag := 12;
end;
with ListView1.Items.Add do
begin
Text := 'City';
Bitmap.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath, 'city.png'));
Tag := 134;
end;
with ListView1.Items.Add do
begin
Text := 'ALTEL 4G';
Bitmap.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath, 'altel4g.png'));
Tag := 716;
end;
with ListView1.Items.Add do
begin
Text := 'АО "Казахтелеком"';
Bitmap.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath, 'telecom.png'));
Tag := 0;
end;
2-значение
ListView1.ClearItems;
with ListView1.Items.Add do
begin
Text := 'ALTEL 4G';
Bitmap.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath, 'altel4g.png'));
Tag := 716;
end;
with ListView1.Items.Add do
begin
Text := 'JET';
Bitmap.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath, 'jet.png'));
Tag := 484;
end;
with ListView1.Items.Add do
begin
Text := '"Интернет Дома" от Beeline';
Bitmap.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath,
'internetdoma.png'));
Tag := 413;
end;
моделируем ситуацию
если грузим 1 значение и тыкаем (выделяем) на последний или больший 2 itemindex
затем выполняем 2 значение, то выскакивает
argument out of range
т.е. получается ItemIndex или Selected Item не сбрасывается.
как эту ошибку исправить?