Jump to content

ewong

Members
  • Content Count

    28
  • Joined

  • Last visited

Posts posted by ewong


  1. Hi,

     

    I'm using Delphi Pro 10.3 and am trying to set up a test program that can access a MongoDB server.   I know that MongoDB is supported; but I'm confused why I see the FireDAC sample; but can't use it.  I don't have FireDAC.Phys.MongoDB (and other items).

     

    I read

    and it seems as if Delphi Pro does have access to FireDAC's Mongo drivers.  Mind you, the linked post is about 11.1 Delphi.    So does 10.3 Pro have no access to MongoDB, or did I screwup the install of 10.3?  Or is it only available to 11.1+?

     

    Any clarifications appreciated.

     

    Thanks

     

    Ed


  2. Hi,

     

    Having finally gotten a new computer, I installed Delphi 12.0 and am in the process of installing my other packages.  I installed BDEInstall for Delphi 12.0, but I am having trouble finding the BDE components. Now thinking about it, I suspect the BDEInstall for 12.0 *isn't* the BDE components install but the BDEAdmin install.

     

    I searched the web and came across a Delphi-Praxis link that states the BDE Components can be found in my.embarcadero.com.  I don't see the BDEComp install anywhere.

     

    Can someone clarify where it is?   I even searched https://cc.embarcadero.com/results.aspx?keywords=bde  but getting Gateway timeout errors.

     

    Thanks

     

    Ed

     


  3. 9 hours ago, programmerdelphi2k said:

    all software that somehow made use of Paradox tables, like: Corel Office, Word Perfect, Quatro Pro, etc...
    So, you could initially try using your system on another computer and then install your DBase III Plus to see the result! If so, then your case is confirmed!
    Solution: There should only be one BDE installed on your computer!
    Normally, the latest version of the BDE (the installation) should work for your DBase III Plus too! If they use different directories for the BDE DLLs, then, it could be a separate problem!!!

     

    did you try to put the dll's in the same folder as your executable

    I don't know if you'd believe this but I actually 'solved' (I think) my problem by going into the registry and taking a look at which

    path was used.  As I had already a BDE installed before and installing the 10.3 BDE added a new Borland Shared in my Program Files directory.

     

    I went to HKLM\Software\Winw6432Node\Borland\Database Engine, and noticed that CONFIGFILE01 key was pointing to

    c:\ProgramData\Common Files\Borland\BDE\IDAPI.CFG, whereas DLLPATH was c:\program files (x86)\Common Files\Borland Shared\BDE.

     

    I removed the "Shared" and now both 10.2 and 10.3  can run.   Planning to remove the Borland Shared directory in a bit after a bit

    of testing.

     

    Thanks

     

    Ed

     

    • Like 2

  4. Hi,

     

    I had to dig up an old XE project that required to access a DBF file.  After installing the BDE installer for 10.3,

    and running the program, I came across the error $210C.  According to [1], it means that 10.3 is picking

    up multiple versions of IDAPI32.dll.  Since I also have dBasePlus installed, I probably do have multiple

    idapi32.dll.  

     

    Is it possible to tell 10.3 to use a specific IDAPI32.dll file?

     

    Thanks

     

    Edmund

     

    [1] - http://www.delphigroups.info/2/08/355066.html

     


  5. In hindsight and as an anecdotal instance of losing the plot, I just realized I could have just setup a popup menu and be done with it.  ;/

     

    That said,  I have learnt a bit more so that wasn't a total waste. 😜

     

    Edmund


  6. 14 minutes ago, Remy Lebeau said:

    Makes sense. You didn't put TCustDBGrid into a package and install it into the IDE, so you can't use TCustDBGrid in a DFM resource, unless you call RegisterClass(TCustDBGrid) before the DFM is loaded when the TForm object is created.

    Because you are trying to actually call TForm1's inherited MouseDown() method and then assign its result to the event.  Use this instead:

    
    unit Unit1;
    
    interface
    
    uses
      ..., Vcl.DBGrid, ...;
    
    type
      TDBGrid = class(Vcl.DBGrid.TDBGrid)
      protected
        procedure MouseDown(Sender: TObject; Button: TMouseButton; ShiftState: TShiftState; X, Y: Integer); override;
      end;
    
      TForm1 = class(TForm)
        ...
        recentinfo: TDBGrid;
        ..
      end;
    
    implementation
    
    procedure TDBGrid.MouseDown(Sender: TObject; Button: TMouseButton; ShiftState: TShiftState; X, Y: integer);
    begin
      if Button = mbRight then
        ShowMessage("testing");
      inherited;
    end;

    No, because you are not registering the TCustDBGrid class with the DFM streaming system.

     

    In hindsight, I think that's what's making me confused.   That said, I've found an indirect way in accordance to [3].

     

    TCustDBGrid = class(TDBGrid)
     protected
       procedure MouseDown(Sender: TObject; Button: TMouseButton;
                           ShiftState: TShiftState; X, Y: Integer);
    end;
    
    TForm1 = class(TForm)
     ...
      recentinfo: TDBGrid;
     ..
     protected
       procedure FindComponentClass(Reader: TReader; const ClassName: string;
                                        var ComponentClass: TComponentClass);
       Procedure ReadState(Reader: TReader); override
    end;
    
    procedure TCustDBGrid.MouseDown(Sender: TObject; Button: TMouseButton;
                                    ShiftState: TShiftState; X, Y: Integer);
    begin
      if (name = 'recentinfo') and (button = mbRight) then
      begin
        ShowMessage('testing');
      end
      else
        inherited;
    end;
    
    procedure TForm1.FindComponentClass(Reader: TReader; const ClassName: string;
                                        var ComponentClass: TComponentClass);
    var
      i : integer;
      s : string;
      ts : TComponent;
    
    begin
      if ComponentClass = TDBGrid then
      begin
        ComponentClass := TCustDBGrid;
      end
    end;
    
    procedure TForm1.ReadState(Reader: TReader);
    begin
      Reader.OnFindComponentClass := FindComponentClass;
      inherited;
    end;
    

    The above 'hack' worked.   At first I had tried to find the associated ComponentClass' instance name; only to have it dawn on me that it's just finding the component class.  It hadn't instantiated the component yet so no instance exists.   Then I just gave up and had all the DBGrids to be changed to TCustDBGrid on the fly and then use the TCustDBGrid mousedown dispatcher to run when the right instance is referenced.

     

    Thanks!

     

    Edmund


  7. 13 hours ago, joachimd said:

    what does Delphi complain? Component not found? What about placing your grid to the form? Same error? Probably only a path issue.

    If it's just the MouseDown not working: use override as explained in Günther's  post.

    I used the same technique multiple times.

    Delphi complains that it can't find "TCustDBGrid".

     

    So what I have is:

    TCustDBGrid = class(TDBGrid)
    protected
      procedure MouseDown(Sender: TObject; Button: TMouseButton; ShiftState: TShiftState; X, Y :integer);
    end;
    
    TForm1 = class(TForm)
      ..
      recentinfo: TDBGrid;
     ..
    
    end;
    
    implementation
    procedure TCustDBGrid.MouseDown(Sender: TObject; Button: TMouseButton; ShiftState: TShiftState; X, Y: integer);
    begin
      if button = mbRight then
        showmessage("testing");
    end;

     

    From [1], I tried:

    constructor TForm1.create;
    begin
       recentinfo.onMouseDown = MouseDown;
    end;

    This didn't work as it's complaining that there's not enough parameters.

     

    Then I tried (as mentioned above) changing in the dfm text to change "recentinfo: TDBGrid;" into "recentinfo: TCustDBGrid".  Since the definition of TCustDBGrid is in the same unit as the tform, I figured it would work.  I'm guessing it's wrong thinking this way as what I'm doing is in essence using a visible component which uses a different set of rules than simple "TpointX = class(TPoint)" type of definition.

     

    If I just click on the grid, and create an event handler for "OnMouseDown",  as mentioned in [2], it doesn't work as it fires only if I click on the headers.

     

    Then I came across [3] and while I think it should work,  I haven't yet found out how to find out whether the componentclass' instance is what I wanted.

     

    Tbh, it would've been just simpler had I made this custom dbgrid as a package and be done with it; but I feel there has to be a way other than the package route.

     

    Thanks

     

    Edmund

     

    [1] - http://www.delphigroups.info/2/2f/507785.html

    [2] - http://www.delphigroups.info/2/4a/305663.html

    [3] - https://stackoverflow.com/questions/4685863/replacing-a-component-class-in-delphi/4686920#4686920


  8. 1 hour ago, Dany Marmur said:

    You do not have to do anything to your dfm.

    To use OO like that use the same classname, qualify the ancestor with it's unit.

    https://zarko-gajic.iz.hr/delphi-interceptor-classes-tbutton-classtbutton/

     

     

    Or ... create a package with TMyDBGrid,install into the IDE and drop your TMyDBGrid on forms.

     

    HTH

     

    /D

    Hi Dany,

     

    The first option isn't going to work as that'll affect other dbgrids. 

     

    So I guess I'll need to use the second option even though it's a bit overkill for just this.  I'm very surprised that

    even with TCustDBGrid defined within the same unit as the form,   the dfm processing can't see that. 

     

    Thanks

     

    Ed


  9. Hi,

    I have added a DBGrid control on a form, and after fiddling with it, I realized I needed to override the MouseDown event.  So I added a new Custom control and following the idea of  http://www.delphigroups.info/2/f8/90624.html I thought changing the Text from  MyGrid: TDBGrid to MyGrid: TCustDBGrid would work; but Delphi complains.  If I click on ignore, it deletes the db control.    If I have included the following code in the same unit as the form:

     

      TCustomDBGrid = class(TDBGrid)
      protected
        procedure MouseDown(Button: TMouseButton; ShiftState: TShiftState; X, Y: integer);
      end;

    Then if I change the DFM of the MyGrid from:

     

      MyGrid: TDBGrid;

     

    To:

      MyGrid: TCustDBGrid;

     

    It should work; but it doesn't, so I'm guessing I'm getting something wrong.

     

    What's the right way of doing this?

     

    Thanks

     

    Ed


  10. 13 hours ago, Dany Marmur said:

    I, on the other hand, am wondering how things are going for the OP. Did you solve the problem @ewong?

    I took up @Dalija Prasnikar's idea of threads and while the UI isn't hanging,  there's a bunch of dependency control issues.  Like in the thread when I disable the controls,  I realized that I can't (by design) navigate a grid which depends on a dataset which had disablecontrol set.

    I'm now wondering if it makes sense two have two datasets.  One which is linked to a grid, the other not linked to any control so that the thread can use that non-linked dataset leaving the grid-linked dataset available for use.

     

    But as it stands, it's a definite improvement but like all things I don't understand (threads), I'll need to read up on it.

     

    Again, Thanks for the help!!  Very much appreciate it.

     


  11. 57 minutes ago, Dalija Prasnikar said:

    Yes, there is. But without code it is impossible to say for sure.

     

    I am guessing that you are doing all that in main thread.

    That I believe I am since I'm not using threads or anything.   I think I'll try using threads and see how things go.

     

    Thanks for the idea!

     

    Edmund


  12. Hi,

     

    I have an application which goes through a dataset (a 13k+ entry table) and grabs info and adds it into a dictionary for

    further use.   Due to the length of the table, I had also created an extra form which is basically just a progress bar.

     

    When I run the app,  the progress bar's position increases.  The problem is when I click on something else within the form.  The application immediately

    hangs (Application Not Responding).   The application is still running though.  After some time, the progress form closes and the data is displayed.

     

    I had thought it was a painting issue; but even adding progressform.repaint to the end of the (while not dataset1.eof do) loop, the application hangs.

     

    Is there a way to find out what part of the code is hanging or why it's hanging? 

     

    Thanks

     

    Ed

     

     


  13. 9 hours ago, Remy Lebeau said:

    That being said, Indy already implements a decoder for RFC2047-encoded strings, in the DecodeHeader() function of the IdCoderHeader unit, eg:
     

    
    uses
      IdCoderHeader;
    
    procedure TForm1.convertbuttonclick(Sender: TObject);
    var
      s, s2 : string;
    begin
      s := Memo1.Lines[0]; // '=?UTF-8?B?5aaC5L2V6K6TIGFydC1tYXRlIOaIkOeCug==?='
      s2 := DecodeHeader(s);
      Memo2.Text := s2;
    end;

     

    Hi Remy!

     

    That's both short and sweet!  This is much better than the code I had. 

     

    Edmund


  14. Hi,

    I'm using Delphi 10.3.3 and I have two Memo fields on a form and a button.   I copy and paste a RFC2047 utf8 text to the left memo field.  Then I press the button, and the resulting unicode text should be on the right memo field; but I get gibberish. 

     

    procedure TForm1.convertbuttonclick(Sender: TObject);
    var
      use_st,
      s, s2 : string;
      b, q : boolean;
    
    begin
      s := Memo1.lines[0];
      use_st := '?=';
      if pos('=?utf-8?', lowercase(s)) > 0 then
      begin
        s2 := stringreplace(s, '=?utf-8?', '', [rfReplaceAll, rfIgnoreCase]);
        if pos('b?', lowercase(s2)) > 0 then
        begin
          s2 := stringreplace(s2, 'b?', '', [rfReplaceAll, rfIgnoreCase]);
          b := True;
          use_st := '=?=';
        end
        else if pos('q?', lowercase(s2)) > 0 then
        begin
          s2 := stringreplace(s2, 'q?', '', [rfReplaceAll, rfIgnoreCase]);
          q := True;
        end;
      end
      else
        s2 := s;
    
      if pos(use_st, s2) > 0 then
        s2 := stringreplace(s2, use_st, '', [rfReplaceAll, rfIgnoreCase]);
    
      if q then
        s3 := idDecoderQuotedPrintable1.decodestring(s2)
      else if b then
        s3 := idDecoderMime1.decodeString(s2)
      else
        s3 := s2;
    
      memo2.lines.clear;
      memo2.lines.add(s3);
    end;

     

    Say I copy and paste "=?UTF-8?B?5aaC5L2V6K6TIGFydC1tYXRlIOaIkOeCug==?="  to the first memo.  I press the button, and I get

    some string of which only I see "art-mate'.  

     

    Can someone point out what I'm missing?

     

    Thanks

     

    Ed

     

     

     

     


  15. On 3/13/2021 at 12:17 AM, Remy Lebeau said:

    There is some info in this discussion:

     

    As someone on that thread said,  that's brutal.  Very brutal to the amount of information on those forums.  While I am very dismayed at Embarcadero's practice of killing/removing vital helpful information, I'm not surprised.  The forum, while not as useful as the newsgroups, at least provided some avenue of help/information.

     

    Thanks Remy for the info.  At least I'm glad I can still see quite a few old regulars on the newsgroup.  Perhaps Joanne might even appear here? 

     


  16. 8 minutes ago, Achim Kalwa said:

    Watch the grid's indicator column: The current (active) row is marked with a triangle, while selected rows are marked with a dot. If the current row is also a selected row, the indicator shows a dot and a arrow.

     

    You need to make the current row a selected row:

    
    if DBGrid1.SelectedRows.Count = 0 then
        DBGrid1.SelectedRows.CurrentRowSelected := True;

     

     

    I was wondering what the arrow and dot meant.   That clears up that question.

     

    Thanks!


  17. 11 minutes ago, Lajos Juhász said:

    You're trying to show the change on the dbgrid while using an event on the dataSource that's is triggered before the selection. You should display the selected rows from the events of the grid. In this case as the selection can be made by mouse or keyboard you could use the events OnKeyUp and OnMouseUp for the grid:

     

     

     

    That explains what I'm seeing.  Thanks!  I got the OnDataChange idea from Stackoverflow.

     

    Ed

     


  18. To answer my own question, I ended up finding out that for some reasons, the paths for the registry keys at :

    HKCU\Software\Embarcadero\BDS\20.0\Help\HtmlHelp1Files

     

    were all pointing to some non existing directory.   I changed them to reflect where the actual

    help files were located and now I have help.

     

    Thankfully, I had 10.2 installed so just needed to compare the registry info. 

     

    Ed

×