Delphi

Image Download through thread error

蹲街弑〆低调 提交于 2020-06-11 05:33:51
问题 Happy new year to all StackOverFlow member and readers ! I come to you today for a question regarding threads in Delphi (I browsed most of what was already posted on the subject but could not find a clue). I have a very simple test application with one Form (frmIMGDown) and a thread unit. On the form are found a Tbutton a TImage a TprogressBar When clicked, the button starts a thread that downloads an image from the web, updates the progressbar during the process and displays a downloaded

Cast Enumeration Value to Integer in Delphi

拟墨画扇 提交于 2020-06-11 03:06:44
问题 Is it possible to cast/convert an Enumeration Value to Integer in Delphi? If yes, then how? 回答1: This is called out explicitly at the documentation for enumerated types: Several predefined functions operate on ordinal values and type identifiers. The most important of them are summarized below. | Function | Parameter | Return value | Remarks | |----------|:-----------------------------------------------------:|----------------------------------:|-----------------------------------------------

Proper handling of modal window “Minimize” behavior

馋奶兔 提交于 2020-06-10 15:22:14
问题 I have the following issue: we're building a rather large application (win32, Delphi 6 Enterprise). In several part of the application, modal windows are used, usually containing the detail of the selection of the main window. We included a modification of the handling of the WM_SYSCOMMAND messages so that, if the window is modal, then a SW_SHOWMINNOACTIVE message will be sent to the application's main window. This causes the whole application to be minimized instead of just the modal form.

Proper handling of modal window “Minimize” behavior

邮差的信 提交于 2020-06-10 15:22:10
问题 I have the following issue: we're building a rather large application (win32, Delphi 6 Enterprise). In several part of the application, modal windows are used, usually containing the detail of the selection of the main window. We included a modification of the handling of the WM_SYSCOMMAND messages so that, if the window is modal, then a SW_SHOWMINNOACTIVE message will be sent to the application's main window. This causes the whole application to be minimized instead of just the modal form.

Sorting TDictionary by a key of Integer in ascending order

一曲冷凌霜 提交于 2020-06-10 11:15:57
问题 How can I sort TDictionary by a key of Integer in ascending order in Delphi 2009? 回答1: The RTL TDictionaries are not sorted and cannot be sorted (other than by hash, which they are). You need to use another container if you wish to sort either the keys or the values. For example : program Project1; {$APPTYPE CONSOLE} uses Generics.Collections, Generics.Defaults, SysUtils; var LDict : TDictionary<integer, string>; i, j : integer; LArray : TArray<integer>; begin LDict := TDictionary<integer,

Sorting TDictionary by a key of Integer in ascending order

我与影子孤独终老i 提交于 2020-06-10 11:15:47
问题 How can I sort TDictionary by a key of Integer in ascending order in Delphi 2009? 回答1: The RTL TDictionaries are not sorted and cannot be sorted (other than by hash, which they are). You need to use another container if you wish to sort either the keys or the values. For example : program Project1; {$APPTYPE CONSOLE} uses Generics.Collections, Generics.Defaults, SysUtils; var LDict : TDictionary<integer, string>; i, j : integer; LArray : TArray<integer>; begin LDict := TDictionary<integer,

Detect when Delphi FMX ListBox is scrolled to the bottom?

坚强是说给别人听的谎言 提交于 2020-06-08 13:16:33
问题 I need to detect when the user has scrolled down to the bottom in a ListBox , so that I can fetch the next 25 items to show in the listBox, Any Tip? 回答1: Okay so let us break this down, first we go to ScrollToItem in FMX.ListBox unit procedure TCustomListBox.ScrollToItem(const Item: TListBoxItem); begin if (Item <> nil) and (Content <> nil) and (ContentLayout <> nil) then begin if VScrollBar <> nil then begin if Content.Position.Y + Item.Position.Y + Item.Margins.Top + Item.Margins.Bottom +

Hiding items in TListBox while filtering by String

你说的曾经没有我的故事 提交于 2020-06-08 07:57:50
问题 Short Version : Is there any way to control or modify LisBox items individually? for example set their Visible property to False separately. I found a TListBoxItem class in Fire Monkey when I was searching, but I don't want to use Fire Monkey and want it in VCL. Detailed Version : I tried to filter my ListBox using two TStringList and an Edit, one StringList is global to keep the original list ( list_files_global ) and another StringList to help filtering procedure ( list_files_filter ) and

Delphi for loops and StringList Errors

▼魔方 西西 提交于 2020-05-30 03:58:51
问题 Ok guys, I've been trying to find out every possible mistake i'm making but I give up... I need help! What I'm writing is an app to manage rentals for my job and when the date is past, my app removes the name from 2 text files. I wrote 3 little functions(procedures) to make this work. Here: This one loads from dates.dat file and remove the line containing the name of the employee. procedure remDate(emp: String);/// Removes employee from date file var pos1, i: integer; dateList: TStringList;

What the purpose of the System.StartUpCopy included in all firemonkey project?

人走茶凉 提交于 2020-05-29 09:41:36
问题 When I create a new mobile app with Delphi, I have this dpr source: program Project1; uses System.StartUpCopy, FMX.Forms, Unit1 in 'Unit1.pas' {Form1}; {$R *.res} begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. I do not understand, what the purpose of the System.StartUpCopy in the use? With System.StartUpCopy.pas, on ios, it's look like the app will copy file from /private/var/containers/Bundle/Application/2BE5407C-4DD9-5A08-110F-C12510C42BF3/myapp