-
Content Count
2750 -
Joined
-
Last visited
-
Days Won
162
Everything posted by Uwe Raabe
-
How to manage feature changes during release cycle?
Uwe Raabe replied to Mike Torrettinni's topic in General Help
That is a common scenario and usually works well. In my case I have about a dozen 3rd party libs shared between different projects, where each references a certain revision. When I decide to update that project to a newer version (not necessarily the latest) this can be done with minimal effort. Repos with inhouse shared code are treated the same way as if they were 3rd party ones. -
Getting an Object Instance Name when ancestor is of TComponent
Uwe Raabe replied to bravesofts's topic in Algorithms, Data Structures and Class Design
In case you don't need the name you can also assign it to an empty string. Unnamed components can coexist inside their owner. -
Getting an Object Instance Name when ancestor is of TComponent
Uwe Raabe replied to bravesofts's topic in Algorithms, Data Structures and Class Design
Well, I don't have a practical example at hand in the moment and some academic ones would be of no value. Nonetheless, I will try to think of some, but as always there will be other ways to achieve the same goal - whatever that will be. -
Lost the Build Groups pane in D11.0
Uwe Raabe replied to Angus Robertson's topic in Delphi IDE and APIs
A quick check didn't show that behavior, but the missing information is: It happens only when there already are build groups defined in the project group. For a new project group you can create and edit build groups until you close and re-open the project group. Once the error appears it will persist even with new project groups until the IDE is started again. Would you please file a report in QP for that? -
Lost the Build Groups pane in D11.0
Uwe Raabe replied to Angus Robertson's topic in Delphi IDE and APIs
Can you show a screenshot? -
Getting an Object Instance Name when ancestor is of TComponent
Uwe Raabe replied to bravesofts's topic in Algorithms, Data Structures and Class Design
When a TComponent is inserted into another TComponent (like a TButton into a TForm) it tries to connect that component to a published field matching the name of the component. The responsible code part is the SetReference call in TComponent.InsertComponent. That is one reason why the Form Designer adds the component fields as published. Side note: You can even take advantage of this mechanism for your own needs. It is not restricted to the streaming system. -
Getting an Object Instance Name when ancestor is of TComponent
Uwe Raabe replied to bravesofts's topic in Algorithms, Data Structures and Class Design
No, it is the name of the variable that contains the object. The name of a TComponent instance can be different from the names of the variables containing that instance. -
Getting an Object Instance Name when ancestor is of TComponent
Uwe Raabe replied to bravesofts's topic in Algorithms, Data Structures and Class Design
I am unsure what you expect, but in this code procedure TConcrete.Method(aObjectEvent: TNotifyEvent); begin aObjectEvent(Self) end; the parameter Self represents the instance of TConcrete. As long as you don't give a name to that instance like in this code sequence fBASE := TConcrete.Create(nil); try fBASE.Name := 'My Name'; // give fBASE a name fBASE.Method(Btn_Normal_Event.OnClick); finally fBASE.Free; end; the Name property remains empty. But as I already mentioned in the beginning: It is quite unclear what you expect. -
Stream in controls at run time created by REST Debugger
Uwe Raabe replied to david_navigator's topic in RTL and Delphi Object Pascal
I would like to add some candy to the code above. If you add three published fields to the form which names and types matches the ones in the clipboard text (which are predictable when created with the Rest Debugger), you can access the imported components by these fields: type TForm649 = class(TForm) Button1: TButton; Memo1: TMemo; procedure Button1Click(Sender: TObject); private public published RESTClient1: TRESTClient; RESTRequest1: TRESTRequest; RESTResponse1: TRESTResponse; end; procedure TForm649.Button1Click(Sender: TObject); var binary: TMemoryStream; cmp: TComponent; lst: TStringList; stream: TMemoryStream; begin { clear any existing instances } FreeAndNil(RESTClient1); FreeAndNil(RESTRequest1); FreeAndNil(RESTResponse1); lst := TStringList.Create; try lst.Add('object myName: TComponent'); // this resembles the instance given as parameter to ReadComponent lst.AddStrings(cArr); lst.Add('end'); stream := TMemoryStream.Create; try lst.SaveToStream(stream); stream.Position := 0; binary := TMemoryStream.Create; try ObjectTextToBinary(stream, binary); binary.Position := 0; binary.ReadComponent(Self); // Self puts the code into the form itself, but any other component will do finally binary.Free; end; finally stream.Free; end; finally lst.Free; end; Memo1.Lines.Add(RESTRequest1.Params[1].Value); end; You can even omit the RegisterClasses call then. The FreeAndNil of the three fields guarantees fresh components being created. It is as well possible to keep existing instances, but that can end up having properties with non default values when these are not included in the stream. (That may even be desired in some cases.) -
Why empty dynamic arrays = NIL?
Uwe Raabe replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
At least it is documented here: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Structured_Types_(Delphi)#Dynamic_Arrays -
Stream in controls at run time created by REST Debugger
Uwe Raabe replied to david_navigator's topic in RTL and Delphi Object Pascal
I have hacked together some code that may help here. Create a new VCL Forms Application, drop a button and a memo onto the form and use the following code: const cArr: TArray<string> = [ // 'object RESTClient1: TRESTClient', // ' BaseURL = ', // ' ''https://api-eu1.XXXXXXXXXXXXXXX/ORD''', // ' Params = <>', // 'end', // 'object RESTRequest1: TRESTRequest', // ' AssignedValues = [rvConnectTimeout, rvReadTimeout]', // ' Client = RESTClient1', // ' Method = rmPOST', // ' Params = <', // ' item', // ' Kind = pkHTTPHEADER', // ' Name = ''x-api-compleat-key''', // ' Value = ''0aXXXXXXXXXXXXXXXXXXXXXX94''', // ' end', // ' item', // ' Kind = pkREQUESTBODY', // ' Name = ''body9BE6CF603159471FB026D7FF6FC3D2DB''', // ' Value = ', // ' ''{"master_id":1,"LayoutID":"d967cc4c-5b2b-4474-8cac-a71f9684ee70"'' +', // ' '',"TransactionStatus":"SAV","Reference":1,"PoNumber":"ORD1","Date'' +', // ' ''Created":"2008-07-08","SupplierName":"TMB","CurrencyCode":"GBP",'' +', // ' ''"SupplierID":"1234","LineItems":[{"master_id":1,"Description":"G'' +', // ' ''obo Original","UnitCost":"100.00","Net":"100.00","Quantity":1,"T'' +', // ' ''ax":0,"Gross":100},{"master_id":1,"Description":"Gobo Copy","Uni'' +', // ' ''tCost":"50.00","Net":"100.00","Quantity":2,"Tax":0,"Gross":100}]'' +', // ' ''}''', // ' ContentType = ctAPPLICATION_JSON', // ' end>', // ' Response = RESTResponse1', // 'end', // 'object RESTResponse1: TRESTResponse', // 'end', // '']; procedure TForm649.Button1Click(Sender: TObject); var binary: TMemoryStream; cmp: TComponent; lst: TStringList; stream: TMemoryStream; begin RegisterClasses([TRESTClient, TRESTRequest, TRESTResponse]); lst := TStringList.Create; try lst.Add('object myName: TComponent'); // name doesn't really matter lst.AddStrings(cArr); lst.Add('end'); stream := TMemoryStream.Create; try lst.SaveToStream(stream); stream.Position := 0; binary := TMemoryStream.Create; try ObjectTextToBinary(stream, binary); binary.Position := 0; binary.ReadComponent(Self); // Self puts the code into the form itself, but any other component will do finally binary.Free; end; finally stream.Free; end; finally lst.Free; end; cmp := FindComponent('RESTRequest1'); if cmp is TRESTRequest then begin Memo1.Lines.Add(TRESTRequest(cmp).Params[1].Value); end; end; -
Why empty dynamic arrays = NIL?
Uwe Raabe replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
A TList<T> is a class, so a variable of type TList<T> being nil is not an empty list, but no list instance at all. In contrast to nil, an existing TList<T> instance can be filled. For nil you first have to create with TList<T>.Create to get a list you can work with. In contrast to that an array is not class. -
That is intended. The LSP processes build their own internal data structures decoupled from the BDS ones. The sizes required depend on the complexity of your projects.
-
Strange exception with "Write of address 00400000"
Uwe Raabe replied to Cristian Peța's topic in VCL
In line TImageCollectionSourceItem.Create there is just a call to TWICImage.Create, which initiates a COM call CoCreateInstance. Perhaps there is something wrong with the specific combase.dll on that machine (faulty version, corrupted, infected). -
That is not quite right. It handles some non-Integer data types and try to convert the value to Integer. Here are some common examples: function TStringField.GetAsInteger: Integer; begin Result := StrToInt(GetAsString); end; function TFloatField.GetAsInteger: Integer; begin Result := Integer(Round(GetAsFloat)); end; function TMemoField.GetAsInteger: Integer; begin Result := StrToInt(GetAsString); end;
-
I suspect the field is a string field?
-
AFAIK, they will provide the API with one of the following updates when the internal interfaces are more mature.
-
D11 Select tab with unit - prohibit selection in Projects
Uwe Raabe replied to Stano's topic in Delphi IDE and APIs
Drop down the Options button (the right most) and uncheck Auto Track. -
The requested functionality can be hacked together with a few lines of code. Place this interposer class in the scope of your form. type TDBGrid = class(Vcl.DBGrids.TDBGrid) private procedure WMVScroll(var Message: TWMVScroll); message WM_VSCROLL; end; ... procedure TDBGrid.WMVScroll(var Message: TWMVScroll); begin if Message.ScrollCode = SB_THUMBTRACK then Message.ScrollCode := SB_THUMBPOSITION; inherited; end;
-
Not more than a FetchAll would do. It is similar to repeatedly pressing PgDn.
-
What about filing a feature request?
-
TCustomGrid and its descendants don't support that.
-
My layout is a root folder that contains all external libraries as sub repos in a separate sub folder named lib, while the project is located in the source sub folder. This keeps the lib stuff out of the "search in files in project dir".
-
Is it possible to see Git current working branch in IDE?
Uwe Raabe replied to Mike Torrettinni's topic in Delphi IDE and APIs
I know, but I also know how these things are usually going. -
Is it possible to see Git current working branch in IDE?
Uwe Raabe replied to Mike Torrettinni's topic in Delphi IDE and APIs
Right when this thread started I thought: This may quickly turn into a Git client contest.