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

AW: [libertybasic] Help appreciated to code button action

Expand Messages
  • pendl2megabit
    Message 1 of 8 , Aug 3, 2006
    • 0 Attachment
      >
      > Thanks for the above. It seems to be what I want and have
      > already implemented it into my rough version of the prog.
      >
      > However, if it is "Not really the preferred method....." then what is?
      >
      > Thanks
      >
      > Paul
      >

      Paul,
      there is no prefered method to get a button do what you want.
      A button has only two states, pushed and released.
      There is no way to check if a standard LB button is released.

      The only way I can think of instead of using a graphic control is to use a
      toggle button.

      Here is a demo that I updated to display the buttons state.
      What you get is a button which sends an event when it is pushed and one when
      it is released.

      '---code start
      ' toggle button demo
      nomainwin

      groupbox #main.gb, "Toggle Radiobuttons", 10, 10, 120, 100
      stylebits #main.bt, _BS_PUSHLIKE, 0, 0, 0
      radiobutton #main.bt, "Toggle", pushed, pushed, 20, 30, 100, 30
      stylebits #main.bt1, _BS_PUSHLIKE, 0, 0, 0
      radiobutton #main.bt1, "Toggle1", pushed, pushed, 20, 70, 100, 30

      stylebits #main.bt2, _BS_PUSHLIKE, 0, 0, 0
      checkbox #main.bt2, "Toggle Checkbox", pushed, pushed, 20, 120, 100, 30

      statictext #main.txt, "Status:", 20, 160, 200, 25

      open "Toggle demo" for window as #main
      #main, "trapclose [quit]"
      wait

      [quit]
      close #main
      end

      sub pushed handle$
      #handle$ "value? state$"
      #main.txt "Status: "; handle$; " ... "; state$
      end sub
      '---code end

      ---
      Stefan Pendl



      ___________________________________________________________
      Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
    • le_blue_jester
      Thanks for all the input (and even examples). I have what I want now but am having to stop myself getting sucked into programming too much as I feel it could
      Message 2 of 8 , Aug 4, 2006
      • 0 Attachment
        Thanks for all the input (and even examples).

        I have what I want now but am having to stop myself getting sucked into programming too much as I feel it could be adictive!

        Thanks again,

        Paul

        --- In libertybasic@yahoogroups.com, "pendl2megabit" <pendl2megabit@...> wrote:
        >
        > >
        > > Thanks for the above. It seems to be what I want and have
        > > already implemented it into my rough version of the prog.
        > >
        > > However, if it is "Not really the preferred method....." then what is?
        > >
        > > Thanks
        > >
        > > Paul
        > >
        >
        > Paul,
        > there is no prefered method to get a button do what you want.
        > A button has only two states, pushed and released.
        > There is no way to check if a standard LB button is released.
        >
        > The only way I can think of instead of using a graphic control is to use a
        > toggle button.
        >
        > Here is a demo that I updated to display the buttons state.
        > What you get is a button which sends an event when it is pushed and one when
        > it is released.
        >
        > '---code start
        > ' toggle button demo
        > nomainwin
        >
        > groupbox #main.gb, "Toggle Radiobuttons", 10, 10, 120, 100
        > stylebits #main.bt, _BS_PUSHLIKE, 0, 0, 0
        > radiobutton #main.bt, "Toggle", pushed, pushed, 20, 30, 100, 30
        > stylebits #main.bt1, _BS_PUSHLIKE, 0, 0, 0
        > radiobutton #main.bt1, "Toggle1", pushed, pushed, 20, 70, 100, 30
        >
        > stylebits #main.bt2, _BS_PUSHLIKE, 0, 0, 0
        > checkbox #main.bt2, "Toggle Checkbox", pushed, pushed, 20, 120, 100, 30
        >
        > statictext #main.txt, "Status:", 20, 160, 200, 25
        >
        > open "Toggle demo" for window as #main
        > #main, "trapclose [quit]"
        > wait
        >
        > [quit]
        > close #main
        > end
        >
        > sub pushed handle$
        > #handle$ "value? state$"
        > #main.txt "Status: "; handle$; " ... "; state$
        > end sub
        > '---code end
        >
        > ---
        > Stefan Pendl
        >
        >
        >
        > ___________________________________________________________
        > Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.