Skip to content

refactor: migrate first batch of Forms to FormBase#4690

Open
mvanhorn wants to merge 2 commits intoTASEmulators:masterfrom
mvanhorn:osc/4005-formbase-batch1
Open

refactor: migrate first batch of Forms to FormBase#4690
mvanhorn wants to merge 2 commits intoTASEmulators:masterfrom
mvanhorn:osc/4005-formbase-batch1

Conversation

@mvanhorn
Copy link
Copy Markdown

Migrated 7 forms from Form to FormBase as tracked in #4005:

  • ArchiveChooser
  • FFmpegWriterForm
  • GifWriterForm
  • JmdForm
  • SynclessRecordingTools
  • AutofireConfig
  • ControllerConfig

Each change is a one-line base class swap. The remaining forms from the checklist can follow in subsequent PRs.

Partial fix for #4005

Changed base class from Form to FormBase for 7 forms:
- ArchiveChooser
- FFmpegWriterForm
- GifWriterForm
- JmdForm
- SynclessRecordingTools
- AutofireConfig
- ControllerConfig

Part of TASEmulators#4005. The remaining forms can follow in subsequent PRs.
@YoshiRulz YoshiRulz added App: EmuHawk Relating to EmuHawk frontend Meta Relating to code organisation or to things that aren't code labels Apr 20, 2026
Copy link
Copy Markdown
Member

@YoshiRulz YoshiRulz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for stepping up, but just changing the supertype isn't enough, you at least need to override WindowTitleStatic (which is not abstract for technical reasons). These will all throw when opened because of that, so clearly you haven't done any testing either. The main thing to test would be the Alt+key "mnemonics".

Address @YoshiRulz's review on TASEmulators#4690. Changing the supertype alone was
not enough: FormBase's WindowTitleStatic throws NotImplementedException
by default (it is virtual instead of abstract only because the Designer
does not tolerate abstract), and FormBase's Text setter throws
InvalidOperationException when hit outside DesignMode. Without the
override, every one of these forms would throw on OnLoad before being
shown.

For each of the seven forms in this batch, add
  protected override string WindowTitleStatic => "<title>";
using the title that was previously set in the Designer, and remove the
`this.Text = "<title>";` line from the Designer (it would throw at
runtime now that the supertype's Text setter is guarded).

Fixed forms:

- ArchiveChooser: "Choose File From Archive"
- FFmpegWriterForm: "Choose Video Format"
- GifWriterForm: "GIF Writer Options"
- JmdForm: "JMD Compression Options"
- SynclessRecordingTools: "Syncless Recording"
- AutofireConfig: "Autofire Configuration"
- ControllerConfig: "Controller Config"

Honest note on testing: BizHawk is a Windows host and I am on macOS
without a working .NET build, so I cannot run these forms interactively
or exercise the Alt+key mnemonics end-to-end from here. The pattern
follows existing FormBase-derived forms (CDL, HexEditor, GBAGPUView,
etc.) that already override WindowTitleStatic and do not set
`this.Text` in their designers.
@mvanhorn
Copy link
Copy Markdown
Author

@YoshiRulz you're right, and thank you for the direct feedback. The supertype change alone would have thrown on every one of these forms - I missed that WindowTitleStatic is virtual-not-abstract and that FormBase's Text setter throws outside DesignMode.

Pushed 59a6fcc which for each of the seven forms:

  • adds protected override string WindowTitleStatic => "<title>"; using the exact title that was in the Designer
  • removes this.Text = "<title>"; from the Designer

Followed the pattern from existing FormBase-derived forms (CDL, HexEditor, GBAGPUView).

Honest note on testing: I'm on macOS without a working .NET build, so I cannot open these forms or drive the Alt+key mnemonics from here. If the pattern checks out for you and you'd like, I'm happy to leave this PR paused until I can set up a Windows env to verify, or close it and resubmit from there. Totally understand if you'd rather not merge something I can't demonstrate running.

@YoshiRulz YoshiRulz dismissed their stale review April 20, 2026 08:56

addressed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

App: EmuHawk Relating to EmuHawk frontend Meta Relating to code organisation or to things that aren't code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants