Jump to content

PeterBelow

Members
  • Content Count

    460
  • Joined

  • Last visited

  • Days Won

    13

Posts posted by PeterBelow


  1. 7 hours ago, dwrbudr said:

    They say "Operating System Requirements", if it is not a requirement then why bother to write it at all.

    Basically legalese I think. They guarantee it will run on the platform mentioned but you can probably run on older platforms, but on your own risk.


  2. 18 hours ago, XanderHunt said:

    VCL, 10, standard out of the box style (Windows).  I don't have the custom styles turned on.

    Weird, I just tried with a simple VCL test project on my system and do not see any fade effect when changing the item index on a combobox having the focus, neither with csDropdown nor with csDropdownlist style. Tried with both D11.1 and 10.4. Win10 basically with default display options, main monitor, scaling 100%.


  3. 15 hours ago, XanderHunt said:

    I'm creating a brand new app with the CE version of Embarcadero Delphi 10.4.2.  I'm a bit annoyed that when I have a speed button update a combobox itemindex the combobox fades text in and out.  It's "eye candy" of the worse kind, and I'm talking worse than the mouth puckering sour candies, and I LOVE those!  What can I do to disable all those fade effects?

     

    VCL or FMX? Windows 10 or 11? Standard Windows style or some other style?


  4. 10 hours ago, Marty001 said:

    I have an XML file produced by Media Companion for a movie, I have used the Data Binding wizard to produce a schema from a dtd file.  I can retrieve almost all the details from the file except when there is a list.
     

    
     <uniqueid type="tmdb">745272</uniqueid>
     <uniqueid type="imdb" default="true">tt13095604</uniqueid>

    How do I retreive the value for uniqueid>imdb I cannot find any assistance via google that explains this situation.  Or am I missing something really simple

    I have attached the files 
    The Phenomenon (2020).nfo is the XML file
    cm_movieinfo.dtd is the Document Schema
    cm_movieinfo.xdb is the generated Delphi Data Binding Unit.

    cm_movieinfo.dtd

    The Phenomenon (2020).nfo

    cm_movieinfo.xdb

    If you use the LoadMovie function in the code unit generated by the wizard you get an IXMLMovieType interface back. Its Uniqueid property returns an interface of type IXMLUniqueidTypeList, which derives from IXMLNodeCollection, so it represents a list of nodes (represented by IXMLUniqueidType interfaces), accessed via the Items property. The list interface inherits a Count property from IXMLNodeCollection, so you can write a classical for loop to iterate over the Items property to examine each of the UniqueId nodes, to find the one with the Type_ property you are looking for (note the underscore added to the property name by the wizard, to avoid a collision with the reserved word type).


  5. 2 hours ago, Denis Dresse said:

    Thanks for this links,

    but it do not adress the TRichEdit.SelText problematic, which transforms the "Courier New" font, when some special characters are given to SelText (ex : ═  alt 205 et ─ alt 196...)

    Denis

    Have you tried to use the correct UTF16 code points instead, e.g. #$2012 etc.? Check the proper codes to use in the Windows Charmap application.


  6. 21 hours ago, Denis Dresse said:

    Hello,

    Have you a link to the specs/docs of this new version of rich edit common control (4.x) ?

    https://docwiki.embarcadero.com/Libraries/Alexandria/en/Vcl.ComCtrls.TRichEdit

    https://docwiki.embarcadero.com/RADStudio/Alexandria/en/What's_New#TRichEdit_Component_updated_to_RichEdit_4.1_.28MSFTEDIT.dll.29

     

    There are new events, e.g. OnLinkClick and extensions to the TTextAttribute type used by SelAttributes.


  7. 14 hours ago, Ralf7 said:

    You're in hell if you install a Delphi more than once. Tons of registry entries and file fragments are left on the PC, confusing the installer. The strangest error messages are appear. Never install a trial or CE on the productive PC. You can never get rid of it. Unless you do a Windows reinstall.

    Oh come on, it's not that bad. There are even instructions on how to manually clean up after an uninstall in several blog posts on the emba site, e. g. https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwi8r9iV0un5AhVC7rsIHTWvAQ0QFnoECAQQAw&url=https%3A%2F%2Fblogs.embarcadero.com%2Fmanual-uninstall-of-rad-studio-delphi-c-builder-10-2%2F&usg=AOvVaw0wqOftotNG03B76ft4LoXa


  8. 2 hours ago, dummzeuch said:

    Pressing Win+Left will dock the current window to the left edge of the current monitor.

    How can do that from code?

    I tried to set the form bounds, in particular Left to 0 but that leaves a gap of about 7 pixels. Setting it to -7 still leaves that gap.

     

    My Google fu has left me (again). All I can find is how to use the keyboard combination for that.

    Couldn't you just set the ScreenSnap property to true to allow the user to snap the form to a screen edge?


  9. 1 hour ago, Denis Dresse said:

    Hello,

    We just installed the Delphi 11.1.

    But there is a problem with the TRichEdit.

    When we add a line including formatting characters as "alt 205" or "alt179" or "alt196", with the "Courier New" font, then the police changes to an other police (Segoe UI Symbol) and the result is ugly.

    We uses the following instruction for adding this line : myRichEdit.SelText := myString.

    This way of reporting was used for years without problem in many places of our application.

    Is it a documented bug, are there any turnarounds ?

     

    Are you setting up SelAttributes correctly before assigning text to SelText? D11.1 uses a newer version of the rich edit common control (4.x), which has more capabilities than the old 2.x version used by prior Delphi versions.

    • Like 1

  10. Well, closing the main form ends up calling Application.Terminate, which results in a WM_QUIT message posted to the message loop. The reaction to that is to set Application.Terminated to true and fall out of the message loop in Application.Run. After that the Application object proceeds to free all forms and datamodules it ownes in the inverse order of creation.

    Things are unfortunately not always so clear, though. If a modal form is open it uses its own message loop, which also ends and causes ShowModal to return as if the user cancelled the dialog. Code in the calling method will execute after that until the code flow returns to the main message loop.

    A further complication are unowned forms. They will get destroyed after the owned forms when the main form window handle is destroyed, as far as I remember, by Windows, since the main form is the API-level owner of all secondary forms. Unowned Forms disconnected from the main form by overriding CreateParams will die last (unless explicitely closed in code executed when another form is destroyed), when the process dies. This usually does not give the form any chance to clean up after itself.

    So, if you need to have all forms die in an orderly manner you are best served by iterating over Screen.Forms and close each form found explicitely, with the main form last.


  11. Whether this works or not depends on the source image format. TPngImage does not support direct assignment from a TJpegImage, for example. In such a case you have to go through a TBitmap as intermediate.

    procedure TForm1.Button1Click(Sender: TObject);
    var
      png: TPngImage;
      bmp: TBitmap;
    begin
      image1.Picture.LoadFromFile('C:\Users\Peter_2\Pictures\7.5. Stadtführung.jpg');
      bmp:= TBitmap.Create;
      try
        bmp.Assign(Image1.Picture.Graphic);
        png:= TPngImage.Create;
        try
          png.Assign(bmp);
          png.SaveToFile('C:\Users\Peter_2\Pictures\test.png');
          bmp.SaveToFile('C:\Users\Peter_2\Pictures\test.bmp');
        finally
          png.Free;
        end;
      finally
        bmp.Free;
      end;
      ShowMessage('Done');
    end;
    
    

     

    • Like 1

  12. 17 hours ago, karl Jonson said:

    I have a DBEdit linked to a integer-field in a table & everything works fine but now I'd like to allow user to enter many integers separated by commas in the DBEdit.
    So when user types 1,2,3 three records are inserted in the table & without the posting failing.
    How can I achieve this ?
    TIA

    Not with a TDBEdit. Databound controls are typically linked to one single record (the  current record in the dataset); using them the typical workflow is: add new record - enter data for this record - post the record to the dataset.

     

    You have to use an unbound TEdit in your case and dissect its content in code, e.g. when the user leaves the control (OnExit event), or when he pushes a button.

     

    Pseudo code:

    var
      LList: TStringlist;
      N, LValue: integer;
    begin
      LList := TStringlist.Create;
      try
        LList.StrictDelimiter := True;
        LList.Commatext := Edit1.Text;
        for N:= 0 to LLIst.Count - 1 do begin
          if TryStrToInt(Trim(LList[N]), LValue) then begin
            add record to dataset
            store LValue into the dataset field
            post the record 
          end; {if} 
        end; {for}
      finally
        LList.Free;
      end;
    end;    

     

    • Like 1

  13. For database BLOB fields you generally cannot use a generic TStream, you need to ask the BLOB field to create a TBlobStream descendant specific for the database engine in question. In your case you first create the blob stream for the local database, store the field content in it, the create a blob stream for the server database, copy the content of the first stream to it, then load the contents into the server db field.


  14. 1 hour ago, Damon said:

    On the multiple monitor front as well, why does the ide insist on always moving the debug application and itself back to monitor 1 every time you run?

    The IDE uses separate layouts/desktops for editing and debugging. You have to adjust the debug layout to your requirements, save it under a name of your own, and then make that the default debug layout.

    • Like 2

  15. 3 hours ago, RDP1974 said:

    hi,

    do you know if https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Generics.Collections.TDictionary.Remove

    remove method will dispose an inserted record automatically?

    Records are value types, so adding a record to a TDictionary<recordtype> adds a copy of the record to the internal storage, and Remove then clears up that copies memory. So there are no leaks, but adding a record and getting it back later always makes a full copy of the record, which can be a bit hard on performance.

    • Like 2

  16. 18 hours ago, CoMPi74 said:

    Hi there,


    I am looking for the IDE's (or a third party add-on's) option which auto sets the editor in a readonly mode when opening a file from search path. I remember that years ago I was using such an option but now I can not find it again. Any ideas?

     

    Piotr

    In my opinion source files you want to protect from modification should be located in a folder tree the user you are working with does not have write access to. Don't use an admin account to work in the IDE!


  17. 15 hours ago, Stano said:

    Cannot load package 'JasotComponents.'  It contains unit 'DAScript', which is also contained in package 'dac280'

    I don't understand this message.

    It means that the JasotComponents package has DAScript listed in its "contains" clause while also listing dac280 in the "requires" clause. You have to remove the unit from the "contains" clause. In a package collection (packages that depend on others in the collection) each unit can only be contained in one single package. Complex package collections can drive you berserk if you have to build them manually, without a manufacturer-supplied build script. :classic_cool:


  18. 5 hours ago, Stano said:

    Well thank you. I haven't made a runtime package yet. I'll look into it. Won't it yell at me that it already has it in the search path?
    It doesn't make sense to me: he linked the files and the compilation fails. I don't have any (other) mistakes there.

    If the dcp file for the package is there and in the search path you just have to add that package to the requires clause of the design-time package, that should eliminate all these warnings.


  19. 18 hours ago, Stano said:

    Hi,
    It's a DB navigator and I want to deploy IBDAC there instead of FireDAC. I have about 30 similar lines. 

    [dcc32 Warning] JasotComponents.dpk(73): W1033 Unit 'IBCProps' implicitly imported into package 'JasotComponents' 

    Compilation will fail.
    Tried to add some *.dcp file. I got a notification that it is already in the search path.
    I do not know what to do.

    Well, the warning means that the unit in question was not found in any of the packages named in the "requires" clause and, since it was not in the "contains" clause of the package, had to be added to build the package.  This is not in itself an error and will not cause the build to fail, but it is an indication that there should be a run-time package available which contains the unit and should be added to the design-time packages "requires" clause.  You may have to build that run-time package first, though.

     

     


  20. 2 hours ago, karl Jonson said:

    Hi,
    Does anyone have a working logic for Tlistview with checkboxes where a user can multi select options similar to these:
    None
    Not Known
    OptionOne
    OptionTwo

     

    Thanks

     

     

    unit TestbedU1;
    
    interface
    
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, System.Classes,
      Vcl.ComCtrls;
    
    type
      TForm1 = class(TForm)
        ViewButton: TButton;
        Edit1: TEdit;
        ListView1: TListView;
        Memo1: TMemo;
        CheckButton: TButton;
        UncheckButton: TButton;
        procedure CheckButtonClick(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure UncheckButtonClick(Sender: TObject);
        procedure ViewButtonClick(Sender: TObject);
      strict private
        procedure SetCheckstate(aListview: TListView; Value: Boolean);
      private
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    {$R *.dfm}
    procedure TForm1.CheckButtonClick(Sender: TObject);
    begin
      SetCheckstate(listview1, true);
    end;
    
    procedure TForm1.FormCreate(Sender: TObject);
    const
      ColCaptions: array [0..3] of string = (
        'Zero','One','Two','Three');
    var
      I: Integer;
      LCol: TListColumn;
      LItem: TListItem;
      N: Integer;
    begin
      memo1.Clear;
      listview1.ViewStyle := vsReport;
      listview1.Checkboxes := true;
      listview1.MultiSelect := true;
      for I := 0 to 3 do begin
        LCol:= listview1.Columns.Add;
        LCol.Caption := ColCaptions[I];
        LCol.AutoSize := true;
      end;
      for I := 1 to 5 do begin
        LItem:= listview1.Items.Add;
        LItem.Caption := Format('Item %d',[I]);
        for N := 1 to 3 do
          LItem.SubItems.Add(Format('Item %d%d',[I, N]));
      end;
    end;
    
    procedure TForm1.ViewButtonClick(Sender: TObject);
    const
      State: array [boolean] of string = ('not','');
    var
      I: Integer;
      LItem: TListItem;
    begin
      for I := 0 to listview1.items.count-1 do begin
        LItem:= ListView1.Items[I];
        memo1.Lines.Add(
          Format( 'Item %d is %s checked.', [Succ(I), State[LItem.Checked]])
          );
      end;
    end;
    
    procedure TForm1.SetCheckstate(aListview: TListView; Value: Boolean);
    var
      I: Integer;
      LItem: TListItem;
    begin
      for I := 0 to listview1.items.count-1 do begin
        LItem:= ListView1.Items[I];
        if LItem.Selected then
           LItem.Checked := Value;
      end;
    end;
    
    procedure TForm1.UncheckButtonClick(Sender: TObject);
    begin
      SetCheckstate(listview1, false);
    end;
    
    end.

     

    TestbedU1.dfm

    TestbedU1.pas


  21. When you deverlop a custom component it is a good idea to use a test project first in which you create an instance of the component in code. This allows you to debug the run-time behaviour of the component without endangering the IDE itself. Only when everything works as it should do you add it to a design-time package and install it, to validate the design-time behaviour. If you need to add a custom property or class editor these can also be developed and tested in the test project, by just doing what the IDE designer does for invoking them. I don't remember the details since it has been literally decades since I last needed to do this, but it can be done.

    • Like 1

  22. 12 hours ago, abdellahmehdi said:

    When I open a project, this problem appears.

     

     

    The  error message suggests that a component on one of the autocreated forms has not been created yet when some other component tries to refer to it when the IDE designer loads the form. This may be a sequence problem. Try to change the autocreation sequence to create the datamodule before the forms.

    • Thanks 1
×