Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 05/26/22 in all areas

  1. corneliusdavid

    How is text being saved to the database?

    There's probably an OnChange or OnExit event handler for that DBEdit that is doing the automatic save. DBEdits have a DataSource property so you can reference the underlying data source with that property. DBEdits also have a DataField property which points to the field in the database for which the value is read and written. Delphi's VCL provides DBEdits as a convenience and watches when the focus leaves the control to update the data set held in memory until the entire dataset is posted back to the database. So you could simply add one line to your ButtonClick event to change the focus after the text is set: DBEdit86.SetFocus; assuming there's a DBEdit called DBEdit86. Perhaps just switch focus to the OK button or some other control. (There's also a way to just switch focus to the next control in the window but that escapes me at the moment). But a better way would be to do this programmatically (instead of trying to mimic what the DBEdit has to do), something like this: procedure TfDesignMaster.NoUPCButtonClick(Sender: TObject); begin DBEdit85.DataSource.Edit; DBEdit85.DataSource.FieldByName(DBEdit85.DataField).AsString := 'NO UPC ON ITEM'; DBEdit85.DataSource.Post; end; Now, assuming you know what the DataSource is, you can list it explicitly instead of referencing it with "DBEdit85.DataSource"; same with the FieldName--I just used the information I had here. For example: procedure TfDesignMaster.NoUPCButtonClick(Sender: TObject); begin InventoryTable.Edit; InventoryTable.UPC.AsString := 'NO UPC ON ITEM'; InventoryTable.Post; end; There are a couple of gotchas you need to understand that only you will be able to answer by looking at the code in that form: Is the DataSet already in Edit mode? If so, you don't need to call .Edit. Will other edit controls or application logic expect the DataSet to still be in Edit mode after that button is clicked? If so you don't want to call .Post (or call .Edit again immediately after). There are probably several other considerations but this is a start.
  2. The try/finally coding in the above is incorrect. It should be: function EncodePDF(const AFileName: string): string; var inStream: TStream; outStream: TStringStream; begin inStream := TFileStream.Create(AFileName, fmOpenRead); try outStream := TStringStream.Create; try TNetEncoding.Base64.Encode(inStream, outStream); Result := outStream.DataString; finally outStream.Free; end; finally inStream.Free; end; end;
  3. Umer Y.

    Integrate AAR SDK in FMX Android app

    Thanks Mustafa. I have gone through these links. But still not able to use aar in project. JAR, I was able to. For AAR Library, all code is compiled to Java Byte code. And there need to also include maven repo dependencies.
  4. Roger Cigol

    C++Builder 11 - any way of compiling .PAS?

    If you want to compile Delphi you have to get RAD Studio 11.1
  5. I use actions a lot. In fact, sometimes I group related sets of actions into data modules, then use the data modules in the forms. Instead of double-clicking event handlers and calling procedures to do the work (or Execute methods of actions), just hook the actions directly up to the controls. The caption of the TAction becomes the caption of the menu or button; the Execute event of the TAction becomes the OnClick event handler of the Menu or Button. You can also provide icons for the associated controls right within a TActionList as well. Later, if you decide to change the user interface from using menus to using buttons (for example), you don't have to change the captions or event handlers but just assign the TAction! There are many other ways and probably some more "pure MVC or MVVM" but this has worked really well for me.
  6. David Heffernan

    Inline var not working this time

    Does it compile if you write TestProc()
  7. "RTC SDK was originally developed by Danijel Tkalčec in 2004, and acquired by Teppi Technology in 2018 . Now, as of May 20th 2022, we announce that ReatlThinClient SDK (a.k.a. RTC SDK) is open source." https://rtc.teppi.net/ https://github.com/teppicom/RealThinClient-SDK
×