

Ian Branch
-
Content Count
1434 -
Joined
-
Last visited
-
Days Won
3
Posts posted by Ian Branch
-
-
On 4/5/2024 at 6:46 AM, Lars Fosdal said:Variable not initialized - I set that one to raise a compile error - because those WILL bite you.
A good idea. Where/how does one do that?
-
Hi Team,
Having installed D12.1 over D12, it of course installed its own Indy version.
I am sure I saw/read somewhere about a a script of some sort that replaced the distributed with Delphi version with the one from GitHub.
Hopefully I wasn't imagining it.
Does this ring a bell with anyone?
Regards & TIA,
Ian
-
Hi Team,
This is as much to reinforce with me as it is info that may help others.
"Local variables are actually not initialized, but global variables and object fields are initialized to zero (which means 'false' for boolean variables).
Therefore you always have to initialize local variables yourself, compiler even generates a warning if you don't."
I got caught out with an inline variable. var lTest: boolean;
I incorrectly assumed ite defaulted to False.
This is not so, in fact in my tests it seems to default to TRUE.
However, I won't bank on that and will allways initialise local variables now.
No, I never noticed the warning, or if I did I ignored it. 😞
Ian
-
Installed 12.1 over 12 without using the Web Installer issue.
It didn't install the latest Help (.chm) files. 😞
-
6 hours ago, dummzeuch said:You should get the line number of the original function if you pass 1 as the parameter to LineByLevel instead of the default 0.
Yup. Works just as well. Tks.
-
3 hours ago, dummzeuch said:Just keep in mind that calling GetLocationInfo is rather costly. It's not meant to be called all over the place.
Noted. Tks.
-
12 hours ago, dummzeuch said:Edit: There is System.ReturnAddress, introduced with Delphi XE2, which gives you just that, so
Tks. Exactly what I needed/wanted.
I made a minor change as I am using D12:
/// <summary> /// Retrieves the current line number. /// </summary> /// <remarks> /// Requires the JCLDebug unit. /// </remarks> /// <returns>The line number of the current position.</returns> function GetCurrentLineNumber: Integer; begin // var ModInfo := GetLocationInfo(ReturnAddress); // Result := ModInfo.LineNumber; // end;
LineByLevel - Whilst I could use it in my code by adding JCLDebug, I wanted to have it as a function in my library. If I used it from my library I got the line number in the library, not the Apps code.
Regards & Tks again,
Ian
-
1 hour ago, Der schöne Günther said:In case (for whatever reason), you really just like to add the current line number into a string, then have a look at:
I had a look at that previously. I may be missreading its use but it seems that JCLDebug relies on an Exception for something like this to work:
function GetCurrentLineNumber: Integer; var ModInfo: TJclLocationInfo; begin ModInfo := GetLocationInfo(ExceptAddr); Result := ModInfo.LineNumber; end;
-
Hi Team,
Delphi 12.
Is there a way to embed the current design time code line number into a string so that it can be shown in a message. It needs to reflectthe actual line number, even if the previous code is edited and it's actual number changes.
Regards & TIA,
Ian
-
On 3/8/2024 at 6:28 PM, David Schwartz said:If customers didn't complain, that meant nothing was wrong. Nobody cared what we programmers might find.
Oh how true.....
-
1
-
-
Ahhh. Tks.
-
Tks Brian.
Yes, VMWare Workstation Pro.
What dictates which alternative you use?
Ian
-
Hi Team,
With the recent change in ownership of VMWare and the changes that have been wrought to it, I am leary of continuing to use it.
What is a suitable alternative?
I am using Win 11.
-
Ditto.
-
That is what I used.
-
IndyIPServer290 issue: Deleted it and the issue went away. 😉 It should have been deleted with the Clean up.
LivePreview Issue: Answered in 2021 when I had the same issue. I don't use it so it doesn't matter.
-
Hi Team,
Win 11, D12.1.
I installed the latest Indy10 per the instructions.
I noted that the uninstall cmd kept failing due to access level.
I manually deinstalled the indicated Indy files.
I then installed the 290.groupproj without issue.
On restarting D12 I see the following message:
I found IndyIPServer.dpk but Delphi doesn't like it. 😞
Do I need this .bpl?
If yes, how do I now recreate it to Indy10?
I am also seeing this error when I start D12:
Regards & TIA,
Ian
-
Case on Strings.
i.e.
case myStringVariable of
'A': do something;
'Test': do something;
etc
end;
-
3
-
-
Aside from wanting all the existing features/functions working 100% and bug free, I wouldn't mind a construct like this:
var a := b := c := d := 0; or similar.
-
-
Roger, Lars, Fair comment. I apologise. I would edit it if I could.
-
So, the thicken plots....
I have narrowed it down to using the ''' construct with the ExpandedText property of a TTaskDialog.
I create the TTaskDialog in code.
Everything is happy with this:
ExpandedText := '1. Wait - The App will try to reconnect until it connects or it has another connection timeout.' + sLineBreak + '2. Cancel - This is a last resort selection and will result in an Application crash and generate a formal error report.' + sLineBreak + 'At this error prompt you have the normal error report options.' + sLineBreak + 'If you don?t know or understand the error report dialog or the options available you should ask to your Workflow System Administrator.' + sLineBreak + 'It is strongly recommended that you select these options in the following priority/order => Wait then Cancel.';
As soon as I put all the text into the ''' construct and double click on the OnShow property of the form, It gives me the error that it can't find OnShow.
Interestingly, I didn't get the 'finally-end' inserted as I edited the text.
-
Hi Brian,
You may have hit on something there.
I think I first noticed it when I was setting up text within the ''' - ''' multi-line structure.
The 4 files I found the issue in had been so edited.
I restored previous versions of each and all was fine.
Today I was just editing one of those files in the IDE and was in the process of restructuring a block of text per the ''' multi-line structure, when it happened. 😞
I had pressed enter at the end of the text line and got a 'finally-end' back. 😞
I did a test again to see if double clicking on the OnShow Event would work, and no, it now failed per my original experience.
I tried to back out the ''' construct, but the issue persisted. 😞
I restored a 1 hour old backup and it was fine.
Note to Self: Don't bother with ''' constructs for the foreseeable future.
This isn't a Patch 1 specific issue, 3 of the 4 files restored went 'faulty' around mid-Jan & the fourth around mid-Dec.
Unfortunately, I can't replicate this in a test App. 😞
Ian
-
Hi Team,
For what ever reason, it doesn't happen anymore.
I didn't take notes, but I'm wondering if it was somehow related to the other issue I posted about which has been resolved. Seemingly corruption of some sort that I couldn't identify.
Unfortunately, I can't recall if I experienced this issue in those Projects specifically, or in others. 😞
Certainly the issue reproduceable and annoying.
Everything is working as expected now.
Thank you all for your contributions.
I will keep my fingers crossed...
Regards,
Ian
-
1
-
State of an uninitialised variables..
in Tips / Blogs / Tutorials / Videos
Posted · Edited by Ian Branch
Cheers. It's a pity it has to be set per Project.
Tks.