Jump to content

Ian Branch

Members
  • Content Count

    1352
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Ian Branch

  1. Ian Branch

    Call to create a form to return a value?

    So. I thought I would be sneaky and pass a record so I could retrieve several values. Well that didn't work. 😞 In the donor form when I try to compile it I get the error.. [dcc32 Error] Unit11.pas(19): E2029 Identifier expected but 'RECORD' found here.. { Private declarations } public { Public declarations } class function Execute(out Value: record): Boolean; <<<< Error here. end; type TCustomer = record name: string[30]; age: byte; end; var Form11: TForm11; customer: TCustomer; implementation {$R *.dfm} class function TForm11.Execute(out Value: record): Boolean; var F: TForm11; begin F := TForm11.Create(nil); try Result := IsPositiveResult(F.ShowModal); if Result then Value := F.customer; finally F.Free; end; end; Being called from the caller form by.. type TCustomer = record name: string[30]; age: byte; end; var Form10: TForm10; customer: TCustomer; implementation uses Unit11; {$R *.dfm} procedure TForm10.Button1Click(Sender: TObject); begin if TForm11.Execute(customer) then begin MessageDlg('customer.Name = ' + customer.name, mtInformation, [mbOK], 0); MessageDlg('customer.Age = ' + IntToStr(customer.age), mtInformation, [mbOK], 0); end; end; Oh well, it was worth a try. 🙂 Ian
  2. Ian Branch

    Call to create a form to return a value?

    Duly noted and amended. Tks again Alexander. Ian
  3. Ian Branch

    Call to create a form to return a value?

    Hi Alexander, OK. If I remove the Close in the procedure TCurrentCustJobsForm.btnSelectClick(Sender: TObject); Then it works OK. After some playing around I ended up with the following.. In CurrentCustJobsForm: procedure TCurrentCustJobsForm.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; end; No Select or Close button action. Select has ModalResult of mrOk & Close button has mrClose. In the calling form I have.. procedure TJobTicketsForm.ShowallJTsforthecurrentJTCustomer1Click(Sender: TObject); var iRecord: Integer; begin if TCurrentCustJobsForm.Execute(iRecord) then if iRecord <> 0 then dmC.JobTickets.Locate('JobNo', iRecord, []); end; All good now. I learnt some things about various interactions here. Regards & Tks, Ian
  4. Ian Branch

    Call to create a form to return a value?

    Hi Alexander, It sure is. This is the action on click. procedure TCurrentCustJobsForm.btnSelectClick(Sender: TObject); begin // TGlobalData.mivJobTicketNumber := CVJobTicketsJobNo.AsInteger; // CVJobTickets.Close; // CVCustomers.Close; Close; end; procedure TCurrentCustJobsForm.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; end; Ian
  5. Ian Branch

    Call to create a form to return a value?

    No sooner sent than I realise that Result := IsPositiveResult(F.ShowModal); is returning an unexpected False result. :-( Investigating.
  6. Ian Branch

    Call to create a form to return a value?

    Hi Alexander, That looks exactly like what I am after. I have implemented as follows.. In the CurrentCustJobForm: procedure FormCreate(Sender: TObject); procedure FormShow(Sender: TObject); procedure btnSelectClick(Sender: TObject); private { Private declarations } public { Public declarations } class function Execute(out Value: Integer): Boolean; end; var CurrentCustJobsForm: TCurrentCustJobsForm; implementation uses JobticketsFrm, GlobalData; {$R *.dfm} class function TCurrentCustJobsForm.Execute(out Value: Integer): Boolean; var F: TCurrentCustJobsForm; begin F := TCurrentCustJobsForm.Create(nil); try Result := IsPositiveResult(F.ShowModal); if Result then Value := F.CVJobTicketsJobNo.AsInteger; finally F.Free; end; end; In the calling Form: procedure TJobTicketsForm.ShowallJTsforthecurrentJTCustomer1Click(Sender: TObject); var iRecord: Integer; begin // TCurrentCustJobsForm.Create(Nil).ShowModal; // if TGlobalData.mivJobTicketNumber <> 0 then dmC.JobTickets.Locate('JobNo', TGlobalData.mivJobTicketNumber, []); if TCurrentCustJobsForm.Execute(iRecord) then dmC.JobTickets.Locate('JobNo', iRecord, []); MessageDlg('iRecord = ' + IntToStr(iRecord), mtInformation, [mbOK], 0); end; I am always getting iRecord as 0. I have obviously done something wrong. 😞 Thoughts? Regards & TIA, Ian
  7. Ian Branch

    Delete a Registry Key...

    Thanks Uwe, appreciated. Ian
  8. Ian Branch

    Delete a Registry Key...

    Yep. Screwed it up. How do you get the individual quote sections into the reply please?
  9. Ian Branch

    Delete a Registry Key...

    OK first try at quoting and I may screw it up. I abbreviated the path for the snippet. "HKCU\Software" - You are correct and I will ammend it. Function return, - Probably should have. This is what I found.
  10. Ian Branch

    Delete a Registry Key...

    Hi David, Feel free to point out the error of my ways. I used to be perfect, now I'm not so sure. ;-) I have been lead astray by the ClearKey function above being called immediately after the JobTicket Form Modal Show from within the Menu call. I separated it out and called the routine separately and it works. With all the key data there. Yes, I know, back to front but I had every expectation it would work. :-( Thanks for your input and gentle prompt. :-) Regards, Ian
  11. Ian Branch

    Delete a Registry Key...

    Hi David, No. It is holding a set of string properties from a Grid. See picture. As you can see I simplified the above code. Somehow I got two pictures in here. 😞 Ian
  12. Ian Branch

    With's the deal with "With"?

    Hi Team, As a simpleton in the Dephi language world I find 'with' handy for single level application. I did try it with nested withs at one stage and ended up in some angst so I don't do nested with anymore. Just my 2c worth. Ian
  13. Ian Branch

    Scope of a HotKey??

    Hi Team, D10.3.2 not that it probably makes any difference. If I have two Apps with the same HotKey but doing different things, it is only the first App loaded that the HotKey works for, doesn't matter if the second App has focus or not. 😞 So - Two questions... 1. Is there any way to make a HotKey effective only for the App in focus? 2. If an App has several forms, is there any way to have the HotKey work for only the form in focus? Regrettably my suspicion in both cases is No, It's a Windows thing, however I am ready, willing and able to be pleasantly surprised. 😉 Regards & TIA, Ian
  14. Ian Branch

    Scope of a HotKey??

    Hi Remy, Tom, As I suspected, and Remy so eloquently expressed, I am SOL. This came to light in my own testing when I implemented a HotKey in the App, went to test it and my AV popped up. WTH! The Apps themselves use many HotKeys. Perhaps I need to move them to a Menu/Submenu scenario. Will think on it. Thanks to you both for your inputs. Regards, Ian
  15. Ian Branch

    Scope of a HotKey??

    Hi Remy, Thanks for your input. >> you will have to resort to using a global keyboard hook and handle the keystrokes manually. Not my area of expertise I'm afraid. Can you point me to some examples pls? Regards, Ian
  16. Ian Branch

    Report components: good, bad, ugly

    Report Builder by Digital Metaphors.
  17. Ian Branch

    MMX 15 (Beta) Available

    Hi Uwe, Hmmm. I'm not aware of changing any fonts. What should the standard font be for the editor? It was set with 'Determine Line height at startup' checked. I unchecked it and changed the Line height correction to 0 and was still one down, so I changed it to -1 and it became one up, :-( I think I shall just turn 'Display cursor position indicator off. FYI - I am running D10.3.2, Windows 10, 1920 x 1080 screen. Regards, Ian
  18. Ian Branch

    MMX 15 (Beta) Available

    Hi Uwe, Haven't played with MMX much although I have had it for a long time. I recently updated to D10.3.2 and just loaded the MMX Beta you just posted . I hadn't noticed it previously, but I see an additional line cursor moving with my editing cursor. See picture attached. What's the story with the dislocation between the editing cursor and the mmx cursor? Regards & TIA, Ian
  19. Ian Branch

    Successful Update to D10.3.2.

    Hi Guys, Just like to throw in a positive note. We seem quick to criticize but slow to recognize. !@#$%^& Yankee spelling.... I just updated from 10.3.1 to 10.3.2 using the web update and had absolutely no issues. Obviously some of the 3rd party libraries had to be updated also but all went smoothly. Regards, Ian
  20. Ian Branch

    Delphi Memory Managers?

    Hi Guys, This might be one of those personal preference things... Does anybody have any view on using the built in (Delphi Rio) memory manager v using FastMM4 or ScaleMM2? Or any other 3rd Party Delphi Memory manager for that matter? I use EurekaLog for error trapping so I don't need/use that functionality from FastMM4 per se. Thoughts, preferences. reasons? Regards, Ian
  21. Ian Branch

    Restart the same App?

    Hi Team, I want to give the User of an App the ability to click on a button or a menu selection that will cause the app to close and restart. Can this be done? Thoughts/suggestions appreciated. Regards & TIA, Ian
  22. Hi Team, I have some SMTP email routines however I want to be able to check/confirm the ISPs smtp server is available before attempting to send the email. Thoughts/suggestions appreciated. Regards & TIA, Ian
  23. Ian Branch

    E2161 Warning: Duplicate resource

    Hi Team, Pulled up an old App renamed it and re-built it in D2007. I get the following Messages.. >> [DCC Error] E2161 Warning: Duplicate resource: Type 16 (VERSIONINFO), ID 1; File E:\DBiWorkflow D2007 Development\DBiManager\DBiManager.res resource kept; file E:\DBiWorkflow D2007 Development\DBiManager\verinfo.res resource discarded. >> [DCC Error] E2161 Warning: Duplicate resource: Type 24 (user-defined), ID 1; File E:\DBiWorkflow D2007 Development\DBiManager\DBiManager.res resource kept; file E:\DBiWorkflow D2007 Development\DBiManager\verinfo.res resource discarded. DBiWorkflow is the new name of the App. Never come across this before. What is the appropriate action to eliminate this warning pls? Where do I find reference to DBiWorkflow.res and verinfo.res in the project files? Is it any real concern? I note Delphi says after this that the "Project compilation failed" however it is actually there and runs as expected. Regards & TIA, Ian
  24. Ian Branch

    E2161 Warning: Duplicate resource

    Hi Team, Great minds..... I found it. It was in one of the source files. {$R verinfo.res} I took it out. Guess what? The file size jumped by about 500k. What the!!! Anyway, the duplicate warning is now gone. Regards, Ian
  25. Ian Branch

    E2161 Warning: Duplicate resource

    Thanks Peter, There is only a {$R *.res} in the project file so I guess it is coming from one of the 3rd Party libraries. It doesn't seem to affect the App at all although the 'Project compilation failed. message was disconcerting until I realized it was in fact built. Something to just put up with I guess. Regards & Tks again, Ian
×