[Gambas-user] ncurses help texts missing

Rolf-Werner Eilert eilert-sprachen at ...221...
Mon Mar 24 15:53:28 CET 2014



Am 05.02.2014 18:15, schrieb Tobias Boege:
> On Tue, 04 Feb 2014, Tobias Boege wrote:
>> On Tue, 04 Feb 2014, Tobias Boege wrote:
>>> On Tue, 04 Feb 2014, Rolf-Werner Eilert wrote:
>>>>
>>>>
>>>> Am 04.02.2014 09:46, schrieb Tobias Boege:
>>>>> On Tue, 04 Feb 2014, Rolf-Werner Eilert wrote:
>>>>>> Hi Tobias,
>>>>>>
>>>>>> your name is mentioned as the author of the ncurses component. Is that
>>>>>> right?
>>>>>>
>>>>>
>>>>> Yes, that's right.
>>>>>
>>>>>> Anyway, I wanted to play around a bit with ncurses and found this
>>>>>> component. A long time ago, I tried to write a program with ncurses but
>>>>>> gave up when I had to find the screen dimensions (the original C
>>>>>> function uses a pointer thing I couldn't make workable for my Gambas
>>>>>> program). So thanks you've done it for me :)
>>>>>>
>>>>>> But the help texts aren't ready yet, and I miss some short examples on
>>>>>> how to start by making a window and so on.
>>>>>>
>>>>>> Are the undocumented functions not ready yet, or is it that the help
>>>>>> texts aren't complete yet?
>>>>>>
>>>>>
>>>>> The help just isn't written. The component itself didn't change since 3.3 or
>>>>> so. Not that I am totally confident with it but it's working as it should at
>>>>> this point.
>>>>>
>>>>> Some things missing (actually, the whole menu and forms extensions of
>>>>> ncurses and wide character support!), etc. and I also want to add a
>>>>> gb.ncurses.cdk component based on the CDK library which implements controls
>>>>> in terminal but I have to design this carefully - and maybe even break
>>>>> gb.ncurses' API (very slightly if at all!). This is why I'm stuck programming
>>>>> and if the programming isn't done, I struggle to do the documentation :-)
>>>>>
>>>>> There are gb.ncurses examples: Pong and Invaders (the last one still not
>>>>> finished in regard to game logic) in the Games section. But if you told me
>>>>> that these don't help gb.ncurses newbies, I would agree...
>>>>>
>>>>> I'm actually not that fit anymore with gb.ncurses :-) but today afternoon
>>>>> I'll put some lines together about the basics.
>>>>>
>>>>> Regards,
>>>>> Tobi
>>>>>
>>>>> And now off to the Linear Algebra test ;-)
>>>>>
>>>>
>>>> Uuuuh - good luck!
>>>>
>>>> Just give me some hint how to start, and we could write some help texts
>>>> and little examples. Although I don't have too much time right now, I
>>>> would be able to help out a bit here...
>>>>
>>>
>>> Wait a minute (or one or two hours, more likely). I'm halfways through a
>>> quite comprehensive tutorial about basic usage:
>>>
>>>   - printing text,
>>>   - using attributes and colours,
>>>   - creating dialogs.
>>>
>>
>> Almost everything is in place here[0]. With the last little paragraph, I'll
>> continue tomorrow as it's time for a break now. I've also prepared a project
>> containing all the snippets presented which I will complete and upload
>> tomorrow, too. Hope it helps.
>>
>> Note that I needed to fix some bugs I encountered while putting the code
>> together so you better use the latest revision to test ;-)
>>
>> Regards,
>> Tobi
>>
>> [0] http://gambasdoc.org/help/tutorial/ncursestut?v3
>>
>
> OK, now it's ready and has a source code archive. Let me know if you have
> any suggestions. (Maybe one or the other screenshot would be nice?)
>
> Regards,
> Tobi
>


Hi,

it's been quite a while, but now I had the time to test your examples.

There seem to be some mistakes in the example, so I'm giving a version 
that runs:

Dim hDialog As New Window(True, 0, 0, Window.W / 2, 6)
'Dim sChoice As String
Dim iChoice As Integer

   hDialog.Border = Border.ACS
   hDialog.Caption = ("Make a choice")
   hDialog.Center()
   hDialog.Show()

   hDialog.PrintCenter(Subst$(("What to do?\n\nEvalute 42^2 [&1]\nQuit 
[&2]"), ("E"), ("q")))
   Screen.Echo = False
   iChoice = hDialog.Ask("Eq")
   hDialog = Null ' Destroy the dialog window
   'If sChoice = ("e") Then
   If iChoice = 1 Then
     Window.PrintCenter(Subst$(("Here it is: 42^2 = &1"), 42 ^ 2)) ', 
Attr.Bold, Pair[Color.Green, Color.Black])
   ' Else
   '   Window.Print("Pressed something else")
   Endif
   Window.Print(("Press any key to continue"), 0, Window.H - 1)
   Window.Read()

   Quit


As you will see, .Ask returns an integer, and this should be mentioned 
in the help text. Currently this is described to be string. (This cost 
me quite a while to find out... :-) )

If there is no Quit at the end of the program, it will never end. Only 
^C helps then.

Personally I find the cursor behind each .Print string irritating. Can 
it be suppressed?

Moreover, umlauts aren't printed correctly (I guess it's UTF-8). Is 
there a solution?

Regards
Rolf




More information about the User mailing list