Click here to Skip to main content
15,887,832 members
Articles / Programming Languages / C++

Scroll LED-Matrix Class

Rate me:
Please Sign up or sign in to vote.
4.95/5 (16 votes)
4 Feb 2014CPOL3 min read 30.8K   3.2K   38  
C++ classes that implement scrolling simulated-LED displays
  • led.scroll.src.zip
  • fntcol17.zip
    • &arabic.f14
    • &europe.f14
    • &farsi.f14
    • &gaelic.f14
    • &greek.f14
    • &hebrew.f14
    • &polish.f14
    • &russian.f14
    • &turkish.f14
    • &urdu.f14
    • &yugosla.f14
    • 00-files.lst
    • 2_hebrew.f14
    • 2_hebrew.f16
    • antique.f14
    • apeaus.f08
    • apeaus.f14
    • apeaus.f16
    • apls.f08
    • arabdrft.f14
    • arabkufi.f14
    • arabnaf.f14
    • arbnaskh.f14
    • armenian.f08
    • armenian.f14
    • armenian.f16
    • art.f16
    • ascii.f14
    • backward.f14
    • bdeclo.f14
    • bhexall.f14
    • bhexbox.f14
    • bhexhi.f14
    • bhexlo.f14
    • bigserif.f14
    • bigserif.f16
    • bigsf.f14
    • binaryed.f14
    • blcksnsf.f10
    • block.f14
    • bold.f14
    • boxround.f14
    • boxround.f16
    • broadway.f14
    • broadway.f19
    • broadway.f8
    • broadway.f9
    • bthin.f14
    • bway2.f14
    • cafe.f10
    • cafe.f12
    • cntdown.f14
    • cntdown.f16
    • computer.f14
    • copyleft.txt
    • courier.f14
    • courier.f19
    • courier.f8
    • courier.f9
    • cp111.f08
    • cp111.f14
    • cp111.f16
    • cp111.f19
    • cp112.f08
    • cp112.f14
    • cp112.f16
    • cp112.f19
    • cp113.f08
    • cp113.f14
    • cp113.f16
    • cp113.f19
    • cp437.f08
    • cp437.f14
    • cp437.f16
    • cp437.f19
    • cp437alt.f08
    • cp437bgr.f08
    • cp850.f08
    • cp850.f14
    • cp850.f16
    • cp850.f19
    • cp851.f08
    • cp851.f14
    • cp851.f16
    • cp851.f19
    • cp852.f08
    • cp852.f14
    • cp852.f16
    • cp852.f19
    • cp853.f08
    • cp853.f14
    • cp853.f16
    • cp853.f19
    • cp860.f08
    • cp860.f14
    • cp860.f16
    • cp860.f19
    • cp861.f08
    • cp861.f14
    • cp861.f16
    • cp861.f19
    • cp862.f08
    • cp862.f14
    • cp862.f16
    • cp863.f08
    • cp863.f14
    • cp863.f16
    • cp863.f19
    • cp864.f08
    • cp864.f14
    • cp864.f16
    • cp865.f08
    • cp865.f14
    • cp865.f16
    • cp865.f19
    • cp866.f08
    • cp866.f14
    • cp866.f16
    • cp880.f08
    • cp880.f14
    • cp880.f16
    • cp881.f08
    • cp881.f14
    • cp881.f16
    • cp882.f08
    • cp882.f14
    • cp882.f16
    • cp883.f08
    • cp883.f14
    • cp883.f16
    • cp884.f08
    • cp884.f14
    • cp884.f16
    • cp885.f08
    • cp885.f14
    • cp885.f16
    • cyril_b.f08
    • cyril2.f14
    • cyrill1.f08
    • cyrill1.f14
    • cyrill1.f16
    • cyrill2.f08
    • cyrill2.f14
    • cyrill2.f16
    • cyrill3.f08
    • cyrill3.f14
    • cyrill3.f16
    • cyrillic.f14
    • data.f14
    • data.f19
    • data.f8
    • data.f9
    • decorate.f16
    • draw.f14
    • drawhi.f14
    • evga-alt.f08
    • evga-alt.f09
    • evga-alt.f10
    • evga-alt.f11
    • evga-alt.f12
    • evga-alt.f13
    • finnish.f14
    • fontorig.txt
    • fractur.f14
    • future.f14
    • gaelic.f14
    • georgian.f14
    • grckssrf.f08
    • grckssrf.f14
    • grckssrf.f16
    • greek.f06
    • greek.f07
    • greek.f08
    • greek.f14
    • greek.f16
    • greek2.f14
    • hack4th.f16
    • handugly.f16
    • handwrit.f14
    • handwrit.f16
    • heb-7bit.f16
    • heb-big.f14
    • heb-bold.f16
    • hebboldk.f16
    • hebclrgf.f14
    • hebclrgf.f16
    • heb-ktab.f14
    • hebktav1.f16
    • hebktav2.f16
    • heblarge.f14
    • heblarge.f16
    • heb-med.f14
    • heb-snsf.f14
    • hebugly.f16
    • hebyogi.f16
    • hercital.f08
    • hercules.f08
    • hercules.f10
    • hercules.f14
    • history.txt
    • hollow.f14
    • hrkgreek.f14
    • hylas.f14
    • icons.f14
    • inverted.f14
    • iso.f14
    • iso2.f14
    • iso3.f14
    • iso4.f14
    • italics.f14
    • kana.f14
    • kana.f16
    • lb_large.f16
    • lb_misc.f14
    • lb_ocr.f14
    • lb_ocr.f16
    • lbarabic.f14
    • lbitalic.f14
    • lbitalic.f16
    • lbscript.f14
    • lcd.f14
    • looking4.txt
    • mac.f08
    • macntosh.f14
    • macntosh.f16
    • madrid.f10
    • medieval.f14
    • modern.f16
    • newfont1.f14
    • newfont1.f19
    • newfont1.f8
    • newfont1.f9
    • newfont2.f14
    • newfont2.f19
    • newfont2.f8
    • newfont2.f9
    • newfont3.f14
    • newfont3.f19
    • norway.f14
    • norway2.f14
    • oldeng.f14
    • oldeng-f.f16
    • oldengl.f14
    • old-engl.f14
    • old-engl.f16
    • oldengl.f19
    • pc.f14
    • pc.f19
    • pc.f24
    • pc.f8
    • pc.f9
    • pc_6.f14
    • pc_7.f14
    • pc-sc.f14
    • pc-sc.f19
    • pc-sc.f8
    • pc-sc.f9
    • persian.f14
    • persian.f16
    • police.f16
    • polish.f14
    • pp_roman.f16
    • pp_sser.f16
    • readabl7.f16
    • readabl8.f16
    • readable.f08
    • readable.f10
    • reverse.f14
    • rimrock.f10
    • rmrkbold.f14
    • rom8pix.f08
    • roman.f14
    • roman.f16
    • roman1.f14
    • roman1.f19
    • roman1.f8
    • roman1.f9
    • roman2.f14
    • roman2.f19
    • roman2.f8
    • roman2.f9
    • runic.f14
    • runic.f16
    • russian.f08
    • russian.f14
    • russian.f16
    • sans1.f14
    • sans1.f19
    • sans1.f8
    • sans1.f9
    • sans1-sc.f14
    • sans1-sc.f19
    • sans1-sc.f8
    • sans1-sc.f9
    • sans2.f14
    • sans2.f19
    • sans2.f8
    • sans2.f9
    • sans2-sc.f14
    • sans2-sc.f19
    • sans2-sc.f8
    • sans2-sc.f9
    • sans3.f14
    • sans3.f19
    • sans3-sc.f14
    • sans3-sc.f19
    • sans4.f14
    • sans4.f19
    • sans4-sc.f14
    • sans4-sc.f19
    • sanserif.f14
    • sanserif.f16
    • script.f14
    • script1.f14
    • script1.f19
    • script1.f8
    • script1.f9
    • script2.f14
    • script2.f19
    • script2.f8
    • script2.f9
    • scrwl---.f16
    • scrwl~~~.f16
    • security.f14
    • side.f10
    • slant.f14
    • smalcaps.f14
    • smcapnum.f14
    • spranto.f14
    • spranto1.f16
    • spranto2.f16
    • square.f12
    • standard.f14
    • standard.f16
    • stretch.f14
    • subsup.f16
    • super.f16
    • swiss.f16
    • swiss-av.f16
    • swissav2.f16
    • swissbox.f16
    • swissbx2.f16
    • tex-math.f14
    • tex-math.f16
    • thai.f14
    • thin.f08
    • thin.f10
    • thin_ss.f08
    • thin_ss.f14
    • thin_ss.f16
    • thinasci.f07
    • thincaps.f14
    • thindemo.f14
    • thinscrp.f14
    • uv.cnf
    • vga-rom.f08
    • vga-rom.f14
    • vga-rom.f16
    • voynich.f16
    • wiggly.f16
    • windows.f14
    • windows.f19
    • windows.f8
    • windows.f9
    • yogiprog.inf
  • led.scroll.zip
  • led.scroll-noexe.zip
  • led.scroll-noexe-noexe.zip
