vcl

Modeless form cannot receive keyboard input in Excel Add-in developed by Delphi

狂风中的少年 提交于 2019-12-24 13:46:41
问题 Is it bug of VCL?? Non modal form cannot receive input in Excel COM Add in. But the very same code of C# works fine. Demo: https://drive.google.com/open?id=1eKermBZdgXdT7KtfJeZWxYiUwjDNRAst C# Demo: https://drive.google.com/open?id=1tdcgkbHU8cExVhHrmFsQeA5oqjlzxN3k Delphi Code: procedure TDelphiAddIn1.OnStartupComplete(var custom: PSafeArray); var LForm: TForm1; begin LForm := TForm1.Create(nil); LForm.Show; end; C# Code: public void OnStartupComplete(ref System.Array custom) { new Form1()

Delphi. How to disable Vcl Themes for TFileOpenDialog and TOpenDialog

只谈情不闲聊 提交于 2019-12-23 18:47:25
问题 How to disable Vcl Themes for TFileOpenDialog and TOpenDialog ? I try procedure TForm1.FormCreate(Sender: TObject); var chosenDirectory: String; openDialog : TFileOpenDialog; begin TStyleManager.Engine.RegisterStyleHook(TFileOpenDialog, TStyleHook); chosenDirectory:=''; try openDialog:=TFileOpenDialog.Create(Self); openDialog.Options := [fdoPickFolders]; // var 2 // Not works //TStyleManager.Engine.RegisterStyleHook(TFileOpenDialog, TStyleHook); if openDialog.Execute then chosenDirectory:

Intercept TAB key in RichEdit

孤街醉人 提交于 2019-12-23 16:50:33
问题 There are lot of similar questions on here, but I couldn't find an answer for my problem. I have a TRichEdit and want to implement some custom behaviour when the user presses Tab . I set the rich edit's WantTabs property to True and tried to add my custom behaviour in OnKeyDown , which works fine, but unfortunately after that the "normal" tab behaviour is executed as well (inserting a tab character in the edit). I tried setting Key to 0 in the event handler but that doesn't help. How can I

Delphi 2009 Ribbon Controls - Glass Frame

你。 提交于 2019-12-23 15:05:06
问题 I've been starting to use the new inbuilt Ribbon controls in Delphi 2009 and use the custom frame so the Application button and Mini-toolbar slide up onto the Window Frame, but I'm wondering if on Vista it should use the glass effect like Office 2007 does, and if so how I would enable this setting. Thanks for any help. 回答1: Unfortunately it doesn't appear that that CodeGear implementation of the Ribbon control is compatible with the glass frame. Something about the way it draws disables it.

Using EnterCriticalSection in Thread to update VCL label

本小妞迷上赌 提交于 2019-12-23 15:05:05
问题 I'm new to threads. I'm using a 3rd party library that uses threads which at times call a procedure I've provided. How do I update update a TLabel.Caption from my procedure when its called by the thread? If I've called InitializeCriticalSection elsewhere, is it as simple as EnterCriticalSection(CritSect); GlobalVariable := 'New TLabel.Caption'; LeaveCriticalSection(CritSect); And then in my main thread: EnterCriticalSection(CritSect); Label1.Caption:= GlobalVariable; LeaveCriticalSection

How can I push a TWSocket's OnDataAvailable() event to a background thread in my Delphi 6 application?

北战南征 提交于 2019-12-23 09:56:21
问题 I have a Delphi 6 application that uses the ICS component suite to do socket communications. I have my own server socket VCL component that creates client TWSocket sockets when a new session becomes available. The client sockets I create do have the Multithreaded property set to TRUE, but all that does is changes the way the client socket handles socket messages to a manner that is safe from a background thread (non-main VCL thread). TWSocket does not spawn a thread to handle socket data

Delphi: How to find and fix an EOutOfMemory Error?

穿精又带淫゛_ 提交于 2019-12-23 09:26:56
问题 I'm building a delphi application which does scientific simulation. It's growing in complexity & now consists of many units and forms. I'm starting to get EOutOFMemory Errors each time I run. It seems to happen during or just after I use an Array of variant temporarily within a functions. At risk of asking a really dumb question, is "array of variant" asking for trouble? ( I could convert everything to string, but array of variant in principle saves a lot of fudging things). the offending

Remove empty strings from TStringList

白昼怎懂夜的黑 提交于 2019-12-23 08:51:19
问题 Is there any build-in function in Delphi to remove all strings from a TStringList which are empty? How to loop through the list to remove these items? 回答1: To answer your first question, there is no built in function for that. Looping manually is easy. This should do it: for I := mylist.count - 1 downto 0 do begin if Trim(mylist[I]) = '' then mylist.Delete(I); end; Note that the for loop must traverse the list in reverse starting from Count-1 down to 0 for this to work. The use of Trim() is

How do I set my MainForm to be hidden when my program starts?

南楼画角 提交于 2019-12-23 08:28:08
问题 I am using the Borland c++ builder. I have an application where I want the main form to be hidden until a button is pressed on a different form. i have set the Visible value on the mainform to false, but it still shows up when i run the program. anyone know what to do? 回答1: Have a look at the TApplication ShowMainForm property. Here is an example based on the instructions in online help. Set the main form Visible property to false. On the menu select Project -> View Source to display the main

Multiple MDI Parent Forms in a Single Application [closed]

对着背影说爱祢 提交于 2019-12-23 06:58:39
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . The VCL does not natively allow forms other than the MainForm to host MDI child forms. This is a hard-coded limitation on Borland's part, not a limitation in Microsoft's MDI architecture. Microsoft allows