Andrew Spencer
Members-
Content Count
27 -
Joined
-
Last visited
Community Reputation
2 NeutralRecent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Format a Float field text using another field value
Andrew Spencer replied to Andrew Spencer's topic in Databases
Answering my own questions... The line should have been Text := Format('%.*f', [TfrmMain.qMyTable.FieldByName('decimals').AsInteger, Extended(Sender.Value)]); -
Format a Float field text using another field value
Andrew Spencer replied to Andrew Spencer's topic in Databases
I get the feeling that qMyTable is no longer in scope when this event is launched -
I have a table with a float field, and would like to format the decimal places displayed for this value based on the content of another (integer) field in the same record. Access is via a TFDQuery. I tried to hook the OnGetText event of the float field in question with the following code, but this is giving an access violation error. procedure TfrmMain.ItemValueFormat(Sender: TField; var Text: String; DisplayText: Boolean); begin Text := Format('%.*f', [qMyTable.FieldByName('decimals').AsInteger, Sender.Value]); end; If anyone has tried something like this before, I'd appreciate some tips/code snippets. Thanks!
-
File extension icons all gone with D12.2
Andrew Spencer replied to Andrew Spencer's topic in General Help
Excellent - thank you - that did exactly what I was looking for. -
Hi Somehow in the update to Delphi 12.2, I have lost the Windows icons associated with the various Delphi file extensions (.pas, .dfm, .dpr, .dproj etc) Is there any easy/quick way to get these back?
-
Delphi 12 error when closing the ide
Andrew Spencer replied to malobo's topic in Delphi IDE and APIs
I narrowed it down to Jedi Component Library. The same 3rd party installation also appeared to give the same IDE closing error with Delphi 11.3 -
Using Delphi 11.3 I often have a situation where the .Visible property of a control depends on the .Checked property of a TCheckBox (or similar). To do this, I typically write an OnClick event for the TCheckBox, and set the .Visible property of the target control in a single line of code e.g. TargetLabel.Visible := SourceCheckBox.Checked; I also make sure to call this OnClick event at startup, if I happen to need to load the .Checked state from a previously-saved registry or Ini file entry. I thought that LiveBindings was designed to help me get rid of needing to write OnClick events. So to test I set up a TForm with a TLabel and a TCheckBox, with LiveBindings Designer as follows: My expectation was that, from then on, the TLabel.Visible property will simply follow the state of the TCheckBox.Checked property. No additional code would need to be written. BUT, it didn't work exactly as I expected. Question 1 : When I run this, the TCheckBox.Checked property initialises to the Design-time setting of TLabel.Visible. Setting TCheckBox.Checked to True at Design-time is ignored. Why is it not the other way around i.e. The TCheckBox.Checked value, at Design-time, determines the TLabel.Visible property at Run-time? That's the way that the arrow is pointing. This only appears to happen AFTER the application is up and running i.e. clicking on the TCheckBox will alter the visibility of the TLabel accordingly. Question 2 : How can I get this initialised, at run-time, so that the two controls start off operating correctly? I have only found that setting BOTH the TCheckBox.Checked AND the TLabel.Visible properties to the same value gets things going correctly. Question 3 : Programatically changing the TCheckBox.Checked state at runtime does not cause the TLabel.Visible property to change. Question 4 : Have I just totally misunderstood what I can do with LiveBindings, or how to implement what I want?
-
I've often used a derived class on TCustomControl to access a control's Canvas property. type TGetCanvas = Class(TCustomControl); and then used it later in a line similar to this: TGetCanvas(progressPanel).Canvas.TextWidth("Hello World") In trying to neaten things up, I noticed that the same type declaration was in the interface or implementation section of numerous units. I tried moving the declaration to the interface section of a "library" unit, and useing that unit in all these other units. On compilation, however, a line like the one above would raise and error "E2362 Cannot access protected symbol TCustomControl.Canvas". Why is this not functioning in the same way as if the type declaration was in the unit itself?
-
Ouch! OK - that makes sense. I'll have to do a work-around for how I want it to behave. Thanks, Uwe.
-
Apologies - I zipped up the wrong one. TCalendarViewInvalidDate.zip
-
A TCalendarView on a TForm, with a TMemo. In the TCalendarView's OnClick event, add a line to the TMemo showing when the OnClick event happened, and the formatted and integer value of TCalendarView.Date. In Delphi 10.4.2 I am seeing that with consecutive <1Hz clicking on the same date, a "bad" date value is returned on every second click returns a null date. Also, when clicking >~1Hz, this can produce multiple "bad" dates. The "bad" date value is -700000 (if you take the Trunc() of it). Does anyone have any ideas? TCalendarViewBadDate.zip
-
Why can I set the Font.Color property, in Delphi 7, for controls like TCheckBox (and descendents TDBCheckBox etc) TRadioGroup and get the expected result. But in Delphi 10.4.2 everything remains clWindowText (or clBlack). TLabel.Font.Color works, but most other controls do not. Have I really just not noticed this for the past few years!?
-
I am only using TEdgeBrowser to display the "Release Info" for my software. So it turned out that setting the temporary folder and making sure that the " EBWebView" folder that gets created there (and all sub-folders) are deleted, before calling the .Navigate method was quite suitable for my needs. There was no need to preserve all the additional functionality stored in the cache, as detailed in the Microsoft documentation. Thanks for the responses!
-
I'm using EdgeBrowser1.UserDataFolder to set up the temporary folder for cache management (as detailed in https://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_TEdgeBrowser_Component_and_Changes_to_the_TWebBrowser_Component) Is clearing the cache as simple as deleting the 'EBWebView' folder that gets created, before navigating with the TEdgeBrowser?
-
Failed deferred Getit packages
Andrew Spencer replied to Andrew Spencer's topic in Delphi IDE and APIs
Everything in the Registry looked fine, so I made no changes there. I did delete a couple of folders of old/unused JEDI CL and VCL from My Documents\...\CatalogRepositry That fixed the problem. (Of course, this was nowhere near what the original pop-up message advised to be done!) Thanks