Loading ...
Sorry, an error occurred while loading the content.
 

problems/questions

Expand Messages
  • scepticalinseattle
    I started 3 different threads on 3 different subjects and none have appeared on this forum. Why? I feel like I m missing some logic regarding Liberty Basic.
    Message 1 of 4 , Aug 2, 2009
      I started 3 different threads on 3 different subjects and none have appeared on this forum. Why?

      I feel like I'm missing some logic regarding Liberty Basic. Please fill me in...

      If I want to center the text in a window I can do it with stylebits...unless I'm in texteditor which is the most useful place to be when I'm dealing with a lot of text.

      If I want to capture the input keys so I can press [Enter] rather than having to use the buttons I can use inkey@...but only if I'm in graphics mode not when I'm using text. When I'm using text in a windows environment apparently I can't capture the keys unless I'm just using LB's basic mainwin.

      Am I missing something...everytime I want to do a logic thing with text I am told to do it in a graphics window or not to do it in texteditor!
    • scepticalinseattle
      ... I m still curious as to the logic of the questions raised above however.
      Message 2 of 4 , Aug 3, 2009
        --- In libertybasic@yahoogroups.com, "scepticalinseattle" <gcbryan@...> wrote:
        >
        > I started 3 different threads on 3 different subjects and none have appeared on this forum. Why?
        >
        > I feel like I'm missing some logic regarding Liberty Basic. Please fill me in...
        >
        > If I want to center the text in a window I can do it with stylebits...unless I'm in texteditor which is the most useful place to be when I'm dealing with a lot of text.
        >
        > If I want to capture the input keys so I can press [Enter] rather than having to use the buttons I can use inkey@... only if I'm in graphics mode not when I'm using text. When I'm using text in a windows environment apparently I can't capture the keys unless I'm just using LB's basic mainwin.
        >
        > Am I missing something...everytime I want to do a logical thing with text I am told to do it in a graphics window or not to do it in texteditor!
        >The other threads have now shown up so I guess patience is needed on my part :)

        I'm still curious as to the logic of the questions raised above however.
      • Stefan Pendl
        ... The text editor is offered as is, if you need to center text, you need to add leading spaces. You can use the SPACE$() function to do so. ... If you need
        Message 3 of 4 , Aug 3, 2009
          >
          > If I want to center the text in a window I can do it with
          > stylebits...unless I'm in texteditor which is the most useful
          > place to be when I'm dealing with a lot of text.
          >

          The text editor is offered as is, if you need to center text, you need to add leading spaces.
          You can use the SPACE$() function to do so.

          > If I want to capture the input keys so I can press [Enter]
          > rather than having to use the buttons I can use inkey@...but
          > only if I'm in graphics mode not when I'm using text. When
          > I'm using text in a windows environment apparently I can't
          > capture the keys unless I'm just using LB's basic mainwin.
          >

          If you need to trap the ENTER key, you have three options:

          1)
          use a dialog window and add a button with the extension .default, which will capture the ENTER key presses.
          Do NOT use a dialog_modal window as you main application window, since it is only meant to be a helper window.

          2)
          In a regular window add the _BS_DEFAULT style to one button, so it captures the pressing of ENTER.

          3)
          use the GetAsyncKeyState API function to emulate the Inkey$ functionality in any window.

          '---code start (watch for line wraps)
          NOMAINWIN

          stylebits #1.txt, _ES_READONLY, 0, 0, 0
          textbox #1.txt, 10, 10, 200, 25

          OPEN "Key Test" FOR Window AS #1
          #1, "trapclose [quit]"
          #1.txt, "Press any key..."

          [startTimer]
          timer 100, [checkKeyPress]
          WAIT

          [quit]
          timer 0
          CLOSE #1
          END

          [checkKeyPress]
          if CheckKey(_VK_RBUTTON) then #1.txt "right mouse button"
          if CheckKey(_VK_LEFT) then #1.txt "cursor left"
          if CheckKey(_VK_DOWN) then #1.txt "cursor down"
          if CheckKey(asc("1")) then #1.txt "1"
          if CheckKey(asc("A")) then #1.txt "A"
          if CheckKey(_VK_NUMPAD5) then #1.txt "numpad5"
          if CheckKey(_VK_NUMPAD8) then #1.txt "numpad8"
          wait

          function CheckKey(KeyCode)
          ' this function will return 1 if the key
          ' you like to monitor is pressed
          ' the Virtual Key Code of the key in question
          ' is the input

          calldll #user32, "GetAsyncKeyState", _
          KeyCode as ushort, _
          result as short

          if result < 0 then
          CheckKey = 1
          else
          CheckKey = 0
          end if
          end function
          '---code end

          ---
          Stefan Pendl

          Liberty BASIC Assist 4.03 ........ http://www.libertybasic.com/assist.html
          Liberty BASIC 4.04 public beta ... http://www.libertybasic.com/lb404b3setup.exe

          Windows Vista Home Premium 32-bit SP2
          AMD Turion X2 RM-70 2GHz, 4GB RAM
        • Eddie
          Thanks for some useful info there Stefan. Eddie 2009/8/4 Stefan Pendl ... [Non-text portions of this message have been removed]
          Message 4 of 4 , Aug 4, 2009
            Thanks for some useful info there Stefan.

            Eddie

            2009/8/4 Stefan Pendl <pendl2megabit@...>

            >
            >
            > >
            > > If I want to center the text in a window I can do it with
            > > stylebits...unless I'm in texteditor which is the most useful
            > > place to be when I'm dealing with a lot of text.
            > >
            >
            > The text editor is offered as is, if you need to center text, you need to
            > add leading spaces.
            > You can use the SPACE$() function to do so.
            >
            > > If I want to capture the input keys so I can press [Enter]
            > > rather than having to use the buttons I can use inkey@...but
            > > only if I'm in graphics mode not when I'm using text. When
            > > I'm using text in a windows environment apparently I can't
            > > capture the keys unless I'm just using LB's basic mainwin.
            > >
            >
            > If you need to trap the ENTER key, you have three options:
            >
            > 1)
            > use a dialog window and add a button with the extension .default, which
            > will capture the ENTER key presses.
            > Do NOT use a dialog_modal window as you main application window, since it
            > is only meant to be a helper window.
            >
            > 2)
            > In a regular window add the _BS_DEFAULT style to one button, so it captures
            > the pressing of ENTER.
            >
            > 3)
            > use the GetAsyncKeyState API function to emulate the Inkey$ functionality
            > in any window.
            >
            > '---code start (watch for line wraps)
            > NOMAINWIN
            >
            > stylebits #1.txt, _ES_READONLY, 0, 0, 0
            > textbox #1.txt, 10, 10, 200, 25
            >
            > OPEN "Key Test" FOR Window AS #1
            > #1, "trapclose [quit]"
            > #1.txt, "Press any key..."
            >
            > [startTimer]
            > timer 100, [checkKeyPress]
            > WAIT
            >
            > [quit]
            > timer 0
            > CLOSE #1
            > END
            >
            > [checkKeyPress]
            > if CheckKey(_VK_RBUTTON) then #1.txt "right mouse button"
            > if CheckKey(_VK_LEFT) then #1.txt "cursor left"
            > if CheckKey(_VK_DOWN) then #1.txt "cursor down"
            > if CheckKey(asc("1")) then #1.txt "1"
            > if CheckKey(asc("A")) then #1.txt "A"
            > if CheckKey(_VK_NUMPAD5) then #1.txt "numpad5"
            > if CheckKey(_VK_NUMPAD8) then #1.txt "numpad8"
            > wait
            >
            > function CheckKey(KeyCode)
            > ' this function will return 1 if the key
            > ' you like to monitor is pressed
            > ' the Virtual Key Code of the key in question
            > ' is the input
            >
            > calldll #user32, "GetAsyncKeyState", _
            > KeyCode as ushort, _
            > result as short
            >
            > if result < 0 then
            > CheckKey = 1
            > else
            > CheckKey = 0
            > end if
            > end function
            > '---code end
            >
            > ---
            > Stefan Pendl
            >
            > Liberty BASIC Assist 4.03 ........ http://www.libertybasic.com/assist.html
            > Liberty BASIC 4.04 public beta ...
            > http://www.libertybasic.com/lb404b3setup.exe
            >
            > Windows Vista Home Premium 32-bit SP2
            > AMD Turion X2 RM-70 2GHz, 4GB RAM
            >
            >
            >


            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.