bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: forum for beginner type questions


From: fpga
Subject: Re: forum for beginner type questions
Date: Thu, 3 Sep 2009 08:16:18 -0700 (PDT)

Thank you all very much for your responses and the info that there's not a
good forum for beginners.
My question may have been inappropriate as this may well be the right forum
after all.

I played around and solved my problem which has highlighted a seeming
inconsistency between mvwaddstr(......const char *), which I initially used,
and mvwaddch(...char) which was my solution to the problem I  was having
with mvwaddstr().

I'm aware of Dan's book and the acclaim it has received but would be very
surprised if it contained an explanation of the difference between
mvwaddstr() and mvwaddch() re the way I am trying to use them.

To reduce duplication I'm writing a pad based text editor as part of a front
end for my discrete event simulation app and using the guts of that editor
for the simulation's dynamic display.

I need to be able to overwrite existing text on the pad with new text very
quickly indeed.

For speed I went for mvwaddstr() cos many of the chars are adjacent cos they
belong to the same set. However when I cleared the vector holding objects
containing the char *s that had been displayed and refilled it with new ones
for redisplay, ncurses seemed upset by the loss of the deleted char *'s.
This was evidenced by the fact that if I did not delete the char * objects
and simply added new ones to their vector everything printed out as expected
i.e. as a test I printed at x=1 and y=index of char * object in vector. so I
just got a longer list.

To test that the pad was indeed missing the deleted char *s I deleted it,
having created it with new and recreated it assigning to it the similarly
deleted and refilled vector of char *'s to play with and it worked fine.
I feel that this may be a bit slow for the simulation display if not for the
editor part.

To address this I got rid of the char *s altogether and used two loops to go
down the vector of strings and used their indexes as x & y to print each
character using mvwaddch(). I find with this I can change the vector of
strings and just keep writing new text with mvwaddch() without ncurses
complaining.

I'm not sure if ncurses "mourning" of text supplied to it via mvwaddstr()
but not via mvwadch() is an intended feature and would welcome your thoughts
on this.

Addionally, thank you for the efforts of you gentlemen in developing and
assisting people like me to use such no-nonsense functional software. I am
trying to write the equivalent of a DOS based app that was extremely
productive compared to it's later Windows gui-based incarnations. I like the
results that ncurses produces a lot!
 
As an aside and given that it seems best to now write a character at a time
(with its own foreground and background colour) is there a best way to write
the thing to run as fast as possible? I'm using g++ and may possibly move to
Intel's compiler. My app is really only one big loop that writes chars to
the screen with different foreground and background colours.

Again any help is much appreciated

Dean


Thomas Dickey-2 wrote:
> 
> On Wed, 2 Sep 2009, Ben Duncan wrote:
> 
>> If you can find it, the book Programmers Guide to nCurse by Dan Gookin is 
>> excellent. It is out of print, but you can google for it..
> 
> yes (I was responding to "forum", though - someplace where one can ask 
> questions)
> 
>>
>> Thomas Dickey wrote:
>>> On Wed, 2 Sep 2009, fpga wrote:
>>> 
>>>> 
>>>> Could someone please direct me to a beginner's forum for ncurses please
>>> 
>>> that's hard (I haven't seen any - web or usenet - which give much useful
>>> information).
>>> 
>>
>>
>> -- 
>> Ben Duncan - Business Network Solutions, Inc. 336 Elton Road  Jackson MS, 
>> 39212
>> "Never attribute to malice, that which can be adequately explained by 
>> stupidity"
>>       - Hanlon's Razor
>>
>>
>> _______________________________________________
>> Bug-ncurses mailing list
>> address@hidden
>> http://lists.gnu.org/mailman/listinfo/bug-ncurses
>>
> 
> -- 
> Thomas E. Dickey
> http://invisible-island.net
> ftp://invisible-island.net
> 
> 
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-ncurses
> 
> 

-- 
View this message in context: 
http://www.nabble.com/forum-for-beginner-type-questions-tp25255116p25278248.html
Sent from the Gnu - Ncurses mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]