xbrowse - inline editing

xbrowse - inline editing

Postby Otto » Sun Mar 17, 2019 7:54 pm

Dear Mr. Rao,
is there a way to open die combobox with larger high to show more items.

Thank you in advance
Otto

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6255
Joined: Fri Oct 07, 2005 7:07 pm

Re: xbrowse - inline editing

Postby nageswaragunupudi » Mon Mar 18, 2019 2:21 am

Sorry.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10468
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xbrowse - inline editing

Postby Otto » Mon Mar 18, 2019 6:34 am

Dear Mr. Rao,
is it possible to define Listbox object for editing as a member of the parent window of xBrowse and set height.
Thank you in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6255
Joined: Fri Oct 07, 2005 7:07 pm

Re: xbrowse - inline editing

Postby nageswaragunupudi » Mon Mar 18, 2019 8:43 am

Suggest you create a dialog with listbox and trigger it with EDIT_BUTTON
I will soon post a small sample
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10468
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xbrowse - inline editing

Postby Otto » Tue Mar 19, 2019 7:48 am

Dear Mr. Rao,
can you please help me to understand why oDlgParent:nTop is 0 if I use ACTIVATE DIALOG oDlg CENTERED and why it does not change if I move the DIALOG.
What command do I need to refresh the values.
Thank you in advance
Otto

Code: Select all  Expand view


#include "fivewin.ch"

function Main()
   local oDlg, oBrw
   LOCAL aPlatzhalter := {}

   aadd(aPlatzhalter ,{"Name","[NAME]"} )
   aadd(aPlatzhalter ,{"Vorname","[VORNAME]"} )
   aadd(aPlatzhalter ,{"Ort","[ORT]"} )

   DEFINE DIALOG oDlg ;
      FROM 10, 10 to 500,600;
      SIZE 780, 400 ;
      PIXEL                                     //TRUEPIXEL

   @ 20,20 ;
      XBROWSE oBrw ;
      OF oDlg ;
      PIXEL ;
      SIZE -20, -20 ;
      DATASOURCE aPlatzhalter ;
      HEADERS "Beschreibung", "Platzhalter" ;
      COLSIZES 100,200 ;
      AUTOCOLS ;
      CELL ;
      LINES ;
      NOBORDER

   WITH OBJECT oBrw:aCols[ 2 ]
   :nEditType     := EDIT_BUTTON
   :AddBitmap( "OPEN" )
   :nBtnBmp       := 1
   :bEditBlock    := { || showCombo( oBrw, oDlg ) }
END

WITH OBJECT oBrw
   :nRowHeight          := 60
   :CreateFromCode()
END

ACTIVATE DIALOG oDlg CENTERED

return nil
//----------------------------------------------------------------------------//

function showCombo( oBrw ,oDlgParent)

   local oDlg, cCombo := "2"
   local aItems := { "1", "2", "3" }
   local nRow := 0
   local aRect    := GetClientRect( oDlgParent:hWnd )
   local aPoint := {}
   local nCol := 100
   *----------------------------------------------------------
   xbrowse( oDlgParent )
   nRow := ( oBrw:nRowSel * oBrw:nRowHeight ) + oBrw:HeaderHeight( .t. ) - 1
   aPoint      := ClientToClient( oDlgParent:hWnd, oBrw:hWnd, { nRow, nCol } )
   xbrowse( aPoint )
   nRow := ( oBrw:nRowSel * oBrw:nRowHeight ) + oBrw:HeaderHeight( .t. ) - 1
   DEFINE DIALOG oDlg ;
      TITLE "Test" + str(nRow) ;
      FROM nRow, 300 ;
      TO nRow + 100, 400 + 6 ;
      PIXEL ;
      STYLE nOr( DS_MODALFRAME, WS_POPUP ) ;
      OF oDlgParent

   @ 2, 2 COMBOBOX cCombo ITEMS aItems SIZE 200, 100

   ACTIVATE DIALOG oDlg

return nil
*----------------------------------------------------------

static function ClientToClient( hFrom, hDest, aPoint, lInWnd )

   aPoint   := Client2Screen( hFrom, aPoint )
   lInWnd   := ( WindowFromPoint( aPoint[ 2 ], aPoint[ 1 ] ) == hDest )
   aPoint   := Screen2Client( hDest, aPoint )

return aPoint

//----------------------------------------------------------------------------//

static function Screen2Client( hWnd, aPoint )

   aPoint := ScreenToClient( hWnd, aPoint )
   if aPoint[ 1 ] > 0x8000
      aPoint[ 1 ] -= 0xFFFF
   endif
   if aPoint[ 2 ] > 0x8000
      aPoint[ 2 ] -= 0xFFFF
   endif

return aPoint

//----------------------------------------------------------------------------//

static function Client2Screen( hWnd, aPoint )

   aPoint   := ClientToScreen( hWnd, aPoint )
   if aPoint[ 1 ] > 0x8000
      aPoint[ 1 ] -= 0xFFFF
   endif
   if aPoint[ 2 ] > 0x8000
      aPoint[ 2 ] -= 0xFFFF
   endif

return aPoint

//----------------------------------------------------------------------------//



 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6255
Joined: Fri Oct 07, 2005 7:07 pm

Re: xbrowse - inline editing

Postby nageswaragunupudi » Tue Mar 19, 2019 8:47 am

