Ian Branch
Members-
Content Count
1352 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Ian Branch
-
Hi Team, D10.4.2, Win 10. Something has changed in my IDE and now when I Format Project Source the code is indented by 8 instead of my normal 2. See attached image. I thought this was controlled by the Continuation indent setting of Indentation in the Formatter settings but that hasn't changed. What may have changed/be affecting this please? Regards & TIA, Ian
-
Ah Ha! Thank you. No wonder I couldn't find it. I was looking in the wrong place. All sorted now. Still to wonder why/how it changed, but all god now. Thanks again, Ian
-
Hi Team, I am about to start reworking an old project, started in D7, got updated to D2007, now updating to D10. I have Snap to Grid enabled in D10. When I open the old forms, will they automatically snap to their nearest grid points or do I have to do it manually? Regards & TIA, Ian
-
Ahhh, Thank you. The latter will do nicely. Regards & Tks, Ian
-
Hi Team, I have a form with multiple components on it. They have all been set correctly in their sequence/tab order, which shows correctly in the tab #. Showing the Tab Order, some of the components have grey background tab numbers, and others have green. If I tab from a grey to a green and then tab again, the cursor moves to the next green tab # component rather than the next tab order component. :-( Two questions.. 1. Why; and 2. How do I get hen to physically tab correctly? Regards & TIA, Ian
-
Hi David, 100% correct! Something I never came across before. Something learnt for today. Thanks again. Regards, Ian
-
Hi Kas Ob, I thought I had answered the questions but obviously not adequately. I can read the image from the table and I can write the image back to the table, what I don't know, and yes I would appreciate some code, is how to reduce its size, or 'stretch it down', as you put it. Ian
-
David, VCL, Windows 32bit. The goal is to reduce the physical and therefore stored size. resize or compression, which ever achieves the objective. Cristian, I had considered and even played with an external tool but this has to run on a Client's PC/Server so I would prefer some manner that would be self contained. Ian
-
Just downloaded Indy 10 rev 3902. D10.4.2, Win 10. When building my project I get an error in IdIOHandler.. function TIdIOHandler.ReadInt16(AConvert: Boolean = True): Int16; begin EnsureInputBytes(Self, SizeOf(Int16)); << Error here.. Result := Int16(InputBuffer.ExtractToUInt16(-1, AConvert)); end; The error is.. "[dcc32 Error] IdIOHandler.pas(1285): E2010 Incompatible types: 'Integer' and 'TIdIOHandler'" Regards, Ian
-
Fix Confirmed/Verified. Tks Remy.
-
Hi Team, I am playing in an area I have no experience in, again. I have the following routine found while googling..... D10.4.2. function RecordToArray(aDataSet: TDataSet); var Data: array of variant; aRecord: array of TVarRec; i: integer; max: integer; begin max := aDataSet.fields.count - 1; // set the lenghth of the arecord array to be the same as the number of // elements in the data array SetLength(arecord, max + 1); SetLength(data, max + 1); // set the variant type pointers to the data array for i := 0 to max do begin arecord[i].VType := vtVariant; arecord[i].VVariant := @data[i]; end; Result := aRecord; end; The objective is to copy the contents of a table row into an array, which is then returned to the calling routine so the table can be closed and the array values accessed throughout the remainder of the program. I want to keep the routine generic so I can use where ever it is convenient. The contents of the fields can be any valid data type. The array can vary in length. The original routine simply took the array and copied it back into the dataset and didn't return anything. I figured, obviously incorrectly, that if 'arecord' is declared as a TVarRec, then the function return should be an Array. Delphi didn't like it. OK. I declared a type of TVarArray = array of variant;, and set the return as TVarArray. Nope, Delphi says I must return a dynamic array. How do I do that please? What should the return type be? Regards & TIA, Ian
-
All, Thank you for your inputs & suggestions. I have gone with 0x8000FFFF's first suggestion for its simplicity and flexibility. Again, my thanks to all. Regards, Ian
-
Hi Team, What is the difference, if any, between.. MyForm := TMyForm.Create(nil); and Application.CreateForm(TMyForm, MyForm) Just curious. Regards & TIA, Ian
-
Hi Team, Given a currency/float value of say 92.12, I need to round it up to the nearest 5.00 point, i.e. 95.00. 123.45 to 125.00, etc. All the roundup routines I can find deal with the decimal component. Does anybody have one that will do what I need? Regards & TIA, Ian
-
Hi Guys, Appreciate the input. The Customer is desiring this.. 100 > 105 101 > 105 102 > 105 103 > 105 104 > 105 105 > 110 106 >110 107 > 110 108 > 110 109 > 110 110 > 115 etc... As best I can tell, ConstantGardner's solution does the job. Ian
-
Thank you. Works perfectly. P.S. I changed the return from Integer to Extended. Regards, Ian
-
Hi Team, D10.4.2, Indy 10. Trying to get an example from the internet working before I try to plug in my own parameters.. unit Unit2; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IdMessage, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdMessageClient, IdSMTPBase, IdSMTP, Vcl.StdCtrls, IdEMailAddress, IdGlobal, IdAttachment, IdText, IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL, IdSSLOpenSSL; type TForm2 = class(TForm) Button1: TButton; IdSMTP1: TIdSMTP; IdMessage1: TIdMessage; IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form2: TForm2; lSMTP: TIdSMTP; lMessage: TIdMessage; IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL; // to allow SSL authenticate // implementation {$R *.dfm} procedure TForm2.Button1Click(Sender: TObject); var lTextPart: TIdText; lImagePart: TIdAttachment; begin // ... here we need to set required properties for SMTP component. for moe visit How to send Email in Delphi?// lSMTP.Host := 'xxx'; lSMTP.AuthType := satDefault; lSMTP.Username := 'xxxx'; lSMTP.Password := 'xxxx'; lSMTP.Port := 587; lMessage.From.Address := 'yourGmailaddress@gmail.com'; lMessage.Subject := 'My test email with HTML body'; lMessage.Recipients.Add.Address := 'receipent@gmail.com'; lMessage.Body.Clear; // here we have initiated TIdtext object for plain text message in body// lTextPart := TIdText.Create(lMessage.MessageParts); lTextPart.Body.Text := 'This is a plain text message'; lTextPart.ContentType := 'text/plain'; // here we have initiated another TIdtext object for HTML text message in body// lTextPart := TIdText.Create(lMessage.MessageParts); lTextPart.ContentType := 'text/html'; lTextPart.Body.Text := '<html><body><b>Hello World</b><a href="htmlbodyIMG0000.JPG" ></body></html>'; // here we have initiated TIDAttachment object to add image file as attachment to mail as we have use this image in above HTML body message // lImagePart := TIdAttachment.Create(lMessage.MessageParts, 'htmlbodyIMG0000.JPG'); lImagePart.ContentType := 'image/jpg'; lImagePart.Headers.Add('Content-ID: <htmlbodyIMG0000.JPG>'); // if an image is used // // ... write your code to send a message for more visit How to send Email in Delphi? // lSMTP.Connect(); try lSMTP.Send(lMessage); ShowMessage('Email sent'); finally lSMTP.Disconnect(); end; // end; I have the following showing.. The 'note' for TIdAttachment is as follows.. The 'note' for 'htmlbodyIMG0000.JPG' is as follows.. The code is from 2016. Has there been a change around TIdAttachment since? If so, what should the line say/read? Regards & TIA, Ian
-
Hi Lajos, Ahhh. Thank you. Regards, Ian
-
Hi Team, I have never knowingly used the 'as' operator and have no idea what it is about and how to use it. I looked at the EMB description of the operator but was none the wiser. So, 1. can somebody point me to a clear explanation of the use of the 'as' operator, preferably with examples, and 2. I have the following code.. pptr := PaPInAddr(phe^.h_addr_list); Which also uses something that I never caught on to as well, pointers. Using Pascal Analyzer, it suggests I should use 'as' somewhere in there. Could someone enlighten me where and why it may be better. Although that insight may come from 1. above. Regards & TIA, Ian
-
Hi Team, What are the Pros & Cons, and preference, of using Nil v Self in something like.. MyForm := TMyForm.Create(nil); // Nil or self. // try MyForm.ShowModal; finally FreeAndNil(MyForm); end; // Regards & TIA, Ian
-
Cheers & Tks.
-
Hi Team, D10.4.2. I have a project group with 19 projects in it. Is there any way to 'bulk' change a setting in their manifests? Specifically the 'DPI Awareness' setting. It's a right royal pain in the proverbial having to go through the process individually 19 time as I experiment with the settings v on-screen results. Regards & TIA, Ian
-
Hi Team, D10.4.2. Is there any way to make the Win 10 Activity Indicator background transparent? It looks silly running in a grey box hiding everything behind it. Regards & TIA, Ian
-
Hi aehimself, My experience over a new project/form/TMemo.
-
Hi Team, I have had the following construct in service for a loooong time without issue.. {code} .... .... MyForm := TMyForm.Create(self); try with MyForm do begin ... .... .... end; finally MyForm.Free; end; {code} in MyForm I have.. {code} ... ... procedure TMyForm.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; end; {code} Is this construct OK? Suddenly, I am starting to get 'EUseAfterFreeError's indicating the MyForm.Free; My immediate thought is that the .free from the calling form is not finding something to Free because the called form has already done a caFree. If this is the case, why has it just started? Thoughts?? Regards & TIA, Ian