//****************************************************************************
//  Copyright (c) 2008-2014  Daniel D Miller
//  tooltips.cpp - tooltip functions/data
//
//  Written by:  Dan Miller
//****************************************************************************
//  Usage:
//    HWND hToolTip = create_tooltips(hwnd, 150, 100, 10000) ;
//    add_program_tooltips(hwnd, hToolTip) ;
//****************************************************************************

#include <windows.h>
#include <tchar.h>
#define  _WIN32_IE   0x0501
#include <commctrl.h>

#include "resource.h"
#include "common.h"

//  there's a programmatic way to find this, but I can never 
//  remember the danged function name!!
extern HINSTANCE g_hinst ;

//  static tooltip-list struct
typedef struct tooltip_data_s {
   uint ControlID ;
   TCHAR *msg ;
} tooltip_data_t ;

//****************************************************************************
HWND create_tooltips(HWND hwnd, uint max_width, uint popup_msec, uint stayup_msec)
{
   HWND hToolTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP,
         CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, //lint !e569
         hwnd, NULL, g_hinst, NULL);
   if (hToolTip == NULL) {
      syslog("ToolTip CreateWindowEx: %s\n", get_system_message()) ;
   } else {
      SendMessage(hToolTip, TTM_SETMAXTIPWIDTH, 0, max_width) ;
      SendMessage(hToolTip, TTM_SETDELAYTIME, TTDT_INITIAL, popup_msec) ;
      SendMessage(hToolTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, stayup_msec) ;
   }
   return hToolTip ;
}

