Skip to main content
www.olaf-groeger.de

Main navigation

  • Home
  • NMR
  • Programming
    • Streams
    • Subclassing of edit controls
  • Software
    • Calimah Scheduler
    • ServicesCtl

Breadcrumb

  1. Home
  2. Programming
  3. Subclassing of Edit Controls

Subclassing of edit controls

By olaf , 3 July 2025
This is an implementation for MFC with C++ and is quite antiquated.

I'll demonstrate the subclassing of edit controls using the example of a input control for frequency values. The goal is to implement an input control that accepts only numbers and the units Hz, kHz and MHz as input and formats the input automagically. The input of "6000 h" should be formatted to "6 Khz", the input of "1234,567 k" should be formatted to "1.234567 MHz".

  • CHertzEdit.h
  • Members and constructors/destructors
  • Conversions between the data types double and CString
  • Implement the message handlers for WM_CHAR
  • Implementation of the setter/getter methods
  • Implementation of the DDX method
  • Implementation of the message handler for WM_KILLFOCUS
  • Usage (e.g. in a dialog window)
  • Summary/Download

Book traversal links for 15

  • CHertzEdit.h

Language switcher

  • English
  • German
Powered by Drupal