FIXED !! Error xbrowse PostMessage( ::oEditGet:hWnd, ...

Post Reply
User avatar
albeiroval
Posts: 323
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

FIXED !! Error xbrowse PostMessage( ::oEditGet:hWnd, ...

Post by albeiroval »

quiero usar la funcion popupBrowse en una columna de xBrowse de esta forma :

Code: Select all

WITH OBJECT :Descripcion
        :nEditType      = if(::lNueva, EDIT_GET, EDIT_NONE)
        :cEditPicture = "@!"
        :bkeyChar           = {|k,f,b,o| ::BuscaDescripcion(k,b,o)}
        END

...

METHOD BuscaDescripcion(k,b,o) CLASS TFactuVenta
    Local aValue  := { {"A0001", "Pollo en Brasa"},;
                                         {"A0002", "Combo me lo llevo"},;
                                         {"A0003", "Pepsi Cola"},;
                                         {"B0001", "Helado de Fresa"},;
                                         {"B0002", "Banana Split"},;
                                         {"C0001", "Ensalada Cole Slaw"},;
                                         {"C0002", "Ensalada Pasta con Pollo"},;
                                         {"C0003", "Racion Papas Fritas"},;
                                         {"D0001", "Cola Cola Ligth"} }
                        
    o:Edit( k )
    PopupBrowse( aValue, o:oEditGet, Nil, 2 )
    if o:oEditGet != Nil
       o:oEditGet:End()
    endif    
Return Nil

 
Pero me genera el siguiente error, cuando presiono cualquier tecla en TGET de la columna 'Descripcion' :

Code: Select all

 Time from start: 0 hours 0 mins 9 secs 
   Error occurred at: 31/08/2020, 12:46:40
   Error description: Error BASE/1004  No existe el método: HWND
   Args:
     [   1] = U   

Stack Calls
===========
   Called from:  => HWND( 0 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:EDIT( 15100 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:KEYCHAR( 3599 )
   Called from:  => TWINDOW:HANDLEEVENT( 0 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1827 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11276 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 )
   Called from:  => DIALOGBOX( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 304 )
   Called from: D:\PROYEC~2\Software\ADMINI~2\Source\venfactu.prg => TFACTUVENTA:DIALOGOFACTURA( 811 )
 
[img]
https://postimg.cc/Ny7PN0DT
[/img]
Last edited by albeiroval on Tue Sep 01, 2020 4:57 pm, edited 1 time in total.
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Error xbrowse PostMessage( ::oEditGet:hWnd, ...

Post by nageswaragunupudi »

It does not seem to be possible to use PopupBrowse with oEditGet of xbrowse.

You may try something like this:

Code: Select all

#include "fivewin.ch"

function XbrPopupBrowse()

   local oDlg, oBrw, oEditGet

   USE CUSTOMER

   DEFINE DIALOG oDlg SIZE 900,700 PIXEL TRUEPIXEL

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" ;
      COLUMNS "FIRST", "NOTES", "SALARY" ;
      CELL LINES NOBORDER FASTEDIT

   WITH OBJECT oBrw
      :nEditTypes    := EDIT_GET
      WITH OBJECT :Notes
         :nEditType  := EDIT_BUTTON
         :bEditBlock := { |r,c,o,k| MyEditAction( o ) }
      END
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED

return nil

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

function MyEditAction( oCol )

   local oDlg, oBrw
   local aValue  := { {"A0001", "Pollo en Brasa"},;
                      {"A0002", "Combo me lo llevo"},;
                      {"A0003", "Pepsi Cola"},;
                      {"B0001", "Helado de Fresa"},;
                      {"B0002", "Banana Split"},;
                      {"C0001", "Ensalada Cole Slaw"},;
                      {"C0002", "Ensalada Pasta con Pollo"},;
                      {"C0003", "Racion Papas Fritas"},;
                      {"D0001", "Cola Cola Ligth"} }

   DEFINE DIALOG oDlg SIZE 300,250 PIXEL TRUEPIXEL
   @ 0,0 XBROWSE oBrw SIZE 0,0 PIXEL OF oDlg DATASOURCE aValue ;
      AUTOCOLS HEADERS "Code", "Description" ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      :lHScroll   := .f.
      :nStretchCol:= 2
      :bLDblClick := { || oCol:VarPut( oBrw:aCols[ 2 ]:Value ), oDlg:End() }
      :bKeyChar   := { |k| If( k == VK_RETURN, ( oCol:VarPut( oBrw:aCols[ 2 ]:Value ), oDlg:End(), 0 ), nil ) }
      :CreateFromCode()
   END

   oDlg:bInit  := { || oCol:AnchorToCell( oDlg ) }

   ACTIVATE DIALOG oDlg CENTERED

return nil
You can test this program by copying to \fwh\samples folder and build with buildh.bat or buildx.bat
Regards

G. N. Rao.
Hyderabad, India
User avatar
albeiroval
Posts: 323
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Re: Error xbrowse PostMessage( ::oEditGet:hWnd, ...

Post by albeiroval »

Excelente, Mr Rao !!!

Eso era lo que buscaba, muchas gracias.
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
Post Reply