//****************************************************************************
static void add_tooltip_target(HWND parent, HWND target, HWND hToolTip, TCHAR *msg)
{
   // static bool hex_dump_was_run = false ;
   TOOLINFO ti;
   ti.cbSize = sizeof(TOOLINFO);
   ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
   ti.hwnd = parent;
   ti.uId = (UINT) target;
   ti.lpszText = msg ;
   bool bresult = SendMessage(hToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
   if (!bresult) {
      syslog("TTM_ADDTOOL: %u: %s\n", target, get_system_message()) ;
   }
}

//****************************************************************************
//  CommPort dialog tooltips
//****************************************************************************
static tooltip_data_t const program_tooltips[] = {
{ IDS_FONTNAME,      _T("Filename of current font")},
{ IDC_FONTNAME,      _T("Filename of current font")},
{ IDB_LOAD_FONT,     _T("Load different font file" )},
{ IDC_RB_ROUND,      _T("Change displayed font bits to filled circles" )},
{ IDC_RB_SQUARE,     _T("Change displayed font bits to filled squares" )},
{ IDS_PIXDIAM,       _T("Set diameter of displayed font bits" )},
{ IDC_PIXDIAM,       _T("Set diameter of displayed font bits" )},
{ IDS_BITGAP,        _T("Set gap between font bits (in pixels)" )},
{ IDC_BITGAP,        _T("Set gap between font bits (in pixels)" )},
{ IDS_CHARGAP,       _T("Set gap between characters (in pixels)" )},
{ IDC_CHARGAP,       _T("Set gap between characters (in pixels)" )},
{ IDB_ATTR_SET,      _T("Set color of SET (ON) font bits" )},
{ IDC_SHOW_SET,      _T("Set color of SET (ON) font bits" )},
{ IDB_ATTR_CLEAR,    _T("Set color of CLEARED (OFF) font bits" )},
{ IDC_SHOW_CLEAR,    _T("Set color of CLEARED (OFF) font bits" )},
{ IDB_ATTR_BGND,     _T("Set background color of display field" )},
{ IDC_SHOW_BGND,     _T("Set background color of display field" )},
{ IDOK,              _T("Close this program" )},

//  This is how to enter multi-line tooltips:
// { IDS_CP_SERNUM,     _T("The SEND CMD button will send COMMAND to the device with")
//                      _T("this Serial Number.  If Serial Number is 0, COMMAND is sent ")
//                      _T("to the broadcast address on the current port.") },

{ 0, NULL }} ;

void add_program_tooltips(HWND hwnd, HWND hwndToolTip)
{
   unsigned idx ;
   for (idx=0; program_tooltips[idx].ControlID != 0; idx++) {
      add_tooltip_target(hwnd, GetDlgItem(hwnd, program_tooltips[idx].ControlID),
         hwndToolTip, program_tooltips[idx].msg) ;
   }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Retired
United States United States
I have worked for 25+ years as a firmware engineer, in various environments. In my private life, I create a variety of applications, including console applications in Linux and Windows, and GUI applications in Windows. All of my programs and code snippets are freeware, with source code available. All programs are written in C or C++, and built using the MinGW toolchain.

Comments and Discussions