[Solved] reconstructing lost code (InArray) – cont [closed]

Most likely, the function tests if n belongs to the array: function InArray(A: TIntArray; n: Integer): boolean; var i: integer; begin result := false; for i := low(A) to high(A) do if A[i] = n then Exit(true); end; If you are using an old version of Delphi (<2009), you have to do function InArray(A: TIntArray; … Read more

[Solved] Getting XML from response stream using Indy’s IDTCPClient [closed]

hmmmm, turns out it was easier than thought. I simply looked at the GenerateJSON method and said ok, How can I use this method for XML. I then googled MempryStream to String and found this function function StreamToString(aStream: TStream): string; var SS: TStringStream; begin if aStream <> nil then begin SS := TStringStream.Create(”); try SS.CopyFrom(aStream, … Read more

[Solved] How to work on TFDTable(FireDAC) in Delphi XE7?

Well you need to read up on FireDAC generally if you are completely unfamiliar with it, and look at the examples that come with recent versions of Delphi. But if you just want to know how to copy data from a FireDAC dataset that’s connected to a database to an in-memory table, you can do … Read more

[Solved] Changing a resource at runtime?

The API for modifying linked resources is accessed with BeginUpdateResource, UpdateResource and EndUpdateResource. Consult the API documentation on MSDN to learn how to use these functions, and also refer to the example code on MSDN. Including large ZIP file resources in an executable, and frequently modifying them, seems to me like the sort of behaviour … Read more

[Solved] merge paint results in thread bitmap painting

bitblt(Masterbitmap.Canvas.handle, 0, 0, XPixel, YPixel, bitmap.Canvas.handle, 0, 0, srcand); you explicitly called Masterbitmap.Canvas.Lock, however you didn’t call bitmap.Canvas.Lock (so you can loose the canvas handle anytime within this call…) Additionally, you need to consider thread safety within GDI itself: Sharing of any GDI objects between different threads should be avoided at all cost. For example … Read more

[Solved] Focus cells in reverse order for any utility don’t support RTL [closed]

The following code, without an OnKeyUp handler, does what you seem to want type TMyDBGrid = class(TDBGrid); procedure TForm1.DBGrid1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = VK_Tab then begin Key := 0; if ssShift in Shift then DBGrid1.SelectedIndex := DBGrid1.SelectedIndex + 1 else begin if TMyDBGrid(DBGrid1).Col = 1 then begin // The … Read more

[Solved] BDE to ADO conversion in DELPHI 5

… if somehow we can set the database Alias to ADO connection … Just take a look at the source code of Delphi’s BDE and ADO support (in e.g. DBTables.Pas and ADOInt.Pas + ADODB.Pas and you will soon see that they are as different as chalk and cheese. You have no hope of e.g. using … Read more

[Solved] ShowModal for an associated form

You added in the comments that you are setting FForm to be equal to a valid existing form. If so, you may not need to create anything: procedure TMyComp.Execute_FormShowModal; var frm: TFormUser; begin frm:= TFormUser(FForm); frm.BtnOK.Enabled:=False; frm.ShowModal; //frm.Free; end; This assumes that this valid instance you are referring to is declared type TFormUser = class(TForm) … Read more

[Solved] Select Directory error … delphi 7 [closed]

var olddir: string; //global variable procedure olddiris(name:string); begin if name=”trick” then olddir:= ‘c:\program files\’+name; end; procedure MyGetPath(name:string); var options : TSelectDirOpts; begin OldDirIs(name); //returns olddir if FileCtrl.SelectDirectory(OldDir,options,0) then ShowMessage(‘i got it’); end; procedure TForm1.Button1Click(Sender: TObject); begin Mygetpath(‘trick’); end; This code runs without error… (Note: changed GetPath -> MyGetPath; added “\” to ‘c:\program files’) If the … Read more

[Solved] How to make custom sizing for window with non-sizeable borders?

Here a customized form-class with implemented non-sizeable borders sizing and possibility to disable sizing for specified edges. Also it supports double clicks on borders to toggle between two rectangle-boundaries: AutoSizeRect to values of which form sides getting moved on dblclick and SavedSizeRect into which values form side coordinates saved before changing. So AutoSizeRect could be … Read more