G
gw7rib
I'm writing a program which has "notes" - these can appear on the
screen as windows with text in. It is possible to create an "index
note" - at present, this will contain a list of the titles (or other
data, you can choose) of some or all of the notes - you can choose the
selection criteria. Thus you can create notes to store any text you
want to, in a relatively free manner, but you can easily fish out all
the notes relating to some particular topic.
When the index note is present, it has an arrow pointing at one line.
If the index note has the focus, then pressing up will move the arrow
up a line, pressing down will move it down a line, and pressing control
right will move to the note corresponding to that line. The interface
is like that at present because I've converted the program from a DOS
one; the hope is to write a more Windowsy interface later.
At present all the index note stuff is done using globals. I would like
to try to move some of the code and data into the index note itself.
One way to do this would be to derive a class Indexnote from my
existing class Note, and put the extra code there. However, I am having
a moment of doubt as to the best way to call the additional code.
One way would be to have, say, functions goup, godown and gotonote as
part of Indexnote, and call them as required using a cast. For
instance,
case WM_KEYDOWN:
if (wParam == VK_UP && currentnote -> isindexnote()) (Indexnote *)
currentnote -> goup();
but I am not particularly happy using the cast. Presumably it could
also cause problems if I had further classes derived from Indexnote so
currentnote wasn't in fact merely an Indexnote.
The other approach would be to have the functions goup, godown and
gotonote as part of Note, but not doing anything in the base class.
Then I could do:
case WM_KEYDOWN:
if (wParam == VK_UP && currentnote -> isindexnote()) currentnote ->
goup();
but it seems a bit odd creating functions that have no real meaning.
The first approach is closer to what I have in my head.
So, can anyone advise as to the best technique, or suggest some other
way of doing it? Any other comments would be welcome as well.
TIA.
Paul.
screen as windows with text in. It is possible to create an "index
note" - at present, this will contain a list of the titles (or other
data, you can choose) of some or all of the notes - you can choose the
selection criteria. Thus you can create notes to store any text you
want to, in a relatively free manner, but you can easily fish out all
the notes relating to some particular topic.
When the index note is present, it has an arrow pointing at one line.
If the index note has the focus, then pressing up will move the arrow
up a line, pressing down will move it down a line, and pressing control
right will move to the note corresponding to that line. The interface
is like that at present because I've converted the program from a DOS
one; the hope is to write a more Windowsy interface later.
At present all the index note stuff is done using globals. I would like
to try to move some of the code and data into the index note itself.
One way to do this would be to derive a class Indexnote from my
existing class Note, and put the extra code there. However, I am having
a moment of doubt as to the best way to call the additional code.
One way would be to have, say, functions goup, godown and gotonote as
part of Indexnote, and call them as required using a cast. For
instance,
case WM_KEYDOWN:
if (wParam == VK_UP && currentnote -> isindexnote()) (Indexnote *)
currentnote -> goup();
but I am not particularly happy using the cast. Presumably it could
also cause problems if I had further classes derived from Indexnote so
currentnote wasn't in fact merely an Indexnote.
The other approach would be to have the functions goup, godown and
gotonote as part of Note, but not doing anything in the base class.
Then I could do:
case WM_KEYDOWN:
if (wParam == VK_UP && currentnote -> isindexnote()) currentnote ->
goup();
but it seems a bit odd creating functions that have no real meaning.
The first approach is closer to what I have in my head.
So, can anyone advise as to the best technique, or suggest some other
way of doing it? Any other comments would be welcome as well.
TIA.
Paul.