Jump to content

Ian Branch

Members
  • Content Count

    1352
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Ian Branch

  1. Hi Team, D10.4.1, Win 10. For some reason I have a project that insists on opening the project file in the IDE rather than the MainForm I would prefer. I deleted the following files: .dproj, .dproj.local, .identicache, .otares. There is no .dsk. The double clicked the .dpr and still it opened the project file rather than the MainForm. I tried closing the project file and then saving from the IDE with just the Mainform open but that didn't work. There is obviously some way to make it not open the .dpr and to open the MainForm but I can't find it. Help! Regards & TIA, Ian
  2. Ian Branch

    Main Form appearing issue..

    Hi Guys, Thanks for the pointers. I found the answer here.. http://www.delphigroups.info/2/e6/483281.html I recall now the User was complaining that dialogs were being hidden by the form. That was in an earlier Delphi. I shall have to experiment a little to see if the issue still persists now I have commented out that piece of code. Thanks again. Ian
  3. Ian Branch

    Main Form appearing issue..

    All, Thank you for your input. Appreciated. Something Lajos said.. Triggered something in my head. Having another look at the code in the Sub Form I found this.. ... .... private { Private declarations } public { Public declarations } protected procedure CreateParams(var Params: TCreateParams); override; end; var And this.. procedure TAudioForm.CreateParams(var Params: TCreateParams); begin inherited; Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW; Params.WndParent := 0; end; Now, I have no recollection of what that code was put in for, oh so long ago, but if I comment it out all is good. No more MainForm appearing. Can someone enlighten me as to why I would have put that there?? I'm sure I put it there for a reason. ;-) Ian
  4. Ian Branch

    Main Form appearing issue..

    And that's a reasonable assumption except I can't find anything to account for it. I have eliminated everything in the MainForm Create & Show events. The Audio form is called with a simple.. AudioForm := TAudioForm.Create(Self); AudioForm.Show; All the AudioForm does on Creation is open tables. There is nothing in the Show event. I thought it might have been something in the Project file but I can't see anything there that would contribute/cause this. Ian
  5. Hi Team, D10.4.1, Win 10, 32bit App. I need to open a sub form, StockPositionForm, from the MainForm, non modal as it is used in conjunction with other forms in the App. At the same time I need to prevent StockPositionForm being reopened again from the MainForm whilst StockPositionForm is already open. StockPositionForm is currently opened with.. procedure TMainForm.StockPosition1Click(Sender: TObject); begin // TStockPositionForm.Create(Self).Show; // end; Thoughts/suggestions, polite :-), appreciated. Regards & TIA, Ian
  6. Ian Branch

    Prevent a sub form being reopened..

    Ahhhh. Excellent! Works perfectly. Thank you. Regards, Ian
  7. Ian Branch

    Project always opens with .dpr file..

    I have it. For some reason Tools|Options|IDE|Save project desktop when closing, was not checked. Don't know when that happened, this project has seemingly always been this way. Oh well. All sorted now. Thanks Uwe for the pointer. Regards, Ian
  8. Ian Branch

    Project always opens with .dpr file..

    HI Uwe, I have never knowingly changed them. All my other projects open at the Mainform. What should I specifically look at/for? Yes, the Mainform is auto-created in the dpr. Application.MainFormOnTaskbar := True; Application.CreateForm(TMainForm, MainForm); Application.Run; Regards, Ian
  9. Ian Branch

    {$IFNDEF for Defined(????

    HI Team, Hope you all had an enjoyable Xmas day as befits your Faith & Family. I know and have used {$IF Defined(xxxx) or Defined(YYYYY)} ..... ..... {$ENDIF} Is there a {$IFN.. hidden in Delphi somewhere?? i.e.... {$IFN Defined(XXXXXX) or Defeined(YYYYY)} ..... ..... {$ENDIF} I have multiple projects sharing common files and in some case it would be shorter to write {$IFN.... conditionals then {$IF.... conditionals. Regards & TIA, Ian
  10. Ian Branch

    SMS via my phone..

    Hi Team, I have been asked if it is possible to send an sms from their Delphi App on their PC via a phone attached to the PC? Doesn't matter if it is Android or Apple, the Customer will supply the phone/phone account. Thoughts, suggestions, recommendations?? Regards & TIA, Ian
  11. Ian Branch

    SMS via my phone..

    He's a Phone repairer so it will be what I figure out. :-)
  12. Ian Branch

    SMS via my phone..

    Hi David, Probably, but I haven't specifically looked into that route. The Customer already has his own Phones/#s and wants to put them to use. Ian
  13. Ian Branch

    Turn off title on a TImage??

    Hi Team, D10.4.1. If I can, where/how do I turn off/blank the title of a TImage. I can't find a .Caption or .Title property, or similar, and it doesn't make sense that you can't so where/how?? Regards & TIA, Ian
  14. Ian Branch

    Turn off title on a TImage??

    Solved. I am going to take myself out the back and beat myself over the head soundly with a piece of 2 x 4. The 'Caption' I was trying to get rid of was actually in the image. :-( Colour me red. :-( Thanks for your input. I will just slink away now.... Regards, Ian
  15. Ian Branch

    Turn off title on a TImage??

    Hi Pat, Didn't make any difference. This is what I am seeing on the form.. The image name there is shown. Above the TImage is a Panel, overlaid on the Image are buttons. Ian
  16. Hi Team, D10.4.1, Win 10 64bit. Suddenly my palette doesn't want to show anything. Any thoughts/suggestions? TIA, Ian
  17. Ian Branch

    TDBGrid - dgTitleClick

    Can anybody tell me when, Delphi version, TDBGrid.Options - dgTitleClick was introduced? Regards & TIA, Ian
  18. Ian Branch

    TDBGrid - dgTitleClick

    Thanks Lajos, I got sent this earlier.. " Delphi 2010 and greater: needs dgTitleClick true (grid options) for this to run: frmItems.DBGrid1TitleClick dgTitleHotTrack : Specifies that list items are highlighted when the mouse passes over them. (highlights the title cell.. maybe other cells in that column too). dgTitleClick & dgTitleHotTrack default to true on new forms. " So I have worked on that basis. Regards, Ian
  19. Hi Team D10.4.1. I have an OnChange DataSet event in a DataModule. The the DataModule is used by multiple apps but only a few of them need the OnChangeEvent procedure. ATT I have this construct.. procedure dsJTDataChange(Sender: TObject; Field: TField); begin {$IF Defined(MyApp1) or Defined(MyApp2)} // ... ... {$ENDIF} end; This is all working fine but I was wondering, is there any way to condition out the actual procedure in total? Something like.. {$IF Defined(MyApp1) or Defined(MyApp2y)} procedure dsJTDataChange(Sender: TObject; Field: TField); begin // .... .... end; {$ENDIF} Of course I would need to apply the same conditional to the procedure definition in the class. {$IF Defined(MyApp1) or Defined(MyApp2)} procedure dsJTDataChange(Sender: TObject; Field: TField); {$ENDIF} the obvious problem is that if that is done then Delphi loses visibility of the dsJT OnDataChange event. i.e. MyApp3, MyApp4, etc. Is there any way around this?? Regards & TIA, Ian
  20. Ian Branch

    Make a complete DataSet event conditional??

    I too like Atilla's term, unfortunately, I don't ride horses. ;-) So, I ended up reviewing the suggestions here and did some more research. Being lazy and not wishing to rewrite anything, I ended up with the following constructs... In the Datamodule class definition I added these.. // Local procedures defined for redirection to JTs & dsJTs at Run Time if Apps are App1 or App2. {$IF Defined(App1) or Defined(App2)} procedure MydsJTDataChange(Sender: TObject; Field: TField); procedure MyJTAfterEdit(DataSet: TDataSet); procedure MyJTBeforePost(DataSet: TDataSet); procedure MyJTAfterPost(DataSet: TDataSet); procedure MyJTNewRecord(DataSet: TDataSet); {$ENDIF} These were of course a simple rename of the existing procedures. Then in the Datamodule's Create Event I added the following.. // // Assigning JTs & dsJTs events to local procedures at run time. {$IF Defined(App1) or Defined(App2)} dsJT.OnDataChange := MydsJTDataChange; JT.AfterEdit := MyJTAfterEdit; JT.BeforePost := MyJTBeforePost; JT.AfterPost := MyJTAfterPost; JT.OnNewRecord := MyJTNewRecord; {$ENDIF} // Then of course I renamed the original procedures to My.. and wrapped them in the basic.. {$IF Defined(App1) or Defined(App2)} .... {$ENDIF} This may or may not meet everybody's expectations/preferences, but, it keeps the code where I have become used to where it is over the years and I have no issue with maintaining {$IF... }/{$ENDIF} constructs. Again, I have learnt something new. A good day. Thank you all again for your input. Regards, Ian
  21. Hi Team, I needed a routine that would tell me if either of two dates from a database table were valid before being tested for other characteristics. I came up with the following.. function AreValidDates(const DateString1, DateString2: string): Boolean; var DT: TDateTime; // unused date time value begin // Result := TryStrToDate(DateString1, DT); // if Result then Result := TryStrToDate(DateString2, DT); // end; The Function is called by "if AreValidDates(MyTable.FieldByName('Date1').AsString, MyTable.FieldByName('Date2').AsString) then..." The function is used in many places in my Apps. Is there a better/more efficient way to do this? Regards & TIA, Ian
  22. Ian Branch

    Are Valid Dates?

    Hi Team, Just to close this one off. I revisited all the various Date data entry points, 7 different dates in all, and confirmed they can only be either Null or a valid date. Then using my new Helper knowledge I created the following Helper based on Kas' suggestion.. { TQueryHelper } // Parameters are FieldNames in this case function TQueryHelper.AreDBDatesNull(const DateString1, DateString2: string): Boolean; begin // Result := (not FieldByName(DateString1).IsNull) and (not FieldByName(DateString2).IsNull); // end; // // Implemented by.. if MyQuery.AreDBDatesNull('Date1', 'Date2') then ..... Simpler, and testing the data fields directly rather than 'converting' them. Thank you all for your input & contributions. Have a Great 2021. Regards, Ian
  23. Ian Branch

    Are Valid Dates?

    Hi Thomas, Thank you for your input. They are stored as Dates. My original code at the start of this thread was simply where I ended up after considering some alternatives. I have now implemented the Helper per Kas' suggestion. Something new I have learnt today. 🙂 I will have a look in dzLib, I have it here. Ian
  24. Ian Branch

    Are Valid Dates?

    Now that's neat. I did have a look at that link but my knowledge depth wasn't up to it and I got confused. 😞 I can follow your example though and can see how it could be extended/used in other areas. Regards & Tks, Ian
  25. Ian Branch

    Are Valid Dates?

    Hi Kas, Now that's an intriguing idea. Perhaps not for this case but I would be interested in how it is done. Can you point me to appropriate material? A Tutorial or similar.. Regards & TIA, Ian
×