-
Content Count
1936 -
Joined
-
Last visited
-
Days Won
25
Everything posted by Attila Kovacs
-
Overload methods or use unique names?
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
procedure AddTask(aAction: TTaskAction; aTask: TTask); overload; // Execute aTask immeditaly Does it make sense? AddTask(taQueueTaskOnly, lTask); // Execute aTask immediately -
Overload methods or use unique names?
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Strange, if you look at your original example, the proper function names are already there, at the end of each line, in the comments. -
New Third Party section - DelphiHTMLComponents
Attila Kovacs replied to Darian Miller's topic in Community Management
Yeah, it would be great. -
Black screen while processing longer task on windows server 2012 R2
Attila Kovacs replied to Soji's topic in General Help
Except it's kingly slow and the queue will be processed right after the job is finished, also replaying every mouse / keyboard event happened meanwhile the loop was running. -
Black screen while processing longer task on windows server 2012 R2
Attila Kovacs replied to Soji's topic in General Help
You still have to call Application.Processmessages in your loops. Otherwise you have to hook in a lower level. ( I think, I would have to test to be sure if SetWindowsHookEx would work) -
Black screen while processing longer task on windows server 2012 R2
Attila Kovacs replied to Soji's topic in General Help
As your blocking task runs in a modal form with an own message loop I would not concern about calling Application.Processmessages. However, with a small addition. I would hook Application.OnMessages (as long as the blocking code runs) to handle only WM_PAINT and the messages sent to the Abort button (if any). (in this example WM_TIMER is included only for animations, and btnStart for not be stuck in down state) Of course this would also prevent the system from a restart, for that, you should watch for other messages too, and handle properly, if its a problem. procedure TfrmDoSomething.MyOnMessage(var Msg: TMsg; var Handled: boolean); begin if (Msg.hwnd = btnStart.Handle) and (Msg.Message = WM_MOUSELEAVE) then else if Msg.hwnd = btnAbort.Handle then else case Msg.Message of WM_PAINT, WM_TIMER: ; else Handled := True; end; end; -
No KeyUp for numpad keys after relese Shift
Attila Kovacs replied to ŁukaszDe's topic in Windows API
I can't see anything broken. SHIFT overrides NumLock and CapsLock. That means, with NumLock ON pressing SHIFT + 0 = pressing insert. Releasing SHIFT means, you are holding the 0 key, releasing 0 means you are releasing the 0 key, and not Insert. That's how windows works. -
Printing Multiple Charts that Span Pages
Attila Kovacs replied to Larry Hengen's topic in General Help
Interesting approach, but yes, could be. -
Printing Multiple Charts that Span Pages
Attila Kovacs replied to Larry Hengen's topic in General Help
I'm not sure about the 50 meters, but there is also https://www.delphihtmlcomponents.com/reports.html -
Yesterday I had the feeling I'm missing this feature from the IDE, today I can't remember why, maybe I'll recall it later 🙂 And my rough implementation of the feature: Comments, patches, etc. are welcome. ( f.e. I'm completely ignoring the top and the bottom of the file, and other line endings as 0D 0A, also not sure about utf-8 in the code) Blocks are moving on the basis of the starting and ending line. This is intended. procedure TKeyboardBinding.BindKeyboard(const BindingServices: IOTAKeyBindingServices); begin BindingServices.AddKeyBinding([ShortCut(VK_UP, [ssAlt])], MoveLineOrBlockUp, nil); BindingServices.AddKeyBinding([ShortCut(VK_DOWN, [ssAlt])], MoveLineOrBlockDown, nil); end; procedure TKeyboardBinding.MoveLineOrBlock(ADirection: Integer; const Context: IOTAKeyContext; var BindingResult: TKeyBindingResult); var EditPosition: IOTAEditPosition; EditBlock: IOTAEditBlock; CurrentRow: Integer; CurrentRowEnd: Integer; BlockSize: Integer; IsAutoIndent: Boolean; CodeLine: string; sr, er: Integer; begin EditPosition := Context.EditBuffer.EditPosition; EditBlock := Context.EditBuffer.EditBlock; // Store original cursor row CurrentRow := EditPosition.Row; // Length of the selected block (0 means no block) BlockSize := EditBlock.Size; // Store AutoIndent property IsAutoIndent := Context.EditBuffer.BufferOptions.AutoIndent; // Turn off AutoIndent, if necessary if IsAutoIndent then Context.EditBuffer.BufferOptions.AutoIndent := False; if (EditPosition.Row = 1) and (ADirection = -1) then Exit; if (BlockSize = 0) then begin // Only a single line to move EditPosition.Save; if ADirection = 1 then EditPosition.Move(EditPosition.Row + ADirection, EditPosition.Column); // Move to end of current line EditPosition.MoveEOL; // Get the column position CurrentRowEnd := EditPosition.Column; // Move to beginning of current line EditPosition.MoveBOL; // Get the text of the current line, less the EOL marker CodeLine := EditPosition.Read(CurrentRowEnd + 1); if Ord(CodeLine[Length(CodeLine)]) <> $0A then Exit; EditPosition.Move(EditPosition.Row - 1, EditPosition.Column); // Move to end of current line EditPosition.MoveEOL; // Get the column position CurrentRowEnd := EditPosition.Column; // Move to beginning of current line EditPosition.MoveBOL; // Get the text of the current line, less the EOL marker CodeLine := CodeLine + EditPosition.Read(CurrentRowEnd + 1); if Ord(CodeLine[Length(CodeLine)]) <> $0A then Exit; EditPosition.Delete(Length(CodeLine) - 2); EditPosition.InsertText(CodeLine); // Move cursor to original position EditPosition.Restore; EditPosition.Restore; EditPosition.Move(EditPosition.Row + ADirection, EditPosition.Column); BindingResult := krHandled; end else begin // More than one line selected. Get block text sr := EditBlock.StartingRow; er := EditBlock.EndingRow; if (EditBlock.StartingColumn <> 1) or (EditBlock.EndingColumn <> 1) then begin EditPosition.Move(sr, 1); EditBlock.BeginBlock; EditPosition.Move(er + 1, 1); EditBlock.EndBlock; sr := EditBlock.StartingRow; er := EditBlock.EndingRow; end; CodeLine := EditBlock.Text; EditBlock.Delete; EditPosition.Move(EditPosition.Row + ADirection, 1); // Insert block text EditPosition.InsertText(CodeLine); EditPosition.Move(sr + ADirection, 1); EditBlock.BeginBlock; EditPosition.Move(er + ADirection, 1); EditBlock.EndBlock; BindingResult := krHandled; end; // Restore AutoIndent, if necessary if IsAutoIndent then Context.EditBuffer.BufferOptions.AutoIndent := True; BindingResult := krHandled; end; procedure TKeyboardBinding.MoveLineOrBlockDown(const Context: IOTAKeyContext; KeyCode: TShortCut; var BindingResult: TKeyBindingResult); begin MoveLineOrBlock(1, Context, BindingResult); end; procedure TKeyboardBinding.MoveLineOrBlockUp(const Context: IOTAKeyContext; KeyCode: TShortCut; var BindingResult: TKeyBindingResult); begin MoveLineOrBlock(-1, Context, BindingResult); end;
-
Moving Line or Block in the IDE editor
Attila Kovacs replied to Attila Kovacs's topic in I made this
Uwe, why am I not surprised? <o> 🙂 I should try MMX some day. -
FireDAC / SQL Server "Connection is busy with results for another hstmt"
Attila Kovacs replied to Nathan Wild's topic in Databases
I assume you talking about every other active datasets (which could block) and not the one which is failing (which is blocked). Well, backup and start to debug with simplifying the queries. Also, compare the installed drivers on those workstations. -
FireDAC / SQL Server "Connection is busy with results for another hstmt"
Attila Kovacs replied to Nathan Wild's topic in Databases
IIRC this could also caused by blob fields in the query, which are only fetched if needed (by default). -
FireDAC / SQL Server "Connection is busy with results for another hstmt"
Attila Kovacs replied to Nathan Wild's topic in Databases
"Fetchall" comes to mind. If a result set of a query is only partially fetched (because of the size) it blocks the connection. http://docwiki.embarcadero.com/RADStudio/Rio/en/Fetching_Rows_(FireDAC) -
FireDAC / SQL Server "Connection is busy with results for another hstmt"
Attila Kovacs replied to Nathan Wild's topic in Databases
Only god and google knows. -
FireDAC / SQL Server "Connection is busy with results for another hstmt"
Attila Kovacs replied to Nathan Wild's topic in Databases
Maybe accidentally set to async mode? -
Just lean back, not your fault. And it's always the installer's code which ends up in the signatures, not the RTL.
-
Finalization section not called unless main form shown
Attila Kovacs replied to Mark Williams's topic in VCL
This info is actually cool. I was never paying attention to it. I was thinking the main form were the first form created any way. But with this, it's enough to write: frmYourFormsNeededToCreateIfAny := TfrmYourFormsNeededToCreateIfAny.Create(Application); frmLogin := TfrmLogin.Create(Application); if frmLogin.DoLogin then Application.CreateForm(TfrmMain, frmMain); Application.Run; or similar no need for Terminate prior to .Run;, no need for ShowMainForm := False, no unnecessary OnCreate() of the main form. however initialization and finalization will run (of course), and prepare, that adding new forms via IDE will screw up your dpr mostly every time. -
I tried VB and it was too slow for me. How do you come over that everything lags?
-
Like in the title, if I can see and have time to read the [Parsing...] hint in the IDE code editor, the IDE just shuts down silently, without saving anything.. crashes silently. (10.1.2), Anyone else having the same issue? Sometimes multiple times in a row, sometimes no issue for days.
-
Before creating a bug report I wanted to ask if someone could confirm that ctrl-F4 doesn't work in CPU View since ages, or do I have some 3rd party which interfere?
-
Hm, thanks Uwe, this would satisfy me too, but it's not the case... 😞
-
@FredS What happens if you add s := Copy(s, 1, Length(s) - 1) + Copy(s, Length(s), 1); after s := TCursiveNumbers.ToText(c); in the main loop?
-
what is TCursiveNumbers.ToText? Does it changes the length of the string?
-
Finalization section not called unless main form shown
Attila Kovacs replied to Mark Williams's topic in VCL
Mainform is always the first form you create. Make sure you are not creating the mainform or any other twice.