Please try this sample:
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oDlg, oBrw, oFont
   local aData := Array( 12 )

   AEval( aData, { |u,i| aData[ i ] := { i, Str( i, 2 ), NTOCMONTH( i ) } } )

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-16
   DEFINE DIALOG oDlg SIZE 500,250 PIXEL TRUEPIXEL FONT oFont

   @ 40,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg DATASOURCE aData ;
      AUTOCOLS ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      WITH OBJECT :aCols[ 3 ]
         :nEditType     := EDIT_BUTTON
         :bEditBlock    := { | nRow, nCol, oCol, nKey | MyBtnDialog( nRow, nCol, oCol, nKey ) }
      END
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

function MyBtnDialog( nRow, nCol, oCol, nKey )

   local cRet
   local oDlg, oLbx, oFont, aItems := Array( 12 )
   local cItem

   AEval( aItems, { |u,i| aItems[ i ] := NTOCMONTH( i ) } )
   cItem    := oCol:Value

   DEFINE FONT oFont NAME "VERDANA" SIZE 0,-16
   DEFINE DIALOG oDlg SIZE 150,220 PIXEL TRUEPIXEL FONT oFont

   @ 0,0 LISTBOX oLbx VAR cItem ITEMS aItems ;
      SIZE 150,185 PIXEL OF oDlg


   @ 190,10 BUTTON "OK" SIZE 40,20 PIXEL OF oDlg ACTION ( cRet := cItem, oDlg:End() )
   @ 190,60 BUTTON "CANCEL" SIZE 80,20 PIXEL OF oDlg ACTION oDlg:End()

   ACTIVATE DIALOG oDlg ;
      ON INIT oCol:AnchorToCell( oDlg )

   RELEASE FONT oFont

return cRet
 


Use the method oCol:AnchorToCell( oDlg ) to correctly position the dialog.

Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10468
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xbrowse - inline editing

Postby Otto » Tue Mar 19, 2019 9:45 am

Dear Mr. Rao,
thank you I will try. But would you be so kind to tell me what I am missing with oDlgParent:nTop is 0 if I use ACTIVATE DIALOG oDlg CENTERED and why it does not change if I move the DIALOG.
Thank you in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6255
Joined: Fri Oct 07, 2005 7:07 pm

Re: xbrowse - inline editing

Postby nageswaragunupudi » Tue Mar 19, 2019 1:58 pm

Otto wrote:Dear Mr. Rao,
thank you I will try. But would you be so kind to tell me what I am missing with oDlgParent:nTop is 0 if I use ACTIVATE DIALOG oDlg CENTERED and why it does not change if I move the DIALOG.
Thank you in advance
Otto


nTop and nLeft of a dialog are always relative to the screen. Even if we specify a parent window/dialog, still these coordinates are relative to screen and not relative to the parent window/dialog.

So, you need to convert "nRow" to screen coordinates.

Here is an amended version of the ShowCombo function.
Code: Select all  Expand view

function showCombo( oBrw ,oDlgParent)

   local oDlg, cCombo := "2"
   local aItems := { "1", "2", "3" }
   local nRow := 0
//   local aRect    := GetClientRect( oDlgParent:hWnd )
   local aPoint := {}
//   local nCol := 100
   *----------------------------------------------------------
/*
   xbrowse( oDlgParent )
   nRow := ( oBrw:nRowSel * oBrw:nRowHeight ) + oBrw:HeaderHeight( .t. ) - 1
   aPoint      := ClientToClient( oDlgParent:hWnd, oBrw:hWnd, { nRow, nCol } )
   xbrowse( aPoint )
*/

   nRow := ( oBrw:nRowSel * oBrw:nRowHeight ) + oBrw:HeaderHeight( .t. ) - 1

   aPoint := ClientToScreen( oBrw:hWnd, { nRow, oBrw:SelectedCol():nDisplayCol } )

/*
   DEFINE DIALOG oDlg ;
      TITLE "Test" + str(nRow) ;
      FROM nRow, 300 ;
      TO nRow + 100, 400 + 6 ;
      PIXEL ;
      STYLE nOr( DS_MODALFRAME, WS_POPUP ) ;
      OF oDlgParent
*/

   DEFINE DIALOG oDlg TITLE "Test" SIZE 220,100 PIXEL TRUEPIXEL

   @ 2, 2 COMBOBOX cCombo ITEMS aItems SIZE 200, 100

   ACTIVATE DIALOG oDlg ON INIT oDlg:Move( aPoint[ 1 ], aPoint[ 2 ] )

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10468
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xbrowse - inline editing

Postby Otto » Tue Mar 19, 2019 4:32 pm

Dear Mr. Rao,
thank you.
I mean why is ? oDlgParent:nTop if I send the DIALOG oDlg to the function always 0.
Best regards
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6255
Joined: Fri Oct 07, 2005 7:07 pm

Re: xbrowse - inline editing

Postby nageswaragunupudi » Tue Mar 19, 2019 5:45 pm

Otto wrote:Dear Mr. Rao,
thank you.
I mean why is ? oDlgParent:nTop if I send the DIALOG oDlg to the function always 0.
Best regards
Otto


First call oDlgParent:CoorsUpdate()
and then check nTop, nLeft, nBottom, nRight
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10468
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Jimmy and 44 guests