Alaska Software Inc. - Dbedit and xbpBrowse()
Username: Password:
AuthorTopic: Dbedit and xbpBrowse()
SaulDbedit and xbpBrowse()
on Sun, 06 Aug 2006 18:38:06 +0200
Hello,
in one of my programms I have following code:

    declare felder[2]
    declare oben[2]
    felder[1] = "' '+typ"
    felder[2] = "' '+mark"
    oben[1] = " Muster"
    oben[2] = "Mark"
    dbedit(06,1,22,19,felder,"teiltaufm","",oben,"","","","")

   func teiltaufm
      if lastkey() = 27 .or. chr(lastkey()) $ "wW"
         return 0
      endif
      if chr(lastkey()) $ "mM"
         if empty(mark)
            repl mark with "X"
         else
            repl mark with " "
         endif
         keyboard chr(24)
      endif
   return 1

With push the m on the keyboard, a field is replaced with a "X" and Keyboard 
chr(24) moves the cursor one line down.
One I changed to xbpbrowse() with the following code.


     oBrowse := XbpBrowse():new( ,, {21,59}, {279,395}, ,.t.)
     oBrowse : CursorMode:=XBPBRW_CURSOR_ROW      && Cursor line

       Navigationscodeblcke fr den Browser
      oBrowse:skipBlock     := {|n| DbSkipper(n) }
      oBrowse:goTopBlock    := {| | DbGoTop()    }
      oBrowse:goBottomBlock := {| | DbGoBottom() }
      oBrowse:phyPosBlock   := {| | Recno()      }

       Navigationscodeblcke fr den vertikalen Scrollbar
      oBrowse:posBlock      := {| | DbPosition()    }
      oBrowse:goPosBlock    := {|n| DbGoPosition(n) }
      oBrowse:lastPosBlock  := {| | 100             }
      oBrowse:firstPosBlock := {| | 0               }

      oBrowse:addColumn( FieldBlock("typ"),len(typ), "Muster")
      oColmark := XbpColumn():new(,,,,)
      oColmark :dataLink := {|| MARK }
      oBrowse:addColumn(ocolmark)
      oBrowse : create()
      tinkey= 0
      DO WHILE nEvent <> xbeP_Close .and. tinkey <> 27
         nEvent := AppEvent( @mp1, @mp2, @oXbp )
         teiltaufm1()
         obrowse:handleEvent( nEvent, mp1, mp2 )
      ENDDO
  oColmark:destroy()
  oBrowse:destroy()

func teiltaufm1
      if lastkey() = 27 .or. chr(lastkey()) $ "wW"
         tinkey = 27
         return .t.
      endif
      if chr(lastAppevent()) $ "mM"
         if empty(mark)
            repl mark with "X"
         else
            repl mark with " "
         endif
         obrowse:refreshCurrent()
         keyboard chr(24)
      endif
   return .t.

This code fills the field with a "X" but the cursor doesnt move down.
What is my problem?
Thanks
Wolfgang
James Loughner Re: Dbedit and xbpBrowse()
on Sun, 06 Aug 2006 15:08:30 -0400
How about using oBrowse:Down instead of Keyboard CHR(24)

or

PostAppEvent(xbeP_KEYBOARD,xbeK_Down,,oBrowse)

You have to use GUI events for GUI parts.

Jim

Saul wrote:
> Hello,
> in one of my programms I have following code:
> 
>     declare felder[2]
>     declare oben[2]
>     felder[1] = "' '+typ"
>     felder[2] = "' '+mark"
>     oben[1] = " Muster"
>     oben[2] = "Mark"
>     dbedit(06,1,22,19,felder,"teiltaufm","",oben,"","","","")
> 
>    func teiltaufm
>       if lastkey() = 27 .or. chr(lastkey()) $ "wW"
>          return 0
>       endif
>       if chr(lastkey()) $ "mM"
>          if empty(mark)
>             repl mark with "X"
>          else
>             repl mark with " "
>          endif
>          keyboard chr(24)
>       endif
>    return 1
> 
> With push the m on the keyboard, a field is replaced with a "X" and Keyboard 
> chr(24) moves the cursor one line down.
> One I changed to xbpbrowse() with the following code.
> 
> 
>      oBrowse := XbpBrowse():new( ,, {21,59}, {279,395}, ,.t.)
>      oBrowse : CursorMode:=XBPBRW_CURSOR_ROW      && Cursor line
> 
>        Navigationscodeblöcke für den Browser
>       oBrowse:skipBlock     := {|n| DbSkipper(n) }
>       oBrowse:goTopBlock    := {| | DbGoTop()    }
>       oBrowse:goBottomBlock := {| | DbGoBottom() }
>       oBrowse:phyPosBlock   := {| | Recno()      }
> 
>        Navigationscodeblöcke für den vertikalen Scrollbar
>       oBrowse:posBlock      := {| | DbPosition()    }
>       oBrowse:goPosBlock    := {|n| DbGoPosition(n) }
>       oBrowse:lastPosBlock  := {| | 100             }
>       oBrowse:firstPosBlock := {| | 0               }
> 
>       oBrowse:addColumn( FieldBlock("typ"),len(typ), "Muster")
>       oColmark := XbpColumn():new(,,,,)
>       oColmark :dataLink := {|| MARK }
>       oBrowse:addColumn(ocolmark)
>       oBrowse : create()
>       tinkey= 0
>       DO WHILE nEvent <> xbeP_Close .and. tinkey <> 27
>          nEvent := AppEvent( @mp1, @mp2, @oXbp )
>          teiltaufm1()
>          obrowse:handleEvent( nEvent, mp1, mp2 )
>       ENDDO
>   oColmark:destroy()
>   oBrowse:destroy()
> 
> func teiltaufm1
>       if lastkey() = 27 .or. chr(lastkey()) $ "wW"
>          tinkey = 27
>          return .t.
>       endif
>       if chr(lastAppevent()) $ "mM"
>          if empty(mark)
>             repl mark with "X"
>          else
>             repl mark with " "
>          endif
>          obrowse:refreshCurrent()
>          keyboard chr(24)
>       endif
>    return .t.
> 
> This code fills the field with a "X" but the cursor doesn´t move down.
> What is my problem?
> Thanks
> Wolfgang 
> 
>
AUGE_OHRRe: Dbedit and xbpBrowse()
on Mon, 07 Aug 2006 11:27:24 +0200
hi,

Dbedit : right
>    repl mark with " "
> endif
> keyboard chr(24)

oBrowse : wrong
>    repl mark with " "
> endif
> obrowse:refreshCurrent()
> keyboard chr(24)

while you have a Object, try this :

  REPLACE IN_MARK WITH ""
  oBrowse:refreshCurrent()
  oBrowse:down()
  oBrowse:refreshCurrent()
  UNLOCK

greetings by OHR
Jimmy