hi,

On Mon, 26 Mar 2012, tobi wrote:
> On Mon, 26 Mar 2012, Rolf-Werner Eilert wrote:
> > 
> > Am 25.03.2012 14:42, schrieb tobi:
> > > Benoît,
> > >
> > > do you think an ncurses component would be useful? i abandoned the X 
> > > server with the beginning of
> > > the year and when i noticed that i would need a console ide for gambas, i 
> > > began writing one (cut
> > > down to my personal needs of course) using ncurses library. as it went 
> > > more complicated i
> > > appended it to the long queue of to-do projects ;)
> > > but yesterday i realised that having an ncurses component in gambas would 
> > > make things a lot easier,
> > > the console ide could be written in gambas (what an idea!)
> > > on the other hand: who needs ncurses nowadays? what do you think, is it a 
> > > waste of time or a
> > > valuable addition?
> > >
> > > (hope, the accent works, i searched about an hour for that - and can't 
> > > even see the result)
> > >
> > > regards,
> > > tobi
> > >
> > 
> > The accent works :-) And I like the ncurses idea, in fact I had such an 
> > idea some time ago. Don't remember what I wanted to do with it, but 
> > after realizing the complexity, I simply wrote some routines for colours 
> > and stuff, the rest was purely playing around a bit. Nothing serious.
> > 
> > Rolf
> > 
> 
> well, i'd volunteer but i can't estimate any time needed for a basically 
> usable result.
> i'm an 11th grade student so more important things may pop up in near 
> future... (in case you
> worry, i think (as a least instance) i'm capable of writing clean (concerning 
> memory), structured
> and reliable code -- but as the ncurses faq says, the library doesn't like to 
> free(3) its
> internal stuff for it may be needed later; unless you configure it to do 
> so...)
> 
> as soon as i figured out how to write components for gambas using the c 
> interface, i'll start
> anyway...
> 
> regards,
> tobi

don't want to be annoying but:
after having to read about those nifty configure scripts, i'm to face the first 
obstacle.
this code works:

-----
' Gambas module file

Public Sub Main()

  NCurses.On()
  NCurses.Print("this is text", 10, 10)
  NCurses.Attributes = NCurses.Bold Or NCurses.Reverse
  Print " this is a brave test."
  NCurses.Print("next line", , 11)
  NCurses.WaitKey()
  NCurses.Off()

End
-----

but as the docs about programming components in c/c++ reasonably say, this is 
rather c-style and
not suitable for the gambas language. (at the moment, there is one static 
object NCurses - i want
to discover the api further before writing any serious classes).

the Print() _function_ takes optionally x,y coordinates from which to print the 
text using ncurses.
i thought, it would be better to just use the Print instruction to print text 
instead of this
function all over again - this is just not aesthetic (but bearable?).
while the Print _instruction_ works fine for that - tried also with multiple 
ncurses WINDOWs
present - it always prints after the current cursor position, no matter what's 
there. that's the
same with the ncurses functions, the main problem is that i turned on some 
attributes which are
handled by the library, too. the text from the Print instruction doesn't get 
bold and video reversed.
consequently, one may never use Print instruction to stdout in ncurses mode and 
this option has
departed...
i had the weirdest ideas of redirecting stdout, to which Print prints, to a 
stream object inside the
ncurses component, reading from that and printing the data with the ncurses 
functions, but that's
quite too strange...

any suggestions/ideas about a suitable interface for something that 
fundamental? or may the above
code fit? (i appear to not often use the ncurses mvwprintw() in any bigger 
thing without having
built a wrapper around it or controlled it via a loop, so this may really fit 
as is...)

regards,
tobi

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to