estamos en contacto...
El 17 de noviembre de 2008 12:39, Manu <messoft@...> escribió:
Claro es así como hay que hacerlo, espero meterlo dentro de Eagle1 para
evitar el problema, de momento hacerlo así:
...
oDataSet:Open()
if oDataSet:RecCount() > 0
... // Hacer búsquedas o meterlo en un browse
else
MyMsg( "No hay registros..." )
endif
oDataSet es un objeto Query, Table o Cursor local
Pero Mario me refería a tí porque la versión MySQL 5.1.29 vuelve a tener
la lib LibMySQLd.dll para aplicaciones con Eagle1 empotrado o embebido ;-)
Mario Rolando González escribió:> 2008/11/16 Manu <messoft@... <mailto:messoft@...>>
>
> Gracias manu; lo voy a tener en cuenta para bajarlo y hacer las pruebas
> Respecto de la consulta de Vladimir. Ya me había topado con su
> problema; donde la búsqueda no devuelve falso si la Tabla no tiene
> datos, sin no que da error.
> La solución que le doy por ahora :-) es; hacer un SELECT (según la
> condición de búsqueda) y consultar por :LastRec(). si devuelve <> de
> cero habro la Tabla resultado
>
> Saludos
>
>> local cHost := "127.0.0.1 <http://127.0.0.1>"
>
> Hola Vladimir, cómo va todo?
>
> Este es un pequeño ejemplo con xBrowse, sólo para que te hagas una
> idea:
>
> *//----------------------------------------------------------
> // Ejemplo Eagle1 + FW de AMB
> //----------------------------------------------------------
>
> #include "FiveWin.ch"
> #include "xbrowse.ch"
>
> //----------------------------------------------------------
>
> function main()
>
> local oWnd
>
> DEFINE WINDOW oWnd TITLE "Ojeando la tabla: " ;
> MENU BuildMenu( oWnd ) MDI ;
> MENUINFO 3
>
> ACTIVATE WINDOW oWnd MAXIMIZED
>
> return( nil )
>
> //----------------------------------------------------------//
>
> function BuildMenu( oWnd )
>
> local oMenu
> local cFile
>
> MENU oMenu
> MENUITEM "Prueba..."
> MENU
> MENUITEM "Con XBrowse" ;
> ACTION TestxBrw( oWnd )
> ENDMENU
> oMenu:AddMdi()
> ENDMENU
>
> return oMenu
>
> //----------------------------------------------------------//
>
> STATIC FUNCTION TestxBrw( oWnd )
>
> local oChild, oBrw, oCol
> local oMySql, oTabla, oDataBase // Objetos de Eagle1> <http://mrgonzalez_arroba_arnet.com.ar> (tambien MSN) > <http://mgonzalez_arroba_ing.unne.edu.ar>
> local cUser := "root"
> local cPassword := "root"
> local cDbName := "E1Prueba"
> local cTabla := "test"
>
> // Creamos el objeto "connexion"
> oMySql := TMSConnect():New()
>
> // Nos conectamos al servidor
> if !oMySql:Connect( cHost, cUser, cPassword )
> MsgInfo( "No hay conexion con el servidor", "Operación Cancelada" )
> oMySQL:Free()
> return( nil )
> endif
>
> // Creamos un objeto DataBase y lo ponemos en uso
> oDataBase := TMSDataBase():New( oMySql, cDbName, .t. )
>
> // Interrogamos si se logró poner la DataBase por defecto en el
> sistema
> if !oDataBase:Used()
> MsgInfo( "No se puede conectar a la BD: " + cDbName, "Operación
> Cancelada" )
> oTabla:Free()
> oMySQL:Free()
> return( nil )
> endif
>
> // Creamos un objeto Table con DataFields
> oTabla := TMsTable( cTabla ):New( oDataBase, cTabla )
>
> // Abrimos la tabla, traemos el resultado a nuestro cliente
> if !oTabla:Open()
> MsgInfo( "No se puede abrir la tabla: " + cTabla, "Operación
> Cancelada" )
> return( nil )
> endif
>
> DEFINE WINDOW oChild TITLE "Basic Cell selector browse" MDICHILD
> OF oWnd
>
> oBrw := TXBrowse():New( oWnd )
>
> // Columna 1
> oCol := oBrw:AddCol()
> oCol:bStrData := { || PadL( oTabla:FieldGet( 1 ), 6, " " ) }
> oCol:cHeader := oTabla:FieldName( 1 )
> // Columna 2
> oCol := oBrw:AddCol()
> oCol:bStrData := { || oTabla:FieldGet( 2 ) }
> oCol:cHeader := oTabla:FieldName( 2 )
> // Columna 3
> oCol := oBrw:AddCol()
> oCol:bStrData := { || oTabla:FieldGet( 3 ) }
> oCol:cHeader := oTabla:FieldName( 3 )
> // Columna 4
> oCol := oBrw:AddCol()
> oCol:bStrData := { || oTabla:FieldGet( 4 ) }
> oCol:cHeader := oTabla:FieldName( 4 )
> // Columna 5
> oCol := oBrw:AddCol()
> oCol:bStrData := { || oTabla:FieldGet( 5 ) }
> oCol:cHeader := oTabla:FieldName( 5 )
> // Columna 6
> oCol := oBrw:AddCol()
> oCol:bStrData := { || oTabla:FieldGet( 6 ) }
> oCol:cHeader := oTabla:FieldName( 6 )
> // Columna 7
> oCol := oBrw:AddCol()
> oCol:bStrData := { || oTabla:FieldGet( 7 ) }
> oCol:cHeader := oTabla:FieldName( 7 )
> // Columna 8
> oCol := oBrw:AddCol()
> oCol:bStrData := { || oTabla:FieldGet( 8 ) }
> oCol:cHeader := oTabla:FieldName( 8 )
> // Columna 9
> oCol := oBrw:AddCol()
> oCol:bStrData := { || oTabla:FieldGet( 9 ) }
> oCol:cHeader := oTabla:FieldName( 9 )
>
> // Asignamos los codeblock de movimiento
> if MySetBrowse( oBrw, oTabla )
> MyMsg( str( len( oBrw:aCols ) ) )
> else
> MyMsg( "Error en asignacion de CB" )
> endif
>
> oBrw := CreateFromCode( oBrw )
>
> oChild:oClient := oBrw
>
> ACTIVATE WINDOW oChild ON INIT ( MyMsg( str( len( oBrw:aCols ) ) ),
> oBrw:SetFocus() )
>
> // Cerramos los objetos MySQL en orden inverso a la creacion
> // (el objeto database lo cierra el objeto conexion)
> oTabla:Free()
> oMySQL:Free()
>
> return( nil )
>
> //----------------------------------------------------------//
> #define GWL_STYLE -16
>
> #define GW_HWNDFIRST 0
> #define GW_HWNDNEXT 2
>
> #define SM_CYVSCROLL 20
> #define SM_CYHSCROLL 3
>
> #define CS_DBLCLKS 8
>
> #define COLOR_SCROLLBAR 0
> #define COLOR_BACKGROUND 1
> #define COLOR_ACTIVECAPTION 2
> #define COLOR_INACTIVECAPTION 3
> #define COLOR_MENU 4
> #define COLOR_WINDOW 5
> #define COLOR_WINDOWFRAME 6
> #define COLOR_MENUTEXT 7
> #define COLOR_WINDOWTEXT 8
> #define COLOR_CAPTIONTEXT 9
> #define COLOR_ACTIVEBORDER 10
> #define COLOR_INACTIVEBORDER 11
> #define COLOR_APPWORKSPACE 12
> #define COLOR_HIGHLIGHT 13
> #define COLOR_HIGHLIGHTTEXT 14
> #define COLOR_BTNFACE 15
> #define COLOR_BTNSHADOW 16
> #define COLOR_GRAYTEXT 17
> #define COLOR_BTNTEXT 18
> #define COLOR_INACTIVECAPTIONTEXT 19
> #define COLOR_BTNHIGHLIGHT 20
>
> #define DT_TOP 0x00000000
> #define DT_LEFT 0x00000000
> #define DT_CENTER 0x00000001
> #define DT_RIGHT 0x00000002
> #define DT_VCENTER 0x00000004
> #define DT_BOTTOM 0x00000008
> #define DT_WORDBREAK 0x00000010
> #define DT_SINGLELINE 0x00000020
> #define DT_EXPANDTABS 0x00000040
> #define DT_TABSTOP 0x00000080
> #define DT_NOCLIP 0x00000100
> #define DT_EXTERNALLEADING 0x00000200
> #define DT_CALCRECT 0x00000400
> #define DT_NOPREFIX 0x00000800
> #define DT_INTERNAL 0x00001000
> #define DT_EDITCONTROL 0x00002000
> #define DT_PATH_ELLIPSIS 0x00004000
> #define DT_END_ELLIPSIS 0x00008000
> #define DT_MODIFYSTRING 0x00010000
> #define DT_RTLREADING 0x00020000
> #define DT_WORD_ELLIPSIS 0x00040000
> #define DT_NOFULLWIDTHCHARBREAK 0x00080000
> #define DT_HIDEPREFIX 0x00100000
>
> #define MK_MBUTTON 0x0010
>
> #define COL_EXTRAWIDTH 6
> #define ROW_EXTRAHEIGHT 4
> #define COL_SEPARATOR 2
> #define BMP_EXTRAWIDTH 5
>
> #define RECORDSELECTOR_WIDTH 25
>
> #define BITMAP_HANDLE 1
> #define BITMAP_PALETTE 2
> #define BITMAP_WIDTH 3
> #define BITMAP_HEIGHT 4
>
> #define DATATYPE_RDD 0
> #define DATATYPE_ARRAY 1
> //#define DATATYPE_ODBCDIRECT 2
>
> #define VSCROLL_MAXVALUE 10000 // never set values above 32767
>
> function CreateFromCode( Self )
>
> if ::lCreated
> return Self
> endif
>
> ::nId := ::GetNewId()
>
> ::Register( nOr( CS_VREDRAW, CS_HREDRAW, CS_DBLCLKS ) )
>
> if ::lDesign
> ::nStyle := nOr( ::nStyle, WS_CLIPSIBLINGS )
> endif
>
> if ::lVScroll
> ::nStyle := nOr( ::nStyle, WS_VSCROLL )
> endif
>
> if ::lHScroll
> ::nStyle := nOr( ::nStyle, WS_HSCROLL )
> endif
>
> if ! Empty( ::oWnd:hWnd )
> ::Create()
> if ::oFont != nil
> ::SetFont( ::oFont )
> endif
> ::Initiate()
> ::lVisible := .t.
> ::oWnd:AddControl( Self )
> else
> ::lVisible := .f.
> ::oWnd:DefControl( Self )
> endif
>
> return Self
>
> //----------------------------------------------------------//
>
> *Y sí hay avances en Eagle1 y pronto espero sincronizar los avances a
> Condor1.
> Por cierto en MySQL 5.1.29 han incluido el motor de MySQL empotrado o
> embebido, te lo digo por si estas interesado (también a Mario)
> En este momento estoy enfrascado en Sparrow1 el acceso nativo a
> SQLite,
> pronto tendréis noticias... ;-)
>
> Saludos
>
> lubsys escribió:
>
>
> >
> > Hola Manu.. despues de los añoss
> >
> > Hasta la fecha he estado trabajando con LISTBOX para ver registro
> > de una tabla, pero quisiera pasarlo a Xbrowse del Fwh ,, Es
> > posible ??
> >
> > El motivo del cambio es el siguiente :
> >
> > Tengo un cuadro de dialogo donde hay un GET del Campo XXXXX, un
> > boton llamado "BUSCAR AHORA " y un marco de Listbox que mostrara
> > los registros ubicados segun el valor GET registrado ....
> >
> > el primer problema es que para q se pueda activar el listbox, ya
> > debe de existir por lo menos un registro,,,(de lo contrario bota
> > error !!!) y cuando de presione el Boton "BUSCAR AHORA." ese
> > Listbox debera de mostrar el resultado del query...
> >
> > La idea segun lo q me comentaron por ahi. es que el XBrowse no
> > tiene ese problema..
> >
> > Espero tu comentario..
> >
> > a proposito hay algun avance con eagle1 y condor1 ???
> >
> > puede funcionar con fwh 08.08 y Harbour de agost-2008 del
> > foro fwh ???
> >
> > Gracias. estoy atento a tu respuesta
> >
> > lubin
> >
> >
>
>
>
>
>
--
Ing. Mario González
otros correo-e: mrgonzalez_arroba_arnet.com.ar (tambien MSN)
mgonzalez_arroba_ing.unne.edu.ar