Jump to content

Ian Branch

Members
  • Content Count

    1274
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Ian Branch


  1. 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


  2. Hi Team,

    Given the following call   -    TCurrentCustJobsForm.Create(Nil).ShowModal;

    Can this be made to return a value?  e.g.  iRecord :=   TCurrentCustJobsForm.Create(Nil).ShowModal; 

    I figure if it will work I will have to set & return it somehow in the CurrentCustJobsForm.

    Just hoping.

     

    Regards,

    Ian


  3. 2 hours ago, Remy Lebeau said:

     

    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.

    2 hours ago, Remy Lebeau said:

    Function return, - Probably should have.

    2 hours ago, Remy Lebeau said:

    Despite what the documentation claims, TRegistry.DeleteKey() actually handles this internally for you.  It runs a recursive loop to delete all subkeys before then deleting the requested key.  You don't have to delete them manually (though you probably should so you can perform error handling on each one).  Otherwise, use the Win32 RegDeleteTree() or SHDeleteKey() function instead and let the OS delete all of the subkeys for you.

    This is what I found.


  4. 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

     


  5. Hi Team,

    Not sure what is going on here..  Just about to tear what little hair I have out.

    I am trying to delete a registry key.  Win 10, 64bit, D10.3.2.  32bit App.

    I have the following code..

    procedure TMainForm.ClearKey1Click(Sender: TObject);
    var
      reg: TRegistry;
    begin
      //
        MessageBeep(MB_ICONINFORMATION);
        reg := TRegistry.Create(KEY_WRITE);
        reg.RootKey := HKEY_CURRENT_USER;
    
        reg.DeleteKey('DBiW\DBiW\JTGrid');
    
        reg.CloseKey();
      //
    end;

    It runs without issue/error but does not delete the Key. :-(

    Is this some 64bit gotcha?

    I need it to work in 64 & 32 bit environments.

    Yes, System.Win.Registry is in the Uses list.

    Thoughts/suggestions appreciated.


  6. 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


  7. 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 


  8. 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


  9. 54 minutes ago, Uwe Raabe said:

    This usually happens with non standard fonts and can be adjusted in General - Delphi  Editor - Cursor position indicator - Line Height correction.

    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


  10. 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

     

    Screenshot_4.png


  11. 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

    • Like 7

  12. 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


  13. 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


  14. 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


  15. Hi Schokohase,

    Thank you for the advice on the buttons.  I was afraid of that.

    Philosophical discussion - On the aspect of 'User-friendly' - User-friendly is not what I or Microsoft say it is, it is what the User says it is.  If he/she doesn't like the way it looks or the way it does it, it isn't user-friendly, to them.  Yes, there tomes about the right way to do things however ultimately it is the User that decides.  And ultimately they are the ones paying the Bills. 🙂

     

    Regards,

    Ian

     


  16. Hi Team,

    I want to have the only the Minimize button border icon on the form but it seems I have to have the SystemMenu button on as well. :-(

    Is there any way to just have the minimize button and not the SystemMenu button?

    The form BorderStyle is bsSingle.

    Regards & TIA,

    Ian


  17. Hi Team,

    Perhaps I am looking at this from the wrong perspective.

    The primary issue is the Customers Internet access/availability.  The Customers are based in the Pacific and their Internet/ISPs tend to be a little iffy.

    Yesterday, one of the Customer's Internet access was down for 3 hours. :-(

    I think instead of testing for the smtp server I will simply test for the ability to access the internet with something like this..

    uses
    ...., wininet;
    
    Function CheckUrl(url: string): Boolean;
    var
      hSession, hfile, hRequest: hInternet;
      dwindex, dwcodelen: dword;
      dwcode: array [1 .. 20] of char;
      res: pchar;
    begin
      if pos('http://', lowercase(url)) = 0 then
        url := 'http://' + url;
      Result := False;
      hSession := InternetOpen('InetURL:/1.0', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
      if assigned(hSession) then
      begin
        hfile := InternetOpenUrl(hSession, pchar(url), nil, 0, INTERNET_FLAG_RELOAD, 0);
        dwindex := 0;
        dwcodelen := 10;
        HttpQueryInfo(hfile, HTTP_QUERY_STATUS_CODE, @dwcode, dwcodelen, dwindex);
        res := pchar(@dwcode);
        Result := (res = '200') or (res = '302');
        if assigned(hfile) then
          InternetCloseHandle(hfile);
        InternetCloseHandle(hSession);
      end;
    
    end;

    Just prior to the email creation.

     

    Regards,

    Ian

×