Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : OOPMENU.ZIP
Filename : MENUITEM.PRG

 
Output of file : MENUITEM.PRG contained in archive : OOPMENU.ZIP
/*
MenuItem.prg - Class(y) menu item class

Copyright (c) 1991, 1992 Chris Muller and Anton van Straaten
*/

#include "class(y).ch"

#define HOT_MARK "~"


// color positions/prompt status
#define NORMAL 1 // Normal
#define HOTKEY 2 // Inverse (hot letter)
#define HILITE 3 // Highlighted normal
#define INACTIVE 4 // Inactive
#define HI_INACTIVE 5 // Highlighted inactive


CREATE CLASS MenuItem
VAR hotPos
VAR hotKey

EXPORT:
VAR label READONLY
VAR action READONLY
VAR row, col READONLY
VAR isActive READONLY
VAR len READONLY

METHOD draw
METHOD hilite
METHOD nextCol, nextRow
END CLASS


CONSTRUCTOR new( nRow, nCol, cLabel, oAction, isActive )
::row := nRow
::col := nCol
::action := oAction
::isActive := IF( isActive == NIL, .t., isActive )
::hotPos := AT( HOT_MARK, cLabel )
IF ::hotPos > 0
::hotKey := SUBSTR( cLabel, ::hotPos + 1, 1 )
ENDIF
::label := STRTRAN( cLabel, HOT_MARK )
::len := LEN( ::label )
RETURN


METHOD PROCEDURE hilite( tgtWin )
::draw( tgtWin, HILITE )
RETURN


METHOD PROCEDURE draw( tgtWin, nColor )
IF nColor == NIL
nColor := NORMAL
ENDIF
tgtWin:sayAt(::row, ::col, ::label, if(::isActive, nColor, INACTIVE))

IF ::hotPos > 0 .AND. nColor <> HILITE
tgtWin:sayAt(::row, ::col + ::hotPos - 1, ::hotKey, HOTKEY)
ENDIF
RETURN


METHOD nextRow
RETURN ::row + 1


METHOD nextCol
RETURN ::col + ::len


// eof menuitem.prg


  3 Responses to “Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : OOPMENU.ZIP
Filename : MENUITEM.PRG

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/