Jump to content

corneliusdavid

Members
  • Content Count

    550
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by corneliusdavid

  1. I recently inherited an old project that had many bad code examples that looked like whenever anyone made a change to the code, they just left it like they found it instead of refactoring. There were empty IF-blocks, while-true loops, exit statements one line before the end of a procedure, and one of my favorites: for j := 0 to 0 do begin Temp := StartTop[j] + CompRow; CreateLabel(CNameL[j], LeftSide - 4, Temp, 150); ... All of these were in that ONE project. But the worst code in that I found in that project was a bunch of GOTOs: function BlankControl(EditControl: TObject; const EditMess: string; ShowErrorMsg: Boolean; MaxLen: Integer): Boolean; label 900, 1000; begin if EditControl is TCustomEdit then if length(trim((EditControl as TCustomEdit).Text)) < MaxLen then goto 1000 else goto 900; if EditControl is TComboBox then if length(trim((EditControl as TComboBox).Text)) < MaxLen then goto 1000 else goto 900; if EditControl is TDBComboBox then if length(trim((EditControl as TDBComboBox).Text)) < MaxLen then goto 1000 else goto 900; if EditControl is TDBRadioGroup then if ((EditControl as TDBRadioGroup).Value = '') then goto 1000 else goto 900; if EditControl is TDBLookupComboBox then if ((EditControl as TDBLookupComboBox).Text = '') then goto 1000 else goto 900; if EditControl is TDBCheckBox then if ((EditControl as TDBCheckBox).State = cbGrayed) then goto 1000 else goto 900; 900: Result := false; exit; 1000: Result := true; Showerror(EditControl, EditMess, false, ShowErrorMsg); end;
  2. corneliusdavid

    Vcl to Fmx

    For converting VCL to FireMonkey, the only tool I know if is Mida Converter. Disclaimer: I have not used it myself, so don't know how well it works. I don't use grids as often in mobile apps as I do in desktop apps, which is mostly what I use FireMonkey for so far, but I've had good success hooking up TGrid to datasets with LiveBindings.
  3. corneliusdavid

    Run Time Sub Menu Gap

    Ah! TAdvMainMenu! That explains it. I was thinking that didn't look like the regular TMainMenu. My attempt to replicate it also failed.
  4. corneliusdavid

    Run Time Sub Menu Gap

    It would help if you showed the code that you tried. You could also create one sub-menu at design-time, then look at the text view of the .dfm to see all the properties it sets to give you a clue.
  5. corneliusdavid

    Class tree utility released

    Nice, that works pretty well. (You accidentally listed the URL twice so you might want to edit your post and correct it.) Why did you include the DelphiEncryptionCompendium units? Was that just to test? They aren't really needed for the functionality of the app. It'd be cool if there was a search button so you could quickly find a specific class in the huge generated list.
  6. corneliusdavid

    Disable & re-Enable a Procedure

    Lajos, Yes, but if you're enabling/disabling from within the data module you don't need to preface it with the variable name.
  7. corneliusdavid

    Disable & re-Enable a Procedure

    So I gather you have a data module with an Orders table or query where one of the fields is DOCNO and you double-clicked on the OnChange event handler in the Object Inspector to create the procedure. So to clear it at runtime in code you would clear the OnChange property of the DOCNO field. In other words, you were very close: dm.Orders.DOCNO.OnChange := nil; And you would hook it back up again by reassigning the created procedure name: dm.Orders.DOCNO.OnChange := OrdersDOCNOChange;
  8. corneliusdavid

    Can one include a TDataModule in a console application?

    Yes, absolutely! If you want to write a server app or a web module, this is the best way to go as debugging a console app is very simple and the data module can be shared between the two projects. I do this quite frequently. Here's a sample console project loading a data module: program ConsoleProjectTest; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, udmUnit1 in 'udmUnit1.pas' {dmUnit1: TDataModule}; begin try dmUnit1 := TdmUnit1.Create(nil); try // do stuff with data module finally dmUnit1.Free; end; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. Hope that helps!
  9. corneliusdavid

    Need some enlightenment

    Before you go to too much work, you might want to read this blog if you haven't already. If you really need to convert this C# code, it would be helpful to see more of the definitions of the object types but here's a first stab... var tblProp: TableProperties; TopBord: TopBorder; BotBord: BottomBorder; // ... begin TopBord := TopBorder.Create; TopBord.Val := BorderValues.Dashed; TopBord.Size := 24; BotBord := LeftBorder.Create; BotBord.Val := BorderValues.Dashed; BotBord.Size := 24; // etc. tblProp := TableProperties.Create(TableBorders.Create(TopBord, BotBord... If the xxxBorder classes have parameterized constructors, it would look closer to C#: var tblProp: TableProperties; begin tblProp := TableProperties.Create(TableBorders.Create( TopBorder.Create(BorderValues.Dashed, 24), BottomBorder.Create(BorderValues.Dashed, 24), LeftBorder.Create(BorderValues.Dashed, 24), RightBorder.Create(BorderValues.Dashed, 24), InsideHorizontalBorder.Create(BorderValues.Dashed, 24), InsideVerticalBorder(BorderValues.Dashed, 24)));
  10. I just downloaded the sample shoplist database and opened it in SQLiteStudio and the table is empty. Perhaps add some records outside of your app, then if your app is still not showing anything, you'll know something is amiss in your data connection or LiveBindings. When making changes to a view that don't appear to affect the display on your phone, try changing a different view or adding a label to the master view. When I was getting up to speed with mobile development, there would be times I thought for sure I was modifying the right view only to find out the phone was a different size than I expected or I had inadvertently switched views. Once you verify what view to use, you shouldn't need to uninstall the app--it'll update it.
  11. corneliusdavid

    AppAnalytics-type tool

    I wrote my own "App Usage" server using PHP with data stored in MySQL. My app simply makes an HTTP POST call to the PHP script. It's pretty simple, but so are my needs. That may not be what you want but it's one idea.
  12. corneliusdavid

    Which setting enables this feature?

    You're on the right screen: it's Code parameters. The Delay affects how quickly the tooltip will appear (or at least that's the idea--it doesn't display at all for me automatically if the delay is anything but "None"). You can always manually activate it by hitting Ctrl+Shift+Space.
  13. corneliusdavid

    SQL expression evaluation not supported

    Yes, IB uses "simple" case. Try this: SELECT O.DELVTYPE, SUM(OD.REMAINQTY) QTY, (Case O.DELVTYPE When 'Sea' then O.DELVDATE + 45 else O.DELVDATE + 15 end) as DELVDATE FROM ORDETAIL OD JOIN ORDERS O ON O.RNO=OD.RNO WHERE OD.ITEMNO = 'ABX22' GROUP BY O.DELVTYPE, O.DELVDATE HAVING SUM(OD.REMAINQTY) > 0
  14. I've got a small WebBroker application that requests the user to choose a file which is then posted to another page of the WebBroker application. The web form's HTML is like this: <form action="UploadFile" method="post" enctype="multipart/form-data"> <label for="MyFile">Select file to upload:</label><br /> <input type="file" id="MyFile"> <button type="submit">Upload</button> </form> The TWebApplicationItem that handles the "/UploadFile" path is trying to get the file to upload so it can save it on the server but I can't find documentation or an example of how to do this. I've tried looking at both TRequest.ContentFields and TRequest.Files properties but they're always empty. I found an old StackOverflow question relating to this that mentioned including the ReqMulti unit so that it parses the multi-part form but that didn't fill the Files property for me. Finally, I called Request.ExtractContentFields but it just gave me the same raw string, ('------WebKitFormBoundaryBRM3RcInbYBqzsVj--') that I saw in the TRequest.Content property. From what I've been reading, I should be able to create a TFileStream and somehow use the Content property to read the file from the headers but I'm not sure how to get the file information. Can someone point me in the right direction?
  15. corneliusdavid

    Getting uploaded file from post data

    Re-reading the StackOverflow question and looking more closely at my HTML, I realized I was missing the name attribute in the input element. Now my Files property is being filled and I can save the uploaded file. 🙂 <form action="UploadFile" method="post" enctype="multipart/form-data"> <label for="MyFile">Select file to upload:</label><br /> <input type="file" id="MyFile" name="MyFile"> <button type="submit">Upload</button> </form>
  16. corneliusdavid

    Android 11 Support in 10.4.2?

    Wow--OK. This is more confusing than I first thought--I have more study to do on this! Thanks for pointing that out.
  17. corneliusdavid

    Android 11 Support in 10.4.2?

    @Dave Nottage, thanks for that explanation. To further clarify my situation and after looking at my project again, my target SDK is only at 25.2.25 so while that works on my Android 11, it doesn't support all the newest features of Android API 30.
  18. corneliusdavid

    Android 11 Support in 10.4.2?

    All I know is that it is working very well for me. I've got a Delphi app on my Android 11 phone that I actively use and it works well.
  19. corneliusdavid

    Delphi License Registration

    Registering a serial number too many times is one problem--and easily solved by requesting a registration number bump. However, your second sentence indicates a different problem: You have too many copies of Delphi running with the same serial number. I believe the max is 2. I run into this once in a while if I leave Delphi up in a virtual machine and switch to a different VM to check a different project. If I forget to close one of them down and then leave the office with my laptop and try to use Delphi on that, I get the warning and have to remote into one of the VMs and close one down. So, using your second serial number to register a second copy of Delphi should solve your problem. And to answer your question, no, registering Delphi does not affect third party packages.
  20. corneliusdavid

    How to enable breakpoints?

    Sometimes this happens to me as well but then I realize I had a file open from a different project or the line of code was excluded because of conditional compilation of some sort. Other times, the background compiler that does syntax checking just hasn't realized the line of code is able to be debugged; in that case, I just do a project Build All and it often solves the problem.
  21. I presume you've tried going into Project > Options > Application > Icons and setting all listed resolution image filenames under the Launcher, Notification, and Splash Images tabs?
  22. corneliusdavid

    Unit fmx.graphics not found

    It's in my copy of Delphi 10.4 where I would expect: \source\fmx\FMX.Graphics.pas $(BDSLIB)\$(Platform)\release
  23. Yes, DosCommand has both Delphi and C++ Builder packages to do exactly what you need.
  24. corneliusdavid

    Interbase license bound to specific computer?

    There are several different licenses for different installation types of InterBase, but I'm assuming you're not using the Developer, Desktop, ToGo, or IBLite licenses. I'm pretty sure that it is not tied to a specific CPU or computer however, if one instance of a licensed InterBase is running and a second instance with the same license starts up, I think you'll get a license error. Whether or not Embarcadero tracks where the license is coming from, I'm not sure.
×