Posts by Junior Moreira • 7,299 points
217 posts
-
0
votes3
answers887
viewsA: Create DELPHI Component at Runtime
Based on the pure string you can implement as you need other classes to appear. In the following example I am considering creating a component based on TEdit precisely because it does not have this…
delphianswered Junior Moreira 7,299 -
0
votes1
answer1447
viewsA: Count the total of decimals in Delphi
In case it wouldn’t just count from the separator to the end of the string? Something like: function Obter_QtdCasasDecimais(aValor: String): Integer; begin Result := Length(Copy(aValor, Pos(',',…
-
1
votes1
answer514
viewsA: webservice Rest to receive an xml in Delphi
I don’t think you need to change the parameter, you could receive xml as a String without problems, just identify a specific json field... I think of something sent to you as: [ { "xml": "todo xml…
-
3
votes1
answer42
viewsA: String to Stringstream conversion failure
When using the TStringStream Delphi converts the string into bytes, this way we cannot debug directly with the mouse cursor. However, the string still exists within the stream variable, but what is…
delphianswered Junior Moreira 7,299 -
3
votes2
answers858
viewsA: Comparison of variables of different type with conversion returns incorrect result
Whether to use the function StrToFloat consider passing it a string with ',' and not '.' to decimal separator. Another detail is the Variable Type that will receive the result. In the…
-
4
votes2
answers727
viewsA: Reduce Firebird memory consumption when closing Dataset
I’ve been working with Firebird for a long time, the problem may even be open transactions. Here we do not usually use the FDTable, we use our own component, but it’s the same. I’ll give you an…
-
3
votes2
answers1095
viewsA: Declare const array of Variant
I would use a record and then create an Array of this record. Something like: var i : Integer; Campos : Array of TCampos; begin SetLength(Campos, 10); for i := Low(Campos) to High(Campos) do begin…
-
8
votes1
answer801
viewsA: Change Inputquery Box Size
This function does not have a overload to make this available, the way is to make a. I have several ready in my system for various formats, be it String, Extended, Integer, Dates etc... Following…
-
2
votes1
answer541
viewsA: Is there a way to change the field type of a query in Delphi without having to exclude and include?
I had to do this a short time ago, remember, there is .pas and .dfm one of them is not as it should be. Here I have developed a similar solution with another Sopt user. "The idea is simple, "find an…
-
1
votes1
answer202
viewsA: Difficulty creating a Property for a CLASS
I already think of something simpler to solve, both in sending and receiving... To send imagine a List (can be a Tstringlist), key and value... To receive would use: var vJson : TJSONObject; begin…
-
2
votes1
answer800
viewsA: Combobox in firemonkey without using Fdquery
If it returns the Item String, use the native class function TStrings. Ex: ComboBoxX.Items.IndexOf('o_que_ele_retornou_string'); See internal IDE documentation: Tstrings - > Indexof. Note. If the…
-
2
votes2
answers403
viewsA: Why does the app close when I click edit1?
You need a Hotfix for the compiler, very likely that the JNI being used does not support the version of Android that this generating. Hotfix depends on the version of Delphi you are using and also…
-
4
votes2
answers732
viewsA: I opened a Form inside a Panel
You can also use this format: var vForm : TForm; begin vForm := TForm.Create(MeuPainel); vForm.Parent := MeuPainel; vForm.Left := 0; vForm.Top := 0; vForm.Height := MeuPainel.Height; vForm.Width :=…
-
3
votes1
answer263
viewsA: HTML link in Richedit
It is possible yes, difficult to understand but easy to implement/modify. I found a solution and I can detail some parts. First we must create a proc to exchange messages with TRichEdit: var…
delphianswered Junior Moreira 7,299 -
6
votes1
answer566
viewsA: Error closing form with Tacropdf in Delphi
The destruction should occur as soon as the Form invokes the Destroy of his "children". What happens in this case is that one of your children is not an instantiated but initialized object, which…
-
3
votes1
answer2324
viewsA: Popular Clientdataset with JSON truncates the data in 255 characters
The Class TCustomJSONDataSetAdapter identifies and creates the Field Type by default. In the case of content string a field of the type will be created by default WideStrig 255-character. Ideal is…
-
4
votes1
answer1556
viewsA: Difference between Transaction.Commit and Transaction.Commitretaining
Focusing on Firebird, all this concerns the "Transactional Isolation" The concept you know: I open a transaction while I don’t commit in this transaction, another transaction does not see this…
-
0
votes2
answers347
viewsA: Lazarus Debugando
In Delphi this is right, hover or press Ctrl+F7. Just as in Delphi, you need to send the field in question to the Watch List, this way you will be able to follow the evolution of the values in Debug…
-
3
votes1
answer893
viewsA: Clientdataset.Disablecontrols is safe?
I’ve been working with Delphi for 12 years, we’ve migrated the company Software from Delphi 5 to the newest IDE and we’ve never, I mean, never had a problem with this! The utility here is that when…
delphianswered Junior Moreira 7,299 -
1
votes1
answer60
viewsA: Syntax error: then but then
Your whole problem starts with indentation, the IDE XE10.2.2 failed to readjust your code. So I did it in hand. However, it is worth remembering that tests in Delphi should be finished with the…
delphianswered Junior Moreira 7,299 -
2
votes1
answer802
viewsA: Search for words MEMO!
For this you must go through the TMemo line by line and testing if there is the occurrence of the word. I think of something like: for i := 0 to Pred(Memo1.Lines.Count) do begin if…
delphianswered Junior Moreira 7,299 -
1
votes1
answer367
viewsA: Debug Delphi keeps stopping even after breakpoint withdrawal?
What may have occurred is that your IDE is set to not show the Breakpoints, so... Press CTRL+ALT+B or go to Menu View->Debug Window->Breakpoints This way the list of Breakpoints that are…
-
1
votes1
answer85
viewsA: How to use Freeandnil in this case?
If you have nothing programmed in OnClose it is not necessary to trigger it, for this case, of course. for i := qtd - 1 downto 0 do begin if (Application.components[i] is TForm) then begin {Você…
-
1
votes2
answers381
viewsA: Delphi - Dbgrid does not replace first line content
I suggest then move to the SQL query itself resolve: something like: CASE Ativa WHEN '0' THEN 'Não' ELSE 'Sim' END Ativa This way the result is ready to be displayed.…
-
1
votes1
answer108
viewsA: How to implement a Thread to allow cancellation of Stringgrid fill in Delphi?
You must be using some repeating structure for the right fill? If it is while, for... you can implement a Break. for i := 0 to Pred(Registros.Count) do begin if (vCancelar = True) then {seria…
-
1
votes2
answers81
viewsA: Problem when computing average of a grid with empty numbers
You can use the error handling system @Victor Stafusa suggested, or you can use a variation of the function you already use, which is StrToInt: instead of: sum :=sum + strtoint(Cells [k, i]); use:…
-
4
votes1
answer684
viewsA: Delphi Seattle 10 popular a listview with image coming from url - Mobile
You should get this error even, Bind wants to relate an image and you are handing her way. The correct is you save the Image itself in the database, I suggest a base64 and use a Loadfromstream or…
-
2
votes2
answers1095
viewsA: HTTP Error 406 using Rest Delphi components with XML return
Before the Execute define a Accept suitable to the file you are trying to access: RESTRequest.Accept := 'text/xml'; RESTRequest.Execute; Perform the tests and report the result.…
-
5
votes1
answer1438
viewsA: Variable Declaration with Default Value in Procedures
Directly answering the question: No, Cannot initialize local variables. What you can do is declare the variable before the section implementation var FormX : TFormX; lPriAber : Boolean = True; That…
-
2
votes2
answers1900
viewsA: Access Free Market API by Delphi XE5
The best option when the REST API doesn’t help is to use the old Indy. First we copy the initial part where the json should come, then just clean the string var vTemp : String; begin vTemp :=…
-
3
votes2
answers1981
viewsA: Locate for two fields
The Locate what I’m used to doing is in this format: DataSetX.Locate('CODIGO;DATAVENCTO;COD_PRODUTO',VarArrayOf([QOperacoesCODIGO.AsInteger ,QOperacoesDATAVENCIMENTO.AsDateTime…
-
2
votes3
answers357
viewsA: How to add parameters in Tdfquerry
Adding parameters is automatically added based on script written in tab SQL Command See this Example: SELECT IDADE, SEXO, ETC FROM PACIENTES WHERE PACIENTE = :PACIENTE AND NOME = :NOME Following…
-
3
votes1
answer3941
viewsA: Difference between Winexec and Shellexecute
The function ShellExecute works like Windows Run menu, and this is your best use benefit, the WinExec already in disuse with the successor CreateProcess. WinExec performs a simple instruction from…
-
5
votes2
answers398
viewsA: Exclusive access to a Chart in Firebird Got How?
You will need to have good transactional control to succeed with this type of treatment. Use the with lock and a block will be made on the table data, preventing changes or deletions of the selected…
-
3
votes2
answers731
viewsA: Form not downloaded from memory
Remove from the procedure OnClose the two procedures informed. And after the display of the Form (which logically occurred after creation) you apply the destruction: formage :=…
-
2
votes1
answer2445
viewsA: Use Tchromium to make a browser
Set the property DefaultURL with the path you want to open with home page. Already for loading other pages use: Of Chromium1.Browser.MainFrame.LoadUrl('www.google.com); To…
-
4
votes1
answer40
viewsA: How to reference the object property created with `with Tedit.Create(Self)`?
I see no need to cascade the creation of the component, but anyway you refer using the name of the component you created: with TEdit.Create(Self) do begin Name := 'ed'+IntToStr(i); Parent := Self;…
-
2
votes1
answer610
viewsA: Override user typed key
The correct thing is to control KeyPress. In the KeyDownor in the KeyUp is for additional validations, but you can try: if Key = VK_DELETE then begin Abort; end; This way we abort the effect of the…
delphianswered Junior Moreira 7,299 -
1
votes1
answer335
viewsA: Prevent download Twebbrowser Delphi
At the event OnDownloadBegin you can program a Abort. This way it will stop the download, however, one should be careful with this procedure, in some cases it may stop the page loading. procedure…
delphianswered Junior Moreira 7,299 -
2
votes4
answers1882
viewsA: Count substrings within a string
Several answers, but none simple to solve. Declare nas uses System.RegularExpressions, then to use : TRegEx.Matches(TextoOriginal, 'Microsoft').Count Within the uses I mentioned several other…
delphianswered Junior Moreira 7,299 -
1
votes2
answers3162
viewsA: How to Open/Close Multiple Forms from a Main Form
Consider this example: procedure TForm4.Button1Click(Sender: TObject); begin vForm1 := TForm.Create(Self); vForm1.Parent := Panel1; vForm1.Width := 100; vForm1.Align := alLeft; vForm1.Name :=…
delphianswered Junior Moreira 7,299 -
3
votes2
answers221
viewsA: If there is hint or Warning the compiler cancels the compilation
Yes it is possible, Access Project, Option, Delphi Compiler... and in Hints and Warnings you configure.. Ex. Deprected Symbol, when there is a declared and unused variable, it generates a HINT, you…
delphianswered Junior Moreira 7,299 -
3
votes2
answers155
viewsA: Incompatible data types when calling Procedure
Exactly as stated in the comment, you need a function to return the desired value, or feed a variable in the procedure! Function: function TDM_Maquinas.IBDSMaquinasCOD_LINHASetText(Sender: TField;…
-
1
votes3
answers343
viewsA: Release object into a function - Memory Leak
The TFDJSONDataSets returns the result of qry which is passed by reference. So you can’t destroy it while the Result not delivered. How to solve? vDataSetX := TServerMethods1.Teste('stringX',…
-
4
votes1
answer853
viewsA: How to find the function name of a DLL?
The correct is for you to import the DLL as a component to Delphi, and not to reverse engineer the DLL (personal ethics issue). Menu: Component -> Import Component... So Delphi had created a unit…
-
4
votes1
answer135
viewsA: Separate Letters from a string and add to a Combobox
Instead of doing the process through a function, you can popular the ComboBox directly. procedure tbDriveLetters; {Uso: S := tbDriveLetters; - retorna 'ACD' se existir as unidades A:, C: e D:} var…
delphianswered Junior Moreira 7,299 -
2
votes1
answer655
viewsA: Tdatetimepicker Windows 10 Update
Who controls the components of the Win32 Palette is OCX comctl32. To solve your problem you will need to copy this OCX and paste in place of the OCX that is troublesome. Until Micro$$oft fixes this…
delphianswered Junior Moreira 7,299 -
1
votes2
answers79
viewsA: Concatenate Matrix x Vectors
You will need to get before which list, I mean the one that has the most data, otherwise it will occur violation or List of Bounds. for i := 0 to Pred(vLista1.Count) do begin vLista1.Strings[i] :=…
delphianswered Junior Moreira 7,299 -
1
votes1
answer204
viewsA: Using Threads to Update Windows GUI
I use it as follows: while (Query.Eof = False) do begin write(Arquivo,Query.FieldByName('Campo').AsString); FrmTeste.ProgressBar.StebBy(1); Application.ProcessMessages; {Atualiza tudo no Formulário}…
delphianswered Junior Moreira 7,299 -
2
votes1
answer102
viewsA: SQL abstraction with Firedac
If you use 2 different connections with the same connection component, you can use the Try, following example: try //Tenta efetuar a rotina pensando no Firebird SELECT SUBSTRING(nome FROM 5 FOR 8)…