Jump to content

Chris1701

Members
  • Content Count

    26
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. Chris1701

    Change a forms OnShow Event?

    I have tons of programs with forms that have an OnShow procedure that the forms OnShow event calls and I've never had an issue; and even if that is true that doesn't explain why can't I set the dialogs forms OnShow property to nil to do nothing or set it to an alternate compatible procedure to do something different?
  2. Chris1701

    Change a forms OnShow Event?

    Ok that's an alternate way to do it but still doesn't explain why can't I set the dialogs OnShow property to nil to do nothing or set it to an alternate compatible procedure to do something different?
  3. Chris1701

    Change a forms OnShow Event?

    I'm using Delphi 12.2. Patch 2 and I'm trying to accomplish something that I've never had to do and I'm having a problem figuring it out. I have a dialog that is created and then called and freed by a particular form; this dialog is written with a default OnShow event. Now I've discovered that I want to reuse that dialog in another place however the OnShow event is not correct for that 2nd usage and before I use .ShowModal I want to either blank the OnShow event or reassign it to a different event that has the correct code for the 2nd usage and so far the things I've tried have failed: First thing, I know for something like a TButton you can set the OnClick event to Nil i.e. Button.OnClick := Nil; but MyDialogForm.OnShow := Nil; after the form is created "MyDialogForm := TMyDialogForm.Create(Application);" shows an error of E2025 Not enough actual parameters; likewise if I create an alternate OnShow procedure "procedure TMyDialogForm.OnShowNoProc(Sender: TObject);" and then after the dialog is created but before it's called I try MyDialogForm.OnShow := MyDialogForm.OnShow := MyDialogForm.OnShowNoProc;; I end up with the same error message Not enough actual parameters. What what am I doing wrong here, how can I either set the forms OnShow to Nil (do nothing) or reassign the OnShow event to an alternate procedure?
  4. Chris1701

    TStringgrid how to automatically set the column widths

    Thanks Remy, I found this code on an old StackOverflow thread so I didn't write it and was just trying to make it work. The change you suggested worked like a charm, thanks so much! Merry Christmas!
  5. I have a form with a TStringgrid that I'd like to be able to programmatically set the column widths based on the text lengths in the grid itself. I used Google to search and didn't find a whole lot but I did find someone who provided this: Procedure TEditSeriesForm.SetColumnFullWidth( Var Grid: TStringGrid; ACol: Integer); var I, Str_Width, Col_Width: Integer; begin { set the width of the defined column in a string grid to the width of the widest string } Str_Width:=0; Col_Width:=0; For i := 0 To Grid.RowCount - 1 do begin // get the pixel width of the complete string Col_Width := EditSeriesForm.Canvas.TextWidth(Grid.Cells[Acol,i]); // if its greater, then put it in str_width If col_width>str_width then str_width:=col_width; end; Grid.ColWidths[Acol] := col_width+5; // +5 for margins. adjust if neccesary End; The problem is that this line of code "Col_Width := EditSeriesForm.Canvas.TextWidth(Grid.Cells[Acol,i]);" generates an exception class $C0000005 with message 'C0000005 ACCESS_VIOLATION" so I have no idea why this doesn't work so does anyone know offhand what's wrong with this or have an alternate method for checking and setting the string grid column widths based on the length of the text values in each column?
  6. Chris1701

    Delphi 12 TADOConnection Provider not found?

    Sorry, I just gave up on this because no matter what I couldn't get it to work. I switched to Firebird V4 Embedded which seems to work fine. Thanks for trying to help.
  7. Chris1701

    Delphi 12 TADOConnection Provider not found?

    After I posted I did look at that and it does say MS Access database 64bit, I don't see any option to test a connection string?
  8. I'm in the process of rewriting a program that uses a simple Microsoft Access database which I access using TADOConnection the original program was like Delphi XE and 32bit and I'm now using Delphi 12 64bit. The problem that I'm having is that in the IDE if I check off the "Connected" it connects without an error but during runtime I get "EOleException with message Provider cannot be found. It may not be properly installed." Just an fyi I'm running Windows 11 Pro and I have Microsoft Office Pro 2019 x64 installed. The old version of this program still works without an error so I think it's pretty obvious that this is a problem with compiling to 64bit so I checked and downloaded and installed the Microsoft accessdatabaseengine_X64 installer but I'm still getting this error, so what do I need to do in order to resolve this problem? Thanks!
  9. Chris1701

    Delphi 12 Application showing two windows on the taskbar?

    The dpr file other than the usual uses is: begin Application.Initialize; Application.MainFormOnTaskbar := True; Application.CreateForm(TdmData, dmData); Application.CreateForm(TMainForm, MainForm); Application.Run; end. So no, I'm not setting Application.MainformOnTaskbar to false and I'm not doing anything to override the CreateParams method or CreateWnd.
  10. Chris1701

    Delphi 12 Application showing two windows on the taskbar?

    I'll see what I can do but this is the only project that I've migrated to Delphi 12 that has this problem, none of my other projects have this issue and I'm not sure why.
  11. Chris1701

    Delphi 12 Application showing two windows on the taskbar?

    This is not an MDI application, it's hard to get a screen capture while hovering the mouse over the taskbar icon but I don't believe a larger image will make a difference. This is a picture of the same program compiled and run under Delphi 11.3 and you can see that when you hover the mouse over the programs task bar icon you can see that there is only one program window compared to 12 where for some odd reason two program windows appear on the taskbar. When you hover the mouse over the taskbar icon on the V12 build and you see two Windows no matter which you click on you get the proper program window (on the desktop) showing the form with the proper caption i.e. "My Database application" and you can't bring up or maximize the window that doesn't have the forms caption but instead shows the executable name i.e. "MyDatabase.exe" as the caption.
  12. I have hundreds of various projects that I've created over the years, I just went to make changes to one that I haven't worked on for a few months and last time I worked on it was with Delphi 11.3 and now I'm compiling and running it in Delphi 12 and it's an x64 Vcl application. The problem that I'm having it that when I hover the mouse over the taskbar icon it shows two program windows (see picture) and when I hover the mouse over the left appearing window it shows me the proper program form and the form title is the correct caption for the applications main form but if I hover the mouse over the right window the caption of that form appears to be the executable name rather than the caption and if you click on it all that pops up is the left appearing and correct program window / form. None of the other applications that I've converted to Delphi 12 seem to have this problem and just on the off chance that it was a problem with the project, I closed the project and deleted the project files and recreated the project and the new project seems to have the same problem. Just to be sure this is a Delphi 12 problem I opened the project in Delphi 11.3 and when I run it I don't have this problem with two application windows appearing on the taskbar. Has anyone ever seen this in any program on Delphi 12?
  13. Chris1701

    Using Regex for file name matching?

    Thanks that's very helpful!
  14. I'm trying to figure out how to use regular expressions to test file names for matching results and the test program that I have is failing rather badly. It's basically a form with some labels / TEdits / a listbox and a button, so enter the pattern in the pattern tedit and enter the text in the text tedit and click the test button to see if it matches: procedure TMainForm.TestClick(Sender: TObject); begin If TRegEx.IsMatch( edText.Text, edPattern.Text ) Then lbData.Insert( 0, 'True' ) Else lbData.Insert( 0, 'False' ); end; For example if I enter "*.pas" in the edPattern edit and "myfiletest.pas" in edPattern and click Test the program throws an error "Project RegExpressText.exe raised exception class ERegularExpressionError with message 'Error in regular expression at offset 0: nothing to repeat'." So none of the things I see to try such as pattern "*mydata*.*" and text "thisismydata.csv" generate the same error however the preloaded test data Pattern "Er*" and text "Er S01 D01" does not cause and error and comes back True. What am I doing wrong here? Thanks!
  15. Chris1701

    Trap TFDConnection error on data module create etc?

    I unchecked both and checked compiled "Connected" and tried transferring the program to the tablet and that does fix the problem. Thanks so much, this was the most simple and straightforward fix for the issue.
×