delphi-xe7

How can I use TTask.WaitForAny from the new threading library?

ε祈祈猫儿з 提交于 2019-11-30 04:32:06
问题 In an attempt to use the threading library in Delphi to calculate tasks in parallel and using TTask.WaitForAny() to get the first calculated result, an exception occationally stopped the execution. Call stack at the exception: First chance exception at $752D2F71. Exception class EMonitorLockException with message 'Object lock not owned'. Process Project1.exe (11248) :752d2f71 KERNELBASE.RaiseException + 0x48 System.TMonitor.CheckOwningThread System.ErrorAt(25,$408C70) System.Error

How to 'parent' a form? (Controls won't accept focus)

北城以北 提交于 2019-11-29 15:23:46
I have a child form 'frmTest' and a main form 'TfrmMain'. I set the main form as parent for frmTest like this: unit Main; INTERFACE USES System.SysUtils, System.Classes, Vcl.Forms, Test, Vcl.StdCtrls, Vcl.Controls; type TfrmMain = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private public end; IMPLEMENTATION {$R *.dfm} procedure TfrmMain.Button1Click(Sender: TObject); VAR frmTest: TChildForm; begin Application.CreateForm(TChildForm, frmTest); //frmTest:= TForm1.Create(Self); frmTest.Parent:= Self; frmTest.Show; frmTest.SetFocus; end; unit test; { THIS IS THE CHILD }

EProgrammerNotFound exception in Delphi?

末鹿安然 提交于 2019-11-28 16:35:58
In Delphi 2009, SysUtils.pas contains this in line 425: EProgrammerNotFound = class(Exception); Is this simply an easter egg or something serious? When should this exception be raised? Does it also exist in Delphi Prism and/or Free Pascal? Q: Is this exception class still declared in Delphi (currently XE7)? A: Yes, and it is even documented ! Nonstandard way to indicate software faults. You can use EProgrammerNotFound as an alternative to indicate software faults detected at run time. It is just the result of a long day and we had gotten a little giddy. For many, many years (ever since I'd

Messagedlg in Delphi xe7 android

混江龙づ霸主 提交于 2019-11-28 14:10:31
I m just trying to execute a sample given during the installation of Delphi xe7, the MessageAlerts on android platform, unfortunately it does not working, it gives the following error message: Blocking Dialogs not implemented in this platform procedure TMessageAlertsForm.btnMultiButtonAlertClick(Sender: TObject); begin { Show a multiple-button alert that triggers different code blocks according to your input } case MessageDlg('Choose a button:', System.UITypes.TMsgDlgType.mtInformation, [ System.UITypes.TMsgDlgBtn.mbYes, System.UITypes.TMsgDlgBtn.mbNo, System.UITypes.TMsgDlgBtn.mbCancel ], 0)

Convert BitMap to string without line breaks?

微笑、不失礼 提交于 2019-11-28 14:08:44
Somewhere I found this code to convert a BitMap to a string: function Base64FromBitmap(Bitmap: TBitmap): string; var Input: TBytesStream; Output: TStringStream; begin Input := TBytesStream.Create; try Bitmap.SaveToStream(Input); Input.Position := 0; Output := TStringStream.Create('', TEncoding.ASCII); try Soap.EncdDecd.EncodeStream(Input, Output); Result := Output.DataString; finally Output.Free; end; finally Input.Free; end; end; However, this gives back a block of wrapped lines. Is it possible to get one single line without line breaks? XE7 introduces the System.NetEncoding unit which

What could cause “No mapping for the Unicode character exists in the target multi-byte code page”?

前提是你 提交于 2019-11-28 12:05:48
I have an EurekaLog bug report showing an EEncodingError . The log points to TFile.AppendAllText . I call TFile.AppendAllText is this procedure of mine: procedure WriteToFile(CONST FileName: string; CONST uString: string; CONST WriteOp: WriteOpperation; ForceFolder: Boolean= FALSE); // Works with UNC paths begin if NOT ForceFolder OR (ForceFolder AND ForceDirectoriesMsg(ExtractFilePath(FileName))) then if WriteOp= (woOverwrite) then IOUtils.TFile.WriteAllText (FileName, uString) else IOUtils.TFile.AppendAllText(FileName, uString); end; This is the information from EurekaLog. What can cause

how do i update listview item index inside thread

萝らか妹 提交于 2019-11-28 05:45:48
问题 i am creating project that allow multi users to login and add there details inside listview but i am stuck with problem , but First here is my threading code with comment implementation type TUPDATEAFTERDOWNLOAD = class(TThread) private FListView: TListView; FListViewIdx: Integer; FMs: TMemoryStream; FURL: String; procedure UpdateVisual; // update after download function DownloadToStream: Boolean; // download function function CheckURL(const URL: Widestring): Boolean; // Check if its http url

Create a customized Item Appearance for ListView Delphi XE7

梦想的初衷 提交于 2019-11-27 14:55:02
Im having a lot of trouble trying to create a customized item appearance for the TListView firemonkey control for Delphi XE7. What I want is to define my own "design" for what an item should be and use that item. For example : I would like to have an item with a Title(on top) - A Description(Middle) - A Date (Bottom) - Button(Right). I could not find any good documentation about this but i got some samples of how to create an TListView with muti details, but the problem is : that sample is not documented so is very hard to understand whats going on there. I would like to have a link or some

Is Writeln capable of supporting Unicode?

放肆的年华 提交于 2019-11-27 13:56:24
Consider this program: {$APPTYPE CONSOLE} begin Writeln('АБВГДЕЖЅZЗИІКЛМНОПҀРСТȢѸФХѾЦЧШЩЪЫЬѢѤЮѦѪѨѬѠѺѮѰѲѴ'); end. The output on my console which uses the Consolas font is: ????????Z?????????????????????????????????????? The Windows console is quite capable of supporting Unicode as evidenced by this program: {$APPTYPE CONSOLE} uses Winapi.Windows; const Text = 'АБВГДЕЖЅZЗИІКЛМНОПҀРСТȢѸФХѾЦЧШЩЪЫЬѢѤЮѦѪѨѬѠѺѮѰѲѴ'; var NumWritten: DWORD; begin WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), PChar(Text), Length(Text), NumWritten, nil); end. for which the output is:

EProgrammerNotFound exception in Delphi?

倾然丶 夕夏残阳落幕 提交于 2019-11-27 09:48:09
问题 In Delphi 2009, SysUtils.pas contains this in line 425: EProgrammerNotFound = class(Exception); Is this simply an easter egg or something serious? When should this exception be raised? Does it also exist in Delphi Prism and/or Free Pascal? Q: Is this exception class still declared in Delphi (currently XE7)? A: Yes, and it is even documented! Nonstandard way to indicate software faults. You can use EProgrammerNotFound as an alternative to indicate software faults detected at run time. 回答1: It