locked
Writing text on the screen while the clock is running in TextWindows RRS feed

  • Question

  • HELLO EVERYONE AND I HOPE GOOD WORK.MY QUESTİON :

    I want to write in the middle of the screen while working on the upper right corner in TextWindow.

    for this reason I wrote a program like this :

    Clock()
    Sub clock
      Timer.Interval = 1000
      Timer.Tick = Clock
      Clock = Clock.Time
      TextWindow.CursorTop = 2
      TextWindow.CursorLeft = 3
      TextWindow.WriteLine(Clock)
      name()
    EndSub
    Sub name 
      TextWindow.CursorTop = 15
      TextWindow.CursorLeft = 55
      TextWindow.Write("PLEASE ENTER THE NAME : ")
      name  = TextWindow.Read()
      EndSub 

    but it doesn't work :(  I can not write my name on the screen.running timer tick not allowed.maybe litdev said that this would help and  I writing this :

    clock = LDTimer.AddTick(clock)
    clock()
    
    Sub clock
      LDTimer.Interval(clock,1000)
      LDTimer.Tick = clock
      clock = Clock.Time
      TextWindow.CursorTop = 4
      TextWindow.CursorLeft = 5
      TextWindow.WriteLine(clock)
      EndSub

    but I could not get the clock to work with this plug-in.the program is running after 14 second program is crazy 

    where am I making mistake.please help me :)




    • Edited by athn84 Wednesday, February 21, 2018 8:48 PM
    Wednesday, February 21, 2018 8:03 PM

Answers

  • How about this?  TextWindow.Readkey is visible in intellisense but it doesn't work.

    so, used Ldtextwindow.keydown event.

    LDTextWindow.KeyDown=Inkey

    Clock()
    Sub clock
      Timer.Interval = 1000
      Timer.Tick = Clock
      Clock = Clock.Time
      TextWindow.CursorTop = 2
      TextWindow.CursorLeft = 3
      TextWindow.WriteLine(Clock)
      TextWindow.CursorTop = 15
      TextWindow.CursorLeft = 55
      TextWindow.Writeline("PLEASE ENTER THE NAME : ")
    EndSub

    Sub inkey 
      chr= LDTextWindow.LastKey
      If chr<>"Return" Then 
        nmb= Text.GetCharacterCode(chr)
        If 64<nmb And nmb<91 Then 
          _name=_name+chr
        EndIf
        TextWindow.CursorTop = 15
        TextWindow.CursorLeft = 80
        TextWindow.WriteLine(_name)  
      EndIf
    EndSub 

    Thursday, February 22, 2018 4:17 AM
    Answerer
  • Hi,

    When you type in text window the cursor top or cursor left change. So, you can try calling the name subroutine first, The the Clock subroutine. I added a While loop in order to prevent printing "Press any key to continue...".

    Here's the code

    name()
    Clock()
    Sub clock
      While(1=1) 
        Timer.Interval = 1000
        Timer.Tick = Clock
        Clock = Clock.Time
        TextWindow.CursorTop = 2  
        TextWindow.CursorLeft = 3
        TextWindow.WriteLine(Clock)
        Program.Delay(50)
      EndWhile
    EndSub
    Sub name 
      TextWindow.CursorTop = 15
      TextWindow.CursorLeft = 55
      TextWindow.Write("PLEASE ENTER THE NAME : ")
      name  = TextWindow.Read()
    EndSub
    Thanks,


    Roshan - 7th Grade Student (Age 12) - Learning Small Basic, Visual Basic and C#

    Thursday, February 22, 2018 2:06 AM

All replies

  • Hi,

    When you type in text window the cursor top or cursor left change. So, you can try calling the name subroutine first, The the Clock subroutine. I added a While loop in order to prevent printing "Press any key to continue...".

    Here's the code

    name()
    Clock()
    Sub clock
      While(1=1) 
        Timer.Interval = 1000
        Timer.Tick = Clock
        Clock = Clock.Time
        TextWindow.CursorTop = 2  
        TextWindow.CursorLeft = 3
        TextWindow.WriteLine(Clock)
        Program.Delay(50)
      EndWhile
    EndSub
    Sub name 
      TextWindow.CursorTop = 15
      TextWindow.CursorLeft = 55
      TextWindow.Write("PLEASE ENTER THE NAME : ")
      name  = TextWindow.Read()
    EndSub
    Thanks,


    Roshan - 7th Grade Student (Age 12) - Learning Small Basic, Visual Basic and C#

    Thursday, February 22, 2018 2:06 AM
  • How about this?  TextWindow.Readkey is visible in intellisense but it doesn't work.

    so, used Ldtextwindow.keydown event.

    LDTextWindow.KeyDown=Inkey

    Clock()
    Sub clock
      Timer.Interval = 1000
      Timer.Tick = Clock
      Clock = Clock.Time
      TextWindow.CursorTop = 2
      TextWindow.CursorLeft = 3
      TextWindow.WriteLine(Clock)
      TextWindow.CursorTop = 15
      TextWindow.CursorLeft = 55
      TextWindow.Writeline("PLEASE ENTER THE NAME : ")
    EndSub

    Sub inkey 
      chr= LDTextWindow.LastKey
      If chr<>"Return" Then 
        nmb= Text.GetCharacterCode(chr)
        If 64<nmb And nmb<91 Then 
          _name=_name+chr
        EndIf
        TextWindow.CursorTop = 15
        TextWindow.CursorLeft = 80
        TextWindow.WriteLine(_name)  
      EndIf
    EndSub 

    Thursday, February 22, 2018 4:17 AM
    Answerer
  •  Roshan I thank you for your help :)
    Thursday, February 22, 2018 4:44 AM
  • NaochanOn I thank you for your help :) good job
    Thursday, February 22, 2018 4:46 AM