Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. PenelopeSkye

    TBDEdit - save updates to 2 different tables.

    Just in case it takes me a while to try all this out thank you very much!!!
  2. I am responsible for updating an app written in pascal a long ago by someone else. There are lot of TBDEdit fields. I have been requested to find out the user who is updating certain of those fields on the form. (I have the code that gets the username). Currently as soon as you close the form the edit box is on after updating it, not the entire app just the form, the text is saved to the database. I have been trying to simply understand how this is happening. When I click on the edit box I see that there are Live Bindings in the Properties and events, and a datasource. When I check the code in the dfm file I see the code below. That is all I can find regarding this specific field. Is there any way to update this so that besides automatically saving text to the presentation_design_links table this info is also saved to another table along with the username? I seriously doubt that this is enough info for anyone to go on, would you let me know what else you need? Thanks! object tb_dm_presentation_design_links: TADOTable Connection = adoconn_artdesign AfterInsert = tb_dm_presentation_design_linksAfterInsert BeforePost = tb_dm_presentation_design_linksBeforePost BeforeDelete = tb_dm_presentation_design_linksBeforeDelete IndexFieldNames = 'design_id' MasterFields = 'design_id' MasterSource = ds_design_master TableName = 'presentation_design_links' Left = 252 Top = 324 object tb_dm_presentation_design_linkscust_upc: TStringField DisplayWidth = 30 FieldName = 'cust_upc' ProviderFlags = [pfInUpdate] Size = 30 end
  3. PenelopeSkye

    How is text being saved to the database?

    So there can be large numbers of objects in the Live Bindings designer not connected to anything else. I don't know why that should be so odd to me, you don't have to connect objects. I will endure, and I won't keep looking for connections where there are none! And yes, there is text handling such as removing leading and trailing spaces, It was just in there before I ever got my hands on the app ­čÖé Thanks David and Stano!
  4. PenelopeSkye

    DFM file is different between version control and Delphi

    You are right! When I thought I was looking at the code in the dfm file I was actually looking at the code in the pas file. If I want to look at the code in the dfm file I had to bring up the pas file in design mode, right click on the filename and select 'View as Form'. Rant: Even when I would bring up the code behind for the dfm file I could not find anything from it using find in files, I had to search the page. AAAARGH! How is that useful? Thanks again David!!!
  5. I have been trying forever to find the file with the actual queries being used by the project that I am working with. When I look at the design view of the dfm file I am working with I see all the query objects, and can see the actual queries by selecting the object and clicking on the SQL property, but I wanted to look at the file with all the actual queries, and when I click on the code tab of the dfm file I don't see any queries. But! When I was updating the app for something completely different when I was looking at our version control software and I saw a query, and the file it was in was the dfm file. How is it possible that the file in version control has different content than the actual file itself in Delphi (Embarcadero® Delphi 10.3)? I am probably missing something very simple but I can't figure it out myself. Thanks!
  6. PenelopeSkye

    How is text being saved to the database?

    The entered value is valid, this field is able to post any text entered into it (although I am assuming there are length restrictions) so any text is valid. Is that what you meant? There are live bindings, but I was unable to understand what I was seeing, and was never sure if they had anything to do with saving to the db. When I went to the Live Bindings Designer there were just a lo9t of objects and I couldn't tell how they were connected to anything else. Ignorance is not bliss! I found that I had to add a close statement which I have since added. Thanks Roger!
  7. PenelopeSkye

    How is text being saved to the database?

    I noodled around using your suggestions, especially corneliusdavid, and it turns out to be dm.ds_dm_presentation_design_links.DataSet.Edit; DBEdit85.Text := 'NO UPC ON ITEM'; dm.ds_dm_presentation_design_links.DataSet.Post; Thank you all so much!!!!
  8. I have inherited an app written in Pascal which I have never written before. I am barely competent with c sharp. I am using Embarcadero® Delphi 10.3 I have created my own program that gets data from a database and inserts data, but as far as the uber app goes I cannot figure out how text from edit boxes is being written to the database as soon as it is typed. For example I created a button that populates a edit box (the person I work with is tired of everybody entering a certain string incorrectly). When the user types in text it is automatically saved to the database, but in order for the text that is populated by clicking on the button to be saved the user has to click an edit button on a TBDNavigator, then press the button to populate the box, then press the post button. I have included the code snippet below, I couldn't see any instructions on how to format code. procedure TfDesignMaster.NoUPCButtonClick(Sender: TObject); begin DBEdit85.Text := 'NO UPC ON ITEM'; end; I know there must be a way to open edit and post but I can't find the datasource for it, there are so many associated with the project and I don't know the name of it. Does anyone know of a way to find the datasource that will allow me to add the code to edit and post? This is the only button that does this in the entire app or I would copy the code, and the other edit boxes are not pointing me anywhere. I am sure I am leaving out all sorts of information needed to answer this question, apologies and please let me know what information I can provide! Thanks!
  9. PenelopeSkye

    Set focus on dialog box button

    I finally had to go to a developer in my company. The issue was that the modal dialog box was being created and destroyed in the same step. She had me create a procedure that creates the modal dialog box, set the focus, then close it and it worked. Thanks Anders!
  10. PenelopeSkye

    Set focus on dialog box button

    Hi Anders, this produced a a few errors that I am trying to figure out without bugging you with each one ­čÖé.
  11. PenelopeSkye

    Set focus on dialog box button

    This is the code where the user puts in the search text (a stock number) and if it is valid the dialog box shows up with the OK button requiring focus! I tried inserting fChooseResult.showModal=mrCancel then fChooseResult.BitBtn1.SetFocus; as well as several other things and it either didn't work or it gave an error message: "Cannot focus a disabled or invisible window" Ideas? Thank you!!! procedure TfDesignMaster.FindStockNumber1Click(Sender: TObject); var stocksearch: string; did: string; begin stocksearch:=inputbox('Search','Enter Stock Number',''); //find Stock Number if stocksearch<>'' then begin did:=''; //dm.tb_design_master.locate('jmc_stock_num',stocksearch,[]); //execute query for Stock # if dm.qStockNum.active then dm.qStockNum.close; dm.qStockNum.Parameters[0].value:=stocksearch; dm.qStockNum.open; if dm.qStockNum.recordcount>1 then begin //Show list of designs fChooseResult.dsResult.DataSet:=dm.qStockNum; if fChooseResult.showModal=mrOK then did:=dm.qStockNum.fieldbyname('design_id').asstring; fChooseResult.dsResult.DataSet:=nil; end else did:=dm.qStockNum.fieldbyname('design_id').asstring; if dm.qStockNum.recordcount=0 then messagedlg('Not found',mtError,[mbOK],0) else datagoto(did); //dm.tb_design_master.locate('design_id',did,[]); dm.qStockNum.close; end; end;
  12. PenelopeSkye

    Set focus on dialog box button

    Thank you everyone! Apologies if I seem to be ignoring some posts\bits of information, I am trying to just keep my head above water! I have located all the items in the object inspector (thank you!) and all the properties were already set to what was mentioned above. I added the Execute code mentioned above but the instructions say to then display the form, but the code to call the form has already been written and is being called elsewhere. I think one of my problems is that I don't understand where this form is being called from. The process is as follows: 1. While in the app (that has been created\finished long ago and is in constant use) the user hits the key press sequence 'ctrl-S' and a dialog box appears with a text box 2. The user types in a number to search on, and presses OK. This is the point where the dialog box with the OK button requiring focus is being called. Should I be looking for the code from the previous dialog box where the user types the search text in order to set focus or should I stick with the code I already posted? Again it is probably very annoying to deal with newbies, please hang in there, I am studying as I go and it is being very helpful!!! Thank you!!!
  13. PenelopeSkye

    Set focus on dialog box button

    Thanks Anders, I had tried adding BitBtn1.SetFocus; in various places but that didn't work either. Do you see a place for it in the code below? I get to this code by selecting the OK button and then going to code. And thank you PeterBelow, I am not even sure where to check Default or Cancel! I am finding the IDE to be very confusing to find things!!! unit ChooseResult; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, Wwdbigrd, Wwdbgrid, StdCtrls, Buttons, DB, ExtCtrls; type TfChooseResult = class(TForm) wwDBGrid1: TwwDBGrid; Panel1: TPanel; dsResult: TDataSource; BitBtn1: TBitBtn; BitBtn2: TBitBtn; procedure wwDBGrid1DblClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var fChooseResult: TfChooseResult; implementation {$R *.dfm} procedure TfChooseResult.wwDBGrid1DblClick(Sender: TObject); begin BitBtn1.click; end; end.
  14. PenelopeSkye

    Set focus on dialog box button

    I must have performed the search incorrectly because I did not find anything like this, so please point me to wherever I should be looking for answers to this question. I am a newbie to both Delphi\pascal and the forum. I have an app that brings up a search dialog box that leads to a result dialog box. When the result dialog box appears the focus is always on the last button pushed when last in the result dialog box. How do I get a specific button (the OK button) to always have focus no matter what button was last pushed? I tried clicking on the button in the IDE (Delphi 10.3) to see if there was an ActiveControl property in the object inspector but there is not. How can I set focus to the OK button? Thanks!