Jump to content

Ian Branch

Members
  • Content Count

    1276
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Ian Branch

  1. Ian Branch

    Getters & Settters??

    I got an email with a link.
  2. Ian Branch

    Getters & Settters??

    David, Thank you for your clear and helpful explanation. Appreciated. I have been looking in my Apps to see where/how the use of Properties can improve my code. I have found a couple of cases so far. Stano, Tks. I have downloaded the book. Regards, Ian
  3. Ian Branch

    Getters & Settters??

    Actually I can answer my own question. Stepping back, I can see that the Foo.Value isn't part of the Create, it is added after, therefore it can only be 'visible' at ShowModal. All good now.
  4. Ian Branch

    Getters & Settters??

    Mark, Ahh good point. TFoo is created in another form, a value assigned to the property and then the form shown with a ShowModal. // var Foo := TFoo.Create(nil); // Foo.Value := 46547; // try Foo.ShowModal; finally // ... ...
  5. Ian Branch

    Getters & Settters??

    Hi Team, I have set some properties per the above guideline. Is it correct, or have I missed something, that the property ' Value' only becomes visible/usable at Form Show, no sooner? It doesn't seem to be available at Form Create. Regards & TIA, Ian
  6. Hi Team, I have a TTable called JobTickets and I want to assign a Unit procedure to its AfterInsert event at run time. Something like.. JobTickets.AfterInsert(DataSet: TDataSet) := JobTicketsAfterInsert(DataSet: TDataSet); Delphi doesn't like the above. 😞 What do I need to do to make this happen please? Regards & TIA, Ian
  7. Ian Branch

    Assign an App procedure to a Component Event??

    Hi François All sorted. I have it working now. The thing I was doing wrong seems to be using the same event name that the component would use. I changed JobTicketsAfterInsert to MyJobTicketsAfterInsert. Added to the form class procedure MyJobTicketsAfterInsert(DataSet: TDataSet); Changed the procedure to procedure TdmC.MyJobTicketsAfterInsert(DataSet: TDataSet); begin // DataSet.FieldByName('DateIn').AsDateTime := now; // end; And the assignment to JobTickets.AfterInsert := MyJobTicketsAfterInsert; And it all works as desired. Regards & Tks. Ian
  8. Ian Branch

    Delphifeeds.com??

    Anybody know what has happened to Delphifeeds.com??
  9. Ian Branch

    Quote of the Day...

    Hi Team, D10.3.3, Indy v 10. I am trying to implement the Quote of the Day example as demonstrated by Alister Christie in his video 'Quote of the Day (And tray icon balloon hint)' in 2008. The project builds OK and aside from changing the idQOTD port to 80 it seems to run OK using quotes4all.net as the host, but doesn't seemingly return anything. This is my first foray into Indy. I suspected it may be a Unicode thing however it doesn't seemingly return anything when built with D2007 either. I can't tell what version of Indy Alister used but I suspect it was earlier than 10. Has anybody got this particular example working in the more recent Delphis/Indys? I'd appreciate any suggestions/assistance/guidance. Regards, Ian
  10. Hi Team, I thought I would try refactoring some code that is used 5 times in the Unit. Seemed a good idea. Win 11, D11.2, EurekaLog. I have the following as a private function for the form.. 'There is no Corporate Email Address recorded in the Company data!' In the calling code I have.. // var MailSender := TELMailSMTPClientSender.Create; // try // MailSender.Options := CurrentEurekaLogOptions; // MailSender := SetSvcOrCorpSender(MailSender); // And the refactored code is.. function TJobTicketsForm.SetSvcOrCorpSender(var MailSender: TELMailSMTPBaseSender): TELMailSMTPBaseSender; begin // // Set Sender while True do begin // case tdSvcorCorpSend.Execute of 100: begin if Trim(ACD.ServiceEmail) = '' then begin Showmessage('There is no Service Email Address recorded in the Company data!'); Continue; end; // MailSender.Options.SendSMTPClientFrom := Trim(ACD.ServiceEmail); if Trim(ACD.ServiceEmailName) = '' then MailSender.Options.OverrideUserFullName := StrTokenAt(Trim(ACD.ServiceEmail), '@', 1) else MailSender.Options.OverrideUserFullName := Trim(ACD.ServiceEmailName); Break; end; 200: begin if Trim(ACD.CorporateEmail) = '' then begin Showmessage('There is no Corporate Email Address recorded in the Company data!'); Continue; end; // MailSender.Options.SendSMTPClientFrom := Trim(ACD.CorporateEmail); break; end; end; // end; //; Result := MailSender; // end; Trouble is that delphi tells me that the types and formal var parameters must be identical. Ummm. Arent they? Resolved. IT seems I missed a step during my In-Line variables conversion.. // var MailSender: TELMailSMTPBaseSender; // <<<<<<<<<<<<<<<<<<<<<<< // MailSender := TELMailSMTPClientSender.Create; // Regards & TIA, Ian
  11. Ian Branch

    Grep Results dialog..

    It would be nice if the Grep Results dialog remembered its last position/size.. It would also be nice to have a Clear Results button on the dialog.
  12. Ian Branch

    Grep Results dialog..

    Hi Thomas, Ah Ha! Didn't know that step. All good now tks. Regards, Ian
  13. Ian Branch

    Grep Results dialog..

    Hi Thomas, I just tried that and yes it now is larger and moved, but it opens every time I open a Project, whether I want it or not.
  14. Hi Team, I would like an IDE tool that works something like this.. 1. Select a variable anywhere in a Unit. 2. Right Click or Hot-Key (becoming scarce) and get the option to show all occurrences of that variable in the Unit. 3. The showing would be in a popup window showing each of the lines the variable is in. 4. Double clicking on one of the lines will take me to that line in the Code and close the popup. Why do I want this? Many times I have caught myself out by redeclaring a variable in a function/procedure that had already been declared at the Unit level which has caused issue. And vise-versa. Just asking. This is a personal thing, I don't expect others to have the same issue/problem. Perhaps the tool/functionality already exists in one of the many 3rd party IDE add-ins?? Regards, Ian
  15. Ian Branch

    Grep Results dialog..

    Whilst I am editing a project, yest it remembers. But, if I close the projects and open a new one for editing when I open Grep it opens in the upper left corner of the screen. and I have to move and resize it again. I am using win 11 64 bit, D11.2 and 2 x 4k monitors. Ian
  16. Ian Branch

    Is there such a tool/functionality??

    Hi Anders, Just tried it in D11.2. What a waste of effort. For the variables I tried Gexperts Grep found all of the occurrences, Search & Find only found the declaration. :-( Grep is exactly what I wanted. Ian
  17. Ian Branch

    Grep Results dialog..

    Who'd a thought.... πŸ˜‰ I thought I would air the ideas to gauge reaction before formalising them but they have been formally posted now.
  18. Ian Branch

    Is there such a tool/functionality??

    Hi Pat, Only works for/on Components. Ian
  19. Ian Branch

    Is there such a tool/functionality??

    Hi Thomas, That will do nicely.. Tks for the pointer. Regards, Ian
  20. Ian Branch

    Use of inline variables..

    Hi Team, OK, so I'm a bit slow coming to the party. I am just starting to have a serious look at inline variables. I have read a couple o articles on the subject and can deal with most uses however there are a couple that I am unsure of the consequences.. If I have code something like this.. ... ... for var i: SmallInt := 0 to Screen.DataModuleCount - 1 do begin var TheDMod:TDatamodule := TDatamodule(Screen.DataModules[i]); ... .. end; Will 'TheDMod' get redeclared every iteration of i? Are there any dangers in doing this?? Similarly for.. ... for var i: SmallInt := 0 to Screen.FormCount - 1 do begin var TheForm: TForm := Screen.Forms[i]; ... ... end; I discovered that this isn't acceptable.. function ComputerName: string; begin var Size: DWord := 256; var buffer: array [0 .. 255] of Char; Result := IfThen(GetComputerName(buffer, Size), buffer, ''); end; It doesn't like the var buffer.... line. I also discovered it throws my code formatting out. πŸ˜‰ Regards & TIA, Ian
  21. Ian Branch

    Use of inline variables..

    Tks Remy. I have Voted for them. Ian
  22. Ian Branch

    Use of inline variables..

  23. Ian Branch

    Use of inline variables..

    Neat.
  24. Ian Branch

    Use of inline variables..

    Noted. function ComputerName: string; var buffer: array[0..MAX_COMPUTERNAME_LENGTH + 1] of Char; begin var Size: Cardinal := MAX_COMPUTERNAME_LENGTH + 1; GetComputerName(@buffer, Size); Result := StrPas(buffer); end;
  25. Ian Branch

    Use of inline variables..

    πŸ™‚ I'm a simple man that does simple, old school, programming. πŸ™‚ Just trying to pick up some new tricks..
Γ—