[Gambas-user] ncurses howto
Demosthenes Koptsis
demosthenesk at gmail.com
Mon May 27 21:00:46 CEST 2019
yes Tobias...thanks
i found it a bit later...anyway thanks.
On 5/27/19 9:52 PM, Tobias Boege wrote:
> On Mon, 27 May 2019, Demosthenes Koptsis wrote:
>> Hello,
>>
>> i try ncurces with gambas3 and i have some difficulties.
>>
>> i created a console application and i have the following code:
>>
>> ' Gambas module file
>>
>> Public Sub Main()
>> ' Display a message window
>> Dim hMessage As New Window(True, 0, 0, 800, 600)
>> hMessage.Border = 1
>> hMessage.Background = Color.Blue
>> hMessage.Foreground = Color.White
>> hMessage.Print("Surprise!")
>> hMessage.Show()
>> Wait 10
>>
>> End
>>
>> if i dont write WAIT 10 seconds i get a black screen.
>>
>> if i write WAIT 10 seconds i get the desired ncurses screen visible for 10
>> secs.
>>
>> How i can have the ncurses screen always visible?
>>
> hMessage is a local variable. As soon as you leave the scope of the
> Main sub, it goes out of scope and gets destroyed (because for some
> reason being `Show`n does not automatically increase the reference
> count of a Window in gb.ncurses). Put it into a class-global variable
> instead:
>
> Private $hMessage As Window
>
> Public Sub Main()
> $hMessage = New Window(True, 0, 0, 800, 600)
> $hMessage.Border = 1
> $hMessage.Background = Color.Blue
> $hMessage.Foreground = Color.White
> $hMessage.Print("Surprise!")
> $hMessage.Show()
> End
>
> Regards,
> Tobi
>
More information about the User
mailing list