-
Content Count
1073 -
Joined
-
Last visited
-
Days Won
23
Everything posted by aehimself
-
Hello, Due to various reasons I'm experimenting with Delphi's TRichEdit component. I looked into the demo and quickly learned the basics but I didn't find any way to insert a picture. My searches lead to two solutions: - LINK. With a RichOle.pas file create an object from the image and insert it into the RichEdit using OLE. This method worked, but it embeds it instead of inserting (image is not shown, only an icon and the file name. Picture opens correctly when double-clicked) - LINK. Load the bitmap and convert it into rich edit compatible code. Insert this code using EM_STREAMIN. This method did absolutely nothing Another way (which probably works) is to copy the picture to the clipboard and paste it's contents into the RichEdit but this just feels way too hacky. The question is, how to insert a picture in a TRichEdit the most elegant way? I'm attempting on Delphi 10.4.1 / 10.4.2 / 11.1. Thanks!
-
I wish this was explained further. Maybe we will finally get TZipFile.Delete / TZipFile.Remove? đ
-
Permanently the "Lock Controls" in IDE
aehimself replied to luciano_f's topic in Delphi IDE and APIs
Hah, I didn't even know this feature existed đ -
Permanently the "Lock Controls" in IDE
aehimself replied to luciano_f's topic in Delphi IDE and APIs
By locking you mean they cannot be interacted with? If yes, just write a recursive method to walk through your form, disabling / enabling your controls in the process: Procedure TForm3.LockControls(Const inLockControls: Boolean; inParent: TWinControl = nil); Var a: Integer; Begin If Not Assigned(inParent) Then inParent := Self; For a := 0 To inParent.ControlCount - 1 Do Begin inParent.Controls[a].Enabled := Not inLockControls; If inParent.Controls[a] Is TWinControl Then LockControls(inLockControls, inParent.Controls[a] As TWinControl); End; End; -
A little too late, but TSplitView shipped with D11 can also do this, with an addition of animated opening / closing. The backdraw is it only can be opened to the side, so you cannot expand down as far as I checked. I'm using it as a collapsible menu, opening by hovering your mouse on the chevron:
-
Import / Export PIPE delimited text <> SQLite3 64Bit Database
aehimself replied to Blavatsky's topic in Databases
I really don't see the issue here. Pipe delimitation is not common; either search-replace with tabs and use any available database manager or write your own. Use FireDAC, Zeos or any SQLite.dll wrapper directly to "connect" to your database. If you choose a component-based approach you can load the contents in some kind of TDataSet-descendant and you can manipulate records as your heart desires. -
I am using Delphi exclusively but I suppose it'll be similar in CB too. Forget about ProcessMessages. If you really need, you can call Button1.Repaint for example. This will skip the message queue and simply "force" the control to refresh it's appearance.
-
I found the meme about it:
-
A ComboBox suffers from the same 2-click issue and while it does save space, still not the usual way to handle these inputs. If UI space is an issue you should be looking at how to increase the space, not on workarounds. Unfortunately at work people were doing something similar and just pulled things closer together when they ran out of UI space (or the infamous pagecontrols on tabsheets). The end result physically hurts to look at.
-
I advise against the use of TCheckBox or similar for such an input. There are multiple reasons: "greyed" state doesn't clearly mean "not sure" AND you might have to click twice to change your answer from one answer to the other. I'd suggest to have three radio buttons, right next to each other, with each column having a title; like an online questionare. Somthing like this:
-
Implementing sync requests in async communication
aehimself replied to brk303's topic in Network, Cloud and Web
If you are sure you can not put the component in sync mode somehow, what you can do is: - Create a thread, have a private boolean called "_requestcompleted" - Create the component in the thread's context - Set the event handlers, flip _requestcompleted to True in the handler when... well, the request is completed - in the thread's context, send the request and then have a loop like... Repeat // Message pump, if needed for the component Sleep(100); Until _requestcompleted Or Self.Terminated; This method is inefficient as the CPU is spinning in a loop but at least easy to understand. If your component needs no message pump, you can switch to events and use WaitForMultipleObjects for a more resource-friendly approach. -
Data aware component with transaction
aehimself replied to WalkingAway's topic in Algorithms, Data Structures and Class Design
You are talking about two completely different areas with completely different functionality. A component is displaying / allowing to change a value, The source of said value is the dataset, which can behave in multiple different ways... either send the data to it's connection, use CachedUpdates or simply Cancel and revert to the unchanged state. The connection will be the one deciding when the data will be written to the database by further caching and transactions. You don't want to mix the functionality, especially if that functionality already exists. Spend that free time further improving your component, to display and change a value only đ -
I see. Thank you for confirming.
-
Isnât the dropdown menu a TPopupMenu? Or you mean in this scenario the property is not populated?
-
Not sure if it will work here but you can try to check the TPopupMenu.PopupComponent property.
-
Direct vs. Indirect access of service by a Client?
aehimself replied to David Schwartz's topic in Network, Cloud and Web
Zeos recently implemented a Proxy driver which does exactly what you describe - it only exposes the proxy and client apps âconnectâ to this proxy. It supports all protocols which Zeos itself supports. I personally never tried it so I cannot say anything about security and such, but you can give it a try. -
Google Play requires Android 13 after 31. august !!!
aehimself replied to Hansâ«'s topic in Cross-platform
This is a clustermess. If you are publishing to Android you must have an update subscription so you can continue to be present; but even if you do youâll do it on a beta platform which might not produce fully functioning codeâŠ? Am I getting it rightâŠ? Fortunately Iâm not affected it; it just sounds extremely strange. I did not check the article but Iâm sure the steps needed could be automatized and depleted via a patch. -
Is this shortcut to the exe what Delphi compiles? Windows Explorer caches the icon of executables and shortcuts so you might need to clear that cache for you to see the icon you just set.
-
Can ICS thread cause memory violation? (EOutOfResources error)
aehimself replied to PizzaProgram's topic in ICS - Internet Component Suite
According to the stack trace it is indeed GDI object exhaustion. Check where and how you are manipulating images and make sure you are disposing of them properly. We had this when there was an image list on a frame which was created thousands of times. Moving the imagelist to a common place solved our issue immediately. @Dalija Prasnikar we also received EOutOfResources when our application used up all available user handles so itâs not strictly GDI-related. But yes, leaking handles often pop up as Delphi classes in the memory leak report.- 76 replies
-
- thread
- eoutofresources
-
(and 2 more)
Tagged with:
-
Using bold text in Listview
aehimself replied to Bart Verbakel's topic in Algorithms, Data Structures and Class Design
Yes, it should be ListView1.Items.Add. If you declared your class like I posted (descending from ânothingâ = TObject) it does not require an owner (not a parent). If the definition is correct, itâs still possible that the RTL has a component named TListItemData, so you can try to name yours âTMyListItemDataâ or something else - that will help the compiler to recognize which one you want to create and what parameters it requires. -
Can ICS thread cause memory violation? (EOutOfResources error)
aehimself replied to PizzaProgram's topic in ICS - Internet Component Suite
What OS the application is running on? Also, are you reusing your threads or creating and freeing them up as needed? On Windows 2000 creating and freeing up threads lead to the same error for me (probably due to memory fragmentation, idk) and the solution was to simply reuse threads.- 76 replies
-
- thread
- eoutofresources
-
(and 2 more)
Tagged with:
-
Using bold text in Listview
aehimself replied to Bart Verbakel's topic in Algorithms, Data Structures and Class Design
It's not working with a global variable because you cannot make sure that it has the right value the moment the ListItem (re)draws an item (e.g. during scrolling). Instead, you have to tie this data to each independent node. Declare a type, e.g.: TListItemData = Class public BoldText: Boolean; End; Then, when adding a list item: var li := ListItem1.Items.Add; li.Data := TListItemData.Create; (li.Data As TListItemData).BoldText := True; To make sure you are not leaking memory, add an OnDeletion handler to your ListView: If Assigned(Item) Then Begin TListItemData(Item.Data).Free; Item.Data := nil; End; After all this, in your custom draw methods you can check the object's property: If Assigned(Item.Data) And (Item.Data As TListItemData).BoldText Then Sender.Canvas.Font.Style := [fsBold] Else Sender.Canvas.Font.Style := []; I did not run this code so some minor adjustments might be needed but the basics are this. Also, instead of a custom class you simply can create and assign a PBoolean to Node.Data, but a class is more versatile if you want to add more properties later on. -
When you open the site in your browser you can check all the network calls made for the site to actually load. If you are lucky there will be an API call which returns the file list in a well-known format. Even if there is one, I donât know however if you are allowed to query that API⊠the site owner will be able to tell you the legal parts.
-
In your browser it works because there are some JavaScript generating / fetching the data from somewhere else with your browser happily renders. Youâll need TEdgeBrowser or something similar to actually render it for you and then process the visible document.
-
Way for external app to jump to a unit and position inside the IDE?
aehimself replied to domus's topic in Delphi IDE and APIs
I wonder where @RRUZ got this unit. IF we are talking about the same component, according to it, TEditControl has two published properties: property CaretX: SmallInt; property CaretY: Integer; If we can find out how to access this type from a Delphi application (even without source) I'm sure TEditControl could be accessed via it's handle and some pointer magic...