Announcement

Collapse
No announcement yet.

Problem with TXT.WINDOW "focus" in PBCC

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dale Yarker
    replied
    That is SetForegroundWindow(GetParent(hTWin)) instead of SetForegroundWindow(hTWin), not in addition to. (except I'll have red wine per my cardiologist )

    ((I would not have suspected SetForegroundWindow because the TXT.WINDOW was created, and stayed, "on top" of the console.))

    Thanks again guys,

    Leave a comment:


  • Dave Biggs
    replied
    Sometimes it is useful to change the caption text

    Leave a comment:


  • Borje Hagsten
    replied
    Checked with MS Spy++ and a text window is a window named "POWERTEXT", with a static control (label) for text in its client area. Good to know.

    Leave a comment:


  • Borje Hagsten
    replied
    Ok, problem solved - hTWin is text area in a parentwindow, so need to use SetForegroundWindow(GetParent(hTWin))

    Ok, we found the solution at same time. Cheers!


    Leave a comment:


  • Dave Biggs
    replied
    Try SetForegroundWindow(GetParent(hTWin))

    Leave a comment:


  • Borje Hagsten
    replied
    Hm, that is strange. I tried some variations and other calls and Sleep, etc, but nothing seems to help. Very strange.

    Leave a comment:


  • Dale Yarker
    replied
    Yes, that worked in posted code. I'll go try it in my project.

    Strange thing, the caption in the TXT.WINDOW stayed grey, but TXT.WAITKEY$ responded to a key, so who cares.

    Thanks,

    Leave a comment:


  • Borje Hagsten
    replied
    Try SetForegroundWindow(hTWin) instead of SetFocus in FUNCTION TxtWindow. Just tested and works here.
    '
    Code:
    #COMPILE EXE
    #DIM ALL
    %UNICODE = 1
    #INCLUDE ONCE "WIN32API.INC"
    
    FUNCTION TxtWindow () AS LONG
      LOCAL hTWin AS DWORD
      '
      TXT.WINDOW ("test", 120, 320, 5, 60) TO hTWin
      TXT.PRINT "Some text."$$
      SetForegroundWindow(hTWin)
      TXT.WAITKEY$
      TXT.END
    END FUNCTION
    '
    FUNCTION PBMAIN () AS LONG
      LOCAL hTWin AS DWORD
      con.print "Open a TXT.WINDOW on any key."$$
      con.waitkey$ 'REMed out the TXT.WINDOW receives keystrokes
                    'unREM the line to see the problem
                    'The caption in TXT.WINDOW "greyed" with CON.WAITKEY$ here.
                    'Click on TXT.WINDOW, then TXT.WAITKEY$ (above) works.
      TxtWindow
      '
      con.print "Close on any key."$$
      con.waitkey$
    END FUNCTION '
    '

    Leave a comment:


  • Dale Yarker
    started a topic Problem with TXT.WINDOW "focus" in PBCC

    Problem with TXT.WINDOW "focus" in PBCC

    'Problem with TXT.WINDOW "focus" in PBCC
    '
    '(see comments in PBMain()
    '
    Code:
    #compile exe
    #dim all
    %UNICODE = 1
    
    function TxtWindow () as long
      local hTWin as dword
      '
      txt.window ("test", 120, 120, 5, 60) to hTWin
      txt.print "Some text."$$
      '(API function SetFocus(hTWin) does not work)((tested and read learn.microsoft))
      txt.waitkey$
      txt.end
    end function
    '
    function pbmain () as long
      local hTWin as dword
      con.print "Open a TXT.WINDOW on any key."$$
      'con.waitkey$ 'REMed out the TXT.WINDOW receives keystrokes
                    'unREM the line to see the problem
                    'The caption in TXT.WINDOW "greyed" with CON.WAITKEY$ here.
                    'Click on TXT.WINDOW, then TXT.WAITKEY$ (above) works.
      TxtWindow
      '
      con.print "Close on any key."$$
      con.waitkey$
    end function '
    Any suggestions?

    Cheers,​
Working...
X
😀
🥰
🤢
😎
😡
👍
👎