-
Content Count
1053 -
Joined
-
Last visited
-
Days Won
23
Everything posted by aehimself
-
I want to display a progress / warning indicator on a tabsheet which will block all actions to the components on the tabsheet... imagine like the UAC "popup". Everything in the background is dimmed as they are unavailable at the moment, only the important stuff (buttons, labels, etc) are shown with full visibility.
-
So, the "screenshot" and repaint dimmed works... almost. The bitmap is captured correctly (saved to a file, shows perfectly) but drawing it back causes some issues... I have a TPanel descendant, like... TDimPanel= Class(TPanel) protected Procedure Paint; Override; Procedure Resize; Override; End; Procedure TDimPanel.Resize; Var dc: HWND; Begin inherited; _bitmap.SetSize(0, 0); // Clear the bitmap _bitmap.SetSize(Self.Parent.Width, Self.Parent.Height); // Self.Parent.PaintTo(_bitmap.Canvas.Handle, 0, 0); // Does not capture everything, leaves some components out... dc := GetDC(Self.Parent.Handle); BitBlt(_bitmap.Canvas.Handle, 0, 0, _bitmap.Width, _bitmap.Height, dc, 0, 0, SRCCOPY); _bitmap.SaveToFile('C:\shot.bmp'); End; Procedure TDimPanel.Paint; Begin inherited; Self.Canvas.Draw(0, 0, _bitmap, 128); // Self.Canvas.Ellipse(0, Self.Height - 20, 20, Self.Height); End; But only the upper half of the bitmap is drawn on the panel, bottom half is empty. If ellipse drawing is uncommented, it shows up properly. The funny thing is that if I use Self.Canvas.Draw(0, 0, _bitmap); all is drawn perfectly, but I loose opacity... I guess it will have something to do in how the bitmap is set up...? At the moment I have the following in the constructor: _bitmap := Vcl.Graphics.TBitMap.Create; _bitmap.Transparent := False; _bitmap.PixelFormat := pf32bit; Moving the code out of my project to a TForm and using it's canvas to paint the bitmap to has the same behaviour. Any help is greatly appreciated, these imaging-things are way out of my league.
-
I was afraid so. I got WinErrors when I tried to do so. While the bitmap screenshot idea will work, it feels really hacky. Makes me a bit more comfortable that others got to the same idea to this problem, though. It's just a little bit strange that "dimming" is this complicated to achieve. Thanks anyway, I'll start with the bitmap idea 🙂
-
...one small question, though. Is it possible to make the panel transparent, but not the components on it?
-
NICE!!!! And it even works with VCL Styles. Thank you, @Renate Schaaf!
-
TNotification — Customizing Caption on Windows 10?
aehimself replied to Steve Maughan's topic in Windows API
There is / was a similar thread you can check; maybe it helps? Embarcadero Toaster - Notification Window Caption in Win10 - VCL - Delphi-PRAXiS [en] -
You, sir... 🙂
-
There is no portable version of Delphi available afaik, however I suppose if you copy all necessary files from a PC where you installed Delphi to an other, it might work. But, you have to read the EULA carefully though; I'm not sure if this kind of deployment is allowed. Why installing it is not an option? In my personal opinion a fresh reinstall is always cleaner, guaranteed to work than attempting to "force it to life".
-
Delphi service in a domain controlled environment
aehimself replied to thomh's topic in Network, Cloud and Web
I tried creating a batch file from within the service. It slept 5 seconds (so I can see the process start) called NET STOP, slept 5 seconds (giving time for the service to stop) and NET START. When I called this batch from within the service I remember seeing the process starting and ending when the service terminated. This is why I never used this method. As it works for others I am sure I did something wrong; unfortunately I don't have the code snipplet to debug now. @Lars Fosdal this looks promising, I'll make a dummy service app to test it 🙂 -
I had this when I had a bug (memory corruption to be exact) in my logging mechanism. The program tried to log it's issue but crashed beforehand. Also, if you use 32 bit processes and your log file grows above 2 GB that can cause your executable to halt.
-
Well, I have 2 ideas. 1 - use the HTTP status codes. 200 means all fine, it was inserted. 500 means an error happened, transaction was rolled back, resend is needed from the client. If you can not control the status codes, you can add a "status check API". After a 200 OK for inserting the record, the client can query the inserted IDs for verification. If I understand the question completely, that is. But, I never really worked with stuff like this so take this with a grain of salt. I always liked to control everything, so when it was needed I launched my own webserver via ICS. That way I could set return codes, headers, session cookies, and even send detailed answers in any format whenever I wanted to.
-
Delphi service in a domain controlled environment
aehimself replied to thomh's topic in Network, Cloud and Web
Thank you all for the replies guys but I don't want to hijack OP's topic. The methods here seem to be "hacky" (to crash the service and let Windows to restart it - it's a tricky approach I have to admit, though!) or already tried (creating a batch file to sleep for 5 seconds, and issue the NET TOP/START commands. Issue is, as parent program stops, it stops the child processes and therefore the batch file execution too). I was curious if there is a trick to restart a service from within the service itself without the need of a loader, maintenance service - an other executable in general. As it is not that important for me at the moment I'll just keep my eyes open to see if such method was unearthed already. -
Delphi service in a domain controlled environment
aehimself replied to thomh's topic in Network, Cloud and Web
It's not related to the topic, but may I ask how you implemented the update mechanism? Without a "loader" (e.g. actual code is in a DLL, service only loads and executes the DLL,) I never managed to achieve this. I never figured out how to restart the service from within the service. -
Just two notices. If you will ever use Oracle and RetIDList will contain more than 1000 elements, the code will fail. I don't know if any other RDBMS has this limitation though. How trusted is the file? Taking a string value from somewhere and putting it in a SQL command exposes your application to injection attacks.
-
Can anyone who has 10.4.2 confirm (or just explain if I misundrestood) but TEdgeBrowser now works without the +200 MB download requirements if Windows has the Chromium-based Edge installed? New TEdgeBrowser Extensions The TEdgeBrowser VCL component introduced in 10.4 (a wrapper around the Windows 10 Chromium-based Edge WebView2 control) has been updated with support for the GA version of Microsoft's WebView2 control and its SDK. Besides better compatibility, the component now offers enhanced support for files cache management and the use of custom WebView2 versions.
-
Read and reapply design time properties to specific controls - runtime
aehimself posted a topic in VCL
Hello, I have a method that hides, rearranges and resizes components based on some conditions runtime. All is working fine, but the question eventually arrived: is is possible to "reset" everything to it's original (design time) state? Instead of creating a list of all changed components (and it's properties) I'm wondering if it's possible to re-read and re-apply the .DFM settings to a number of selected components? A list would be easier, but the DFM streaming seems to be the "professional" way to do it. I guess I'll need a TReader for that but I have absolutelly no idea how that works 🙂 -
This is interesting. I am also changing the style runtime, when the application starts. However at this stage the frame including the TreeView does not exist yet in my case so I'd say it's irrelevant.
-
My issue is that I have 5-6 TreeViews in my application in different locations and only one seems to be affected. I don't know what is the difference, this is what I was attempting to debug in the first place. If I know more, I will be able to make a small test case.
-
I had a guess about it, but since at me it is on a frame... but you are right, let me rephrase it to "moving Items.Clear to the owning component's BeforeDestruction event" to be more inclusive 🙂
-
10.4.1 and 10.3 for sure, I don't know about the rest. I'll check if moving .Clear in BeforeDestruction of the frame helps. That could be a workaround for most of us.
-
Read and reapply design time properties to specific controls - runtime
aehimself replied to aehimself's topic in VCL
I already started to experiment with the TReader component, unfortunately OnCreateComponent will only let me to use a different constructor other than the default. If the component is not created in the handler it will be created anyway. This thing is still a mess to me though... how do I specify WHERE the new components will be created...? As it needs a stream I need to get it from the executable - I guess it will be stored as a resource...? I'm only at the beginning. I'll find the answers soon enough. This is actually a really neat idea. As the TReader method will create the components anyway I suppose the memory usage will be close to equal anyway. As a huge bonus, I know how to create a new form instance 🙂 An other good idea. Tags are - unfortunately though - already in use in said project 😞 I'll dig into the TReader a little bit so I'll have a basic understanding of how it works / what it does. It never hurts to know something, you never know when you'll need such a thing. Thank you all for your answers! -
Splitting existing components to run- and design time packages
aehimself posted a topic in General Help
I like to compile my components and let Delphi use the existing DCUs in my projects. Having my sources on SSD this not just saves time but prolongs the life of the data store as well. I recently started to experiment with a component suite which was written as a blob, runtime and design time in one, therefore I can not build 64 bit DCUs. I never really thought of creating my own component packages and therefore I have 0 experience with this. Are there any tips, tricks or resources that can help me achieving my goal? At the moment I can't even tell how to distinguish what is considered runtime and what is designtime 🙂 -
Splitting existing components to run- and design time packages
aehimself replied to aehimself's topic in General Help
Let's say I have aeSuperDuperUtilities.pas and I compile it to all platforms, all configs. Then I set my library / debug DCU path to the relevant output folders, browsing path to the source. If I make a change in said unit, I recompile it again with all platforms / configs. At the moment I cannot imagine a way how any of the compiled DCUs would get out of sync. Then again, most probably I never worked on as many, as complex projects as you did. Can you please give me a theoretical scenario / direct me to an article so I can learn more about this? -
Splitting existing components to run- and design time packages
aehimself replied to aehimself's topic in General Help
* sigh * Yes. That was EXACTLY the meaning of it. -
Splitting existing components to run- and design time packages
aehimself replied to aehimself's topic in General Help
I did not really make components up until this point - maybe that's why I never faced an issue you are talking about. But if I'm not contributing to a component the practice of "download / update -> rebuild DCUs -> ??? -> profit" always worked for me. It seems being the end user has it's benefits sometimes 🙂