Jump to content

PeterBelow

Members
  • Content Count

    463
  • Joined

  • Last visited

  • Days Won

    13

Everything posted by PeterBelow

  1. You need to find the database component used for the connection to the database. It may reside in a data module autocreated at program start, so start by opening the dpr file (project -> view source) and check the first Application.CreateForm statements. Open the datamodules one by one and look for a component with "connection" in its type. For FireDAC that would be a TFDConnection component, which has a LoginPrompt property, which is probably set to true in your case. You can set it to false and specify user and password in the Params property to avoid the dialog. Details depend on the database access framework your app uses.
  2. This is a Delphi form using TBitBtns, so it has to come from somewhere inside your application. But it may come from some library you use, e.g. a database login build into the data access framework the app uses.
  3. PeterBelow

    Can't make a popup form go behind the main form in z-order

    In Delphi the main form (the one created first by an Application.CreateForm statement in the DPR file) is the API owner of all forms created later, so it is lower in the Z-order. It is also the only form having a taskbar button. Lazarus seems to behave like old Delphi versions (before Windows Vista), where the zero-size Application window was the API owner of all forms and owned the taskbar button. This made all forms siblings in the Z order and allowed any form to be covered by the main form. You can get this behaviour back in Delphi by setting Application.MainformOnTaskbar := false; in the DPR file, but that is not recommended since it does not work well with the taskbar in modern Windows versions. If you really need to you can uncouple a form from the main form in Z-order by overriding its CreateParams method. // in form declaration Procedure CreateParams( Var params: TCreateParams ); override; Procedure TFormX.CreateParams( Var params: TCreateParams ); begin inherited CreateParams( params ); params.wndParent := 0; //or Application.Handle // the following gives the form its own taskbar button params.ExStyle := params.ExStyle or WS_EX_APPWINDOW; end;
  4. PeterBelow

    The Delphi 11.2 release thread

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

    Disable fade effects

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

    Disable fade effects

    VCL or FMX? Windows 10 or 11? Standard Windows style or some other style?
  7. PeterBelow

    Data Binding retreiving data from list

    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).
  8. 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.
  9. 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.
  10. 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
  11. PeterBelow

    How can I move a window to the left edge of a monitor?

    Couldn't you just set the ScreenSnap property to true to allow the user to snap the form to a screen edge?
  12. 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.
  13. PeterBelow

    need help to change the hex in binary file

    Looks like an attempt to hack a program to get around a security feature; you will get no help here for such (likely illegal) activity. It won't work anyway, if you modify a signed executable it will no longer match the signature and the OS will not load it.
  14. PeterBelow

    Form closing - curiosity question..

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

    Save Timage picture as png

    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;
  16. PeterBelow

    comma separated values in DBEdit

    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;
  17. I get no exception using D11.1 with this code.
  18. PeterBelow

    Write blob field to database from client

    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.
  19. 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.
  20. PeterBelow

    TDICTIONARY

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

    Auto Readonly mode for files on search path

    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!
  22. PeterBelow

    Custom component with IBDAC

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

    Custom component with IBDAC

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

    Custom component with IBDAC

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

    TListView with check boxes

    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
×