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. 5 1394
On Jan 9, 11:41 am, gw7...@aol.com wrote:
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.
I'm not very familiar with the way things work in windows so I can't
say what the best way to handle the key-events are but you could create
a method in the Note-class that takes the key-code as parameter and
then let the IndexNote-class override that method and add the needed
functionality.
If your note-program work the way I think it might be worth
investigating whether it would be possible for every note to "link" to
other notes like the index-note. So that a user can have a
note-hierarchy, which would mean that there would be no differance
between the index-note and other notes.
--
Erik Wikström
Erik Wikström wrote:
On Jan 9, 11:41 am, gw7...@aol.com wrote:
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.
I'm not very familiar with the way things work in windows so I can't
say what the best way to handle the key-events are but you could create
a method in the Note-class that takes the key-code as parameter and
then let the IndexNote-class override that method and add the needed
functionality.
Thanks for your comments, Erik. I'm not sure that simply sending the
key-codes directly to the Note-class is the best approach - my feeling
is that my program ought to decide what it wants to happen when a key
is pressed and should tell the note to do that. Especially as in many
Windows programs there are often many ways of doing the same thing (key
presses, mouse clicks etc) and I feel this should be under the control
of the program. For example, instead of the program saying to the note
"The user has pressed up arrow - do what you think best about it" the
program ought to tell the note "do a go-up".
If your note-program work the way I think it might be worth
investigating whether it would be possible for every note to "link" to
other notes like the index-note. So that a user can have a
note-hierarchy, which would mean that there would be no differance
between the index-note and other notes.
I'm trying to make the program fairly simple to use. I wrote a program
before which contained items and directories of items, and you could
list the items in a directory, the items and subdirectories in a
directory, or all the items in or subsidiary to a directory - but it
was horrible to actually use so I didn't persist with it. With the
current system, you can create a note whose text is:
sort updated
show title updated
and pressing "enter" on this note will create an index note listing all
the notes in order of being updated. Another note might have the text:
select category fix
sort priority
show title
and pressing enter on this tells you all the things you need to fix, in
order of priority. So the index note is created to order - it has
different text (and different notes listed) depending on the text of
the creating note.
On 2007-01-10 18:00, gw****@aol.com wrote:
Erik Wikström wrote:
>On Jan 9, 11:41 am, gw7...@aol.com wrote:
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.
I'm not very familiar with the way things work in windows so I can't say what the best way to handle the key-events are but you could create a method in the Note-class that takes the key-code as parameter and then let the IndexNote-class override that method and add the needed functionalit y.
Thanks for your comments, Erik. I'm not sure that simply sending the
key-codes directly to the Note-class is the best approach - my feeling
is that my program ought to decide what it wants to happen when a key
is pressed and should tell the note to do that. Especially as in many
Windows programs there are often many ways of doing the same thing (key
presses, mouse clicks etc) and I feel this should be under the control
of the program. For example, instead of the program saying to the note
"The user has pressed up arrow - do what you think best about it" the
program ought to tell the note "do a go-up".
Then perhaps you should send an event, containing information about what
happened and let the Note decide what to do with it. I don't thing you
should take care of all input at one place and there decide what method
to call, it's better to tell the note what happened and let it decide.
--
Erik Wikström
gw7...@aol.com wrote:
Erik Wikström wrote:
I'm not very familiar with the way things work in windows so I can't
say what the best way to handle the key-events are but you could create
a method in the Note-class that takes the key-code as parameter and
then let the IndexNote-class override that method and add the needed
functionality.
Thanks for your comments, Erik. I'm not sure that simply sending the
key-codes directly to the Note-class is the best approach - my feeling
is that my program ought to decide what it wants to happen when a key
is pressed and should tell the note to do that. Especially as in many
Windows programs there are often many ways of doing the same thing (key
presses, mouse clicks etc) and I feel this should be under the control
of the program. For example, instead of the program saying to the note
"The user has pressed up arrow - do what you think best about it" the
program ought to tell the note "do a go-up".
You could look into boost::signals. gw****@aol.com wrote:
case WM_KEYDOWN:
if (wParam == VK_UP && currentnote -isindexnote()) currentnote ->
goup();
I hardly could understand what is each of "currentnot e" and what they
do else,
but the piece of code looks like you need to eliminate "currentnot e ->
isindexnote()"
and to do something like this:
case WM_KEYDOWN:
if (wParam == VK_UP )currentnote -goup();
But if you have different types of "currentnot e" (supported notes and
does not), you can change code, which is processing WM_KEYDOWN message,
for each type of "currentnot e" makes own "message processing". For
"currentnot e" without notes WM_KEYDOWN will be ignored.
The dividing can be done as if each logical visible rectangle on your
creen was developed as separated object with own "message processing"
member. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Luca |
last post by:
Hi, I have a quite complex question to ask you:
I have defined a base class where I would like to have a map holding
pointers to member functions defined in derived classes.
To be more precise I would like my base class to have the following
member:
map<string, pointer_to_member_function> myClassMap;
|
by: Ruben Van Havermaet |
last post by:
Hi,
I have a problem using member functions in derived classes that
override virtual member functions of base classes.
The following pieces of (simplified) code don't work. Can anybody give
me some hints on what might be wrong?
// BEGIN OF SAMPLE CODE
class Strategy
|
by: scott |
last post by:
hi all, hope some one can help me. Ill try and explain what im trying to do
as best i can.
i have a parent class that has a vertual function, lets call it virtual int
A(). That vertual function does somthing that must be done. This meens
that when a child class inherits the class and creates its own vertual int
A() the parent class must also be called. the prob is i can not use the
base class name and then its functino name after it...
|
by: Doug Eleveld |
last post by:
Hi Everyone,
I have been playing aroung with 'object-oriented' C for a while now
and I have come up with an interesting way to simulate C++ inheritance
and non-member functions in C in a 100% typesafe way. The object
derivation is a bit cloudy, but the code is fairly repetitive and
doesn't seem to be terribly error prone. Maybe some clever macros
could clean up the repetitive code a bit.
Can any of you please comment on possible...
|
by: Bill Rubin |
last post by:
The following code snippet shows that VC++ 7.1 correctly compiles a static member function invocation from an Unrelated class, since this static member function is public. I expected to compile the same invocation from a DistantlyRelated class. What actually happened was that the compiler produced:
error C2247: 'A::function' not accessible because 'CloselyRelated' uses 'private' to inherit from 'A'
I'm guessing that the above compiler...
| |
by: Valeriu Catina |
last post by:
Hi,
consider the Shape class from the FAQ:
class Shape{
public:
Shape();
virtual ~Shape();
virtual void draw() = 0;
|
by: Goran |
last post by:
Hi @ all!
Is it possible to overload a member variable?
Example:
class ClassA_t {
|
by: bgold |
last post by:
Hey. I have a base class (SPRITE), and using this base class I have
derived a large number of derived classes (PERSON, BULLET, MISSILE,
etc.). Now, at a certain point in my program, I have a pair of
pointers, where each is a pointer to the base class (each is a SPRITE
*). I know that each of these pointers actually points to one of the
derived classes, even though the type of the pointer is SPRITE *, but
I don't know which derived class it...
|
by: fgh.vbn.rty |
last post by:
Say I have a base class B and four derived classes d1, d2, d3, d4. I
have three functions fx, fy, fz such that:
fx should only be called by d1, d2
fy should only be called by d2, d3
fz should only be called by d1, d3, d4
I think I have two options.
(1) Make all functions virtual and define them in the required derived
classes. This will of course lead to a lot of code duplication and
problems in maintainability.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |