none
TextWindow Issues Can't Show after hiding textwindow. RRS feed

  • Question

  • I have tried this on 2 computers that are running windows8.1 and get the error that is in the image.

    TextWindow.WriteLine("Here")
    TextWindow.Hide()
    TextWindow.Show()

    Can anyone confirm that they get the same error? If I comment out the 1st line I don't get the error. This does occur with no extensions present.

    Thanks,


    JR


    Monday, June 9, 2014 7:33 PM
    Answerer

Answers

  • Hello jr

    What about a simple work around?

    I use this for both TW and GW, it solves any clearing of the TW and any Shapes issues for the GW.

    TextWindow.WriteLine("hello, hide for 3 seconds")
    Program.Delay(2000)
    
    lastTop = TextWindow.Top
    TextWindow.Top = Desktop.Height
    Program.Delay(3000)
    TextWindow.Top = lastTop

    Tuesday, June 10, 2014 9:06 PM
    Moderator
  • I have logged the bug with MS.  Hide and Close really are interchangable.  Anyway I uploaded this change to extension LDTextWindow.Hide & Show.

    PS I'm not certain it will work for 8.1 (can't test), but does for W7, keeping the TW contents.

    Tuesday, June 10, 2014 6:56 PM
    Moderator

All replies

  • Hi JR,

    i has test it on the same Notebook with Windows 8.1 and Windows 7. Windows 8.1 show me the same error. Window 7 run and Show me an emptty windows.


    Best Regards Martin

    Monday, June 9, 2014 8:54 PM
  • Martin,

    Thanks for testing. Now, I know I didn't screw something up. So, it would seem that something is causing the problem in 8.1. Maybe it's in 8.0 too, but I can't test that. Maybe LitDev can do something in the extension. I doubt if we can get them to fix 8.1. It would be interesting to know what is causing the issue though.


    JR

    Monday, June 9, 2014 9:36 PM
    Answerer
  • Ed Price,

    Is there anyway to get this issue fixed?  Appears to have started occurring with Windows 8.0 or 8.1. I can't test it with 8.0. Martin tested it with 7.0 and it worked like it has always worked. If it can't be fixed through Windows maybe LitDev could do something with his extension.


    JR

    Tuesday, June 10, 2014 4:56 PM
    Answerer
  • I can't reproduce the 8.1 bug since I only have W7, but hiding and showing does remove anything in the TextWindow.

    So I think there is something for the developers to look at.  I will flag it as such.  Probably due to kernal32 native commands called on Hide and Show:

    [DllImport("kernel32.dll")] public static extern bool FreeConsole();

    [DllImport("kernel32")] public static extern bool AllocConsole();

    If it is a big deal I could add extension commands to replace the TextWindow.Hide and Show until fixed.



    Tuesday, June 10, 2014 5:41 PM
    Moderator
  • LitDev,

    If you look at previous posts for the textwindow display it never really worked the way it should work in my opinion. Like you said in Windows 7 and before if you hide the textwindow and then show it, what was there is gone. Also the only commands are TextWindow.Show(), TextWindow.Clear(), TextWindow.Hide(). Seems to me that it's missing a TextWindow.Close() function. It would be great if you could add these to the extension. Be really great if I could hide the textwindow and then do show and it would still have the data in it and not get errors. For me, not really a priority though, but it would be nice.

    I would still think that Microsoft would want to fix the Windows code. Appears that something in it isn't right.

    Thanks for the help,


    JR

    Tuesday, June 10, 2014 6:42 PM
    Answerer
  • I have logged the bug with MS.  Hide and Close really are interchangable.  Anyway I uploaded this change to extension LDTextWindow.Hide & Show.

    PS I'm not certain it will work for 8.1 (can't test), but does for W7, keeping the TW contents.

    Tuesday, June 10, 2014 6:56 PM
    Moderator
  • LitDev,

    It does work with 8.1.  I have a suggestion though. In my program I have the following. Since I have LDTextWindow.Show() and LDTextWindow.Hide() is it easy to add LDTextWindow.Pause(). If it isn't that's OK. I'm just happy to have it working.

    Does the statement in that code look familiar? Stolen from your database example.

    Another Thank You,

     

    Sub Display
    LDTextWindow.Show()
      For i = 1 To numField
        field = fields[i]
        SortIndex()
        DisplaySort()
      EndFor
      TextWindow.Pause()
      LDTextWindow.Hide()
    EndSub


    JR

    Tuesday, June 10, 2014 8:13 PM
    Answerer
  • JR,

    I can't see a problem with TextWindow.Pause() in Windows 7 - can you explain what the problem is or is it you just want to use LDTextWindow.Pause() in place of TextWIndow.Pause().

    If its the latter, I would prefer to not add LDTextWindow.Pause(), since I assume the other fixes will be temporary until fixed by MS, when I may depreciate the LDTextWindow versions in favor of the default ones when they work as expected in 8.1.

    PS

    When I do depreciate (remove) something I only remove it from documentation and intellisense - they will actually continue to work, but not recommend to use after depreciation.

    Tuesday, June 10, 2014 8:28 PM
    Moderator
  • LitDev,

    OK. I understand. I was only thinking if I'm putting LD in front of might as well do it with all. I agree that it would be better to fix 8.1 and maybe 8.0 if it's in it too. It is nice to see it close and then open with the text still in it.

    Thanks,


    JR

    Tuesday, June 10, 2014 8:38 PM
    Answerer
  • Hello jr

    What about a simple work around?

    I use this for both TW and GW, it solves any clearing of the TW and any Shapes issues for the GW.

    TextWindow.WriteLine("hello, hide for 3 seconds")
    Program.Delay(2000)
    
    lastTop = TextWindow.Top
    TextWindow.Top = Desktop.Height
    Program.Delay(3000)
    TextWindow.Top = lastTop

    Tuesday, June 10, 2014 9:06 PM
    Moderator
  • Excellent workaround, just what we do do with shapes as you say - simple and works well.  Half the fun of a small set of commands is using imagination to do things that there are no simple commands that do it for you - nice.
    Tuesday, June 10, 2014 9:25 PM
    Moderator
  • Jibba Jabba,

    Great suggestion! I never even thought of that.

    Thanks,


    JR

    Tuesday, June 10, 2014 9:44 PM
    Answerer
  • Back again :)

    You can also do Event Driven Programming with the TextWindow.

    Here's a sample that adds a <<button>> to the TW.Title bar and when you click on it, it "Closes" / minimises the TW without ending the Program.

    KTC389

    Wednesday, June 11, 2014 5:02 AM
    Moderator
  • Jibba Jabba,

    Another good suggestion. The program didn't work as listed though. Since textwindow.left and textwindow.top are pixel positions not cursor positions I had to multiply the numbers by 12 to emulate cursor positions. The code below shows what worked for me. I was guessing that a cursor position is 12 pixels wide.

    Thanks,

        If Mouse.IsLeftButtonDown And Mouse.MouseX > TextWindow.Left + (32*12) And Mouse.MouseX < TextWindow.Left + (96*12) Then      
          If Mouse.MouseY > TextWindow.Top And Mouse.MouseY < TextWindow.Top + 30*12 And closeTW = "" Then
            closeTW = "True"          
          EndIf


    JR

    Wednesday, June 11, 2014 11:07 AM
    Answerer
  • The prompt wasn't very clear... I meant click on the Title Bar.

    This way it might save any grief updating the TW.Write

    You can just set TW.Title once.

    It's a bit hard to see the Title on the dark ide b/ground.

    Using TW.Clear or not gives a choice b/w close or minimise as well :)
    Wednesday, June 11, 2014 1:18 PM
    Moderator
  • Jibba Jabba,

    I see what is different now. How did you get the textwindow title clear over to the left? On my system with your initial program it shows in the middle of the window which is why I had to make the change to the program. Ok, if I click on the left side, about where your arrow is it works.

    So, how did you get the title on the left side? Or is that just an example to show where to click?

    Wednesday, June 11, 2014 2:47 PM
    Answerer
  • Jr...... that's interesting.

    Just to confirm if you code in a separate 1 line program:

    TextWindow.Title = "<Close TW>"

    It's aligned in the centre?

    If so then it could be a special character issue <>.

    So maybe try an escape sequence using a /:

    TextWindow.Title = "/<Close TW/>"


    Wednesday, June 11, 2014 7:57 PM
    Moderator
  • I think it may be the default behavior in Windows 8.1 rather than Windows 7 to center the title.
    Wednesday, June 11, 2014 8:05 PM
    Moderator
  • That sounds right. Unfortunately it would limit what we can do in the title bar unless there's a simple way to force the alignment.

    Oh sorry. jr, no it aligns left on my win7

    Wednesday, June 11, 2014 8:36 PM
    Moderator
  • Jibba Jabba,

    Tried the above TextWindow.Title = "/<Close TW/>" and it goes to the center. As LitDev suggested it might be due to 8.1 Windows. I don't have the ability to try at a lower level.


    JR

    Wednesday, June 11, 2014 8:38 PM
    Answerer
  • Thanks for the info.

    Hey, I've been checking out some of the user controls on the new systems and latest apps - they're so intuitive and no clutter!

    Maybe we can set the whole title bar as a control for a swipe/tap/click and direct the user somehow.

    Wednesday, June 11, 2014 9:00 PM
    Moderator
  • I think this is a reasonable solution:   

    KTC389-0

    Wednesday, June 11, 2014 9:59 PM
    Moderator
  • As LitDev mentioned, it IS the default behavior in Win8 for all Window Titles. Found some links where people want to change that to before behaviour. Maybe ClassicShell supports that for W8 or does in a future version.
    But if you append Spaces at the end of TextWindow.Title it should logically move the text itself to the left?? But can't test that.

    eg:

    Title = "<Close TW>"
    Len = Text.GetLength(Title)

    ' replace 90 by the value shown in your CMD-Properties / Layout Tab/WindowSize Width
    ' XY is a constant value depending on width of the icon on the left side of the TW titlebar

    For N = 1 To (90 - Len -XY)
      Spaces = Text.Append(Spaces, " ")
    EndFor
    TextWindow.Title = Title + Spaces

    But donno if this would work in W8 ??

    Wednesday, June 11, 2014 10:26 PM
    Answerer
  • Pappa Lapub,

    Here's your code tested with window 8.1.

    Title = "<Close TW >"
     Len = Text.GetLength(Title)
    For N = 1 To (40 - (Len/2) )
       Spaces = Text.Append("M",Spaces)
     EndFor
     TextWindow.Title = (Title+Spaces)

    Instead of a space I had to use the letter M. Using spaces doesn't move the window over far enough left. The default on the textwindow is 80 characters so dividing it by 2 centers in the window. Half the length of the Title (Len/2). Moves everything to the left. I did find that instead of one space if I increase this to 4 spaces it moves it all the way left.

    It does work as a workaround.


    JR

    Wednesday, June 11, 2014 11:51 PM
    Answerer