Delphi

Mimic outside click on a popup menu

[亡魂溺海] 提交于 2020-01-04 06:31:31
问题 You know how in a popup menu if you click outside of the menu the popup disappears? Well I would like to reproduce that. Currently I am having a panel created with some components on it when a button is clicked. The panel and sub components go away when you click a certain button on the panel. However I want it to go away if you click anywhere outside of the panel. 回答1: I think you would need to install and application-wide mouse message hook, and if your panel is visible and the coordinates

Strange memory overwrite problem in instance of my class

99封情书 提交于 2020-01-04 06:20:21
问题 This problem is related to this question, which I've asked earlier. The code provided by @RRUZ is working but it seems that not quite correctly or I am doing something wrong. After executing GetSharedFiles strange thing is happening in instance of TMyObject . The field FMyEvent which was (and it should be) nil points to some random data. What I've discovered just 5 minutes ago is that if I turn off the optimization in compiler options it works fine after rebuild. So maybe this is some

TRichEdit and URL highlighting problems

孤人 提交于 2020-01-04 06:19:12
问题 I am using the current code to highlight URLs on a TRichEdit: procedure TForm1.WndProc(var Message: TMessage); var p: TENLink; strURL: string; begin if (Message.Msg = WM_NOTIFY) then begin if (PNMHDR(Message.lParam).code = EN_LINK) then begin p := TENLink(Pointer(TWMNotify(Message).NMHdr)^); if (p.Msg = WM_LBUTTONDOWN) then begin SendMessage(RichEdit1.Handle, EM_EXSETSEL, 0, Longint(@(p.chrg))); strURL := RichEdit1.SelText; ShellExecute(Handle, 'open', PChar(strURL), 0, 0, SW_SHOWNORMAL); end

TRichEdit and URL highlighting problems

微笑、不失礼 提交于 2020-01-04 06:19:06
问题 I am using the current code to highlight URLs on a TRichEdit: procedure TForm1.WndProc(var Message: TMessage); var p: TENLink; strURL: string; begin if (Message.Msg = WM_NOTIFY) then begin if (PNMHDR(Message.lParam).code = EN_LINK) then begin p := TENLink(Pointer(TWMNotify(Message).NMHdr)^); if (p.Msg = WM_LBUTTONDOWN) then begin SendMessage(RichEdit1.Handle, EM_EXSETSEL, 0, Longint(@(p.chrg))); strURL := RichEdit1.SelText; ShellExecute(Handle, 'open', PChar(strURL), 0, 0, SW_SHOWNORMAL); end

Problems with extracting file summary information

孤人 提交于 2020-01-04 06:14:57
问题 I apologize for my English, it's not good, but I hope you will understand my question. I have problem with usage of WinAPI function StgOpenStorageEx . I need to get file's summary information. I found some solutions, but in all of them I need to use StgOpenStorageEx . Because it is not in standard modules, I declared it myself as exported from ole32.dll like this function StgOpenStorageEx ( const pwcsName : POleStr; //Pointer to the path of the //file containing storage object grfMode :

How to show hint using Application.ActivateHint on Delphi?

China☆狼群 提交于 2020-01-04 05:57:08
问题 I have the following code trying to show a hint: procedure TMyGrid.OnGridMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var aPoint: TPoint; begin inherited; //Application.Hint := 'Hint Text'; //Application.ShowHint := True; Grid.Hint := 'Hint Text'; Grid.ShowHint := True; aPoint.X := X; aPoint.Y := Y; Application.ActivateHint(aPoint); end; But there is no hint appears. What's wrong? 回答1: ActivateHint wants your point in screen coordinates, not in client coordinates. From doc:

How to show hint using Application.ActivateHint on Delphi?

只愿长相守 提交于 2020-01-04 05:57:08
问题 I have the following code trying to show a hint: procedure TMyGrid.OnGridMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var aPoint: TPoint; begin inherited; //Application.Hint := 'Hint Text'; //Application.ShowHint := True; Grid.Hint := 'Hint Text'; Grid.ShowHint := True; aPoint.X := X; aPoint.Y := Y; Application.ActivateHint(aPoint); end; But there is no hint appears. What's wrong? 回答1: ActivateHint wants your point in screen coordinates, not in client coordinates. From doc:

Delphi Login Form using App Tethering by Connecting to SQLite Database

余生长醉 提交于 2020-01-04 05:53:30
问题 Hi, EveryBody! I'm new to programming! I need your help plz. I've 2 project: 1. Project Login page. Using App Tethering and 2 buttons(Connect button =>connects to the server AND Login button=>Sends request to the Server to check Valid username and password). 2. Project Server page. In a Server Page using App tethering and FDQuery +( SQLite database test.db). When Client Connects to the Server and sends request to the Server to check valid username and password it gives wrong result. plz help

How to search for similar words

僤鯓⒐⒋嵵緔 提交于 2020-01-04 05:51:20
问题 I have a record file and I need to make a program that should help find any word into that record by typing a word into a search field. The record file contains a list of words so I need to search into that list to find any word that could be similar to my word. I am using Delphi 2007 回答1: Delphi 2007 should have a number of string matching routines in StrUtils that use the Soundex algorithm to find similar "sounding" words. Depending on how your file is formatted you may be able to load it

Fmx TStringGrid row color

℡╲_俬逩灬. 提交于 2020-01-04 05:49:07
问题 I have a problem in Delphi 10.1 in a multi-device application (on Windows). I have a StringGrid (connected to a db) and I can change background color of row, but the problem is there is a "padding" (in grey/silver) between cells. In onformCreate I define: stringgrid1.DefaultDrawing := False; This is my code: procedure Tlist_form.StringGrid1DrawColumnCell(Sender: TObject; const Canvas: TCanvas; const Column: TColumn; const Bounds: TRectF; const Row: Integer; const Value: TValue; const State: