topic
stringlengths 1
63
| text
stringlengths 1
577k
⌀ |
---|---|
xBrowse | Colega ambas cosas son posible, pero un poco de codigo como tienes definido el xbrowse y lo usas te aseguro que ayudara a que entre todos consigamos el detalle y podamos ayudarte... saludos... <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: --> |
xBrowse | Estoy preparando un ejemplo para poder ver el problema, pero con el ejemplo no me pasa.
Estoy trabajando con SQLRDD y xHarbour Comercial 1.2, podria ser un problema ?
Voy a necesitar un poco de tiempo.
Gracias. |
xBrowse | Aquí dejo el código para que me puedan echar una mano para resolver-lo.
Confirmado el problema es SQLRDD
También, añado otra pregunta, el parámetro lAllWidth de la classe FOLDER funciona ? por defecto esta en .T. y las pestañas de los tabs son del tamaño del texto.
[code=fw:1u10vlqh]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"InKey.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"xbrowse.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"ribbon.ch"</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"SQLRDD.CH"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"mysql.ch"</span> <span style="color: #B900B9;">// Needed if you plan to use native connection to MySQL</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"pgs.ch"</span> <span style="color: #B900B9;">// Needed if you plan to use native connection to Postgres</span><br /><br />REQUEST DBFCDX<br /><br /><span style="color: #00C800;">STATIC</span> cState := <span style="color: #ff0000;">""</span><br /><br /><span style="color: #00C800;">Function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">Local</span> oWnd, oRBar,oBtn,oGBtn:=<span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><span style="color: #00C800;">Local</span> aGrups<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span>,nHSqlRdd<br /><span style="color: #00C800;">Local</span> cServer:= <span style="color: #ff0000;">"XXXXX"</span><br /><span style="color: #00C800;">Local</span> cDatabase:=<span style="color: #ff0000;">"XXXXX"</span><br /><span style="color: #00C800;">Local</span> cUser:=<span style="color: #ff0000;">"XXXX"</span><br /><span style="color: #00C800;">Local</span> cPassword:= <span style="color: #ff0000;">"XXXX"</span><br /><br /><span style="color: #B900B9;">// Iniciar llibreries</span><br />IniciarRdd<span style="color: #000000;">(</span> <span style="color: #000000;">)</span><br /> <br /><span style="color: #B900B9;">// Treballem amb Sql</span><br />SR_SetGoTopOnScope<span style="color: #000000;">(</span>.f.<span style="color: #000000;">)</span><br />SR_USEDELETEDS<span style="color: #000000;">(</span>.T.<span style="color: #000000;">)</span><br /> <br /><span style="color: #B900B9;">// Cadena de Connecci¢ amb la base de dades. </span><br />cConnString:= <span style="color: #ff0000;">"driver=SQL Server;network=dbmssocn;"</span><br />cConnString+= <span style="color: #ff0000;">"server="</span>+cServer+<span style="color: #ff0000;">";"</span><br />cConnString+= <span style="color: #ff0000;">"database="</span>+cDatabase+<span style="color: #ff0000;">";"</span><br />cConnstring+= <span style="color: #ff0000;">"uid="</span>+cUser+<span style="color: #ff0000;">";"</span><br />cConnString+= <span style="color: #ff0000;">"pwd="</span>+cPassword+<span style="color: #ff0000;">";"</span> <br />nHSqlRdd:= SR_AddConnection<span style="color: #000000;">(</span> CONNECT_ODBC , cConnString, , , , .T. <span style="color: #000000;">)</span> <br /><span style="color: #00C800;">If</span> nHSqlRdd > <span style="color: #000000;">0</span><br /> RddSetDefault<span style="color: #000000;">(</span><span style="color: #ff0000;">"SQLRDD"</span><span style="color: #000000;">)</span><br /><br /> DBUSEAREA<span style="color: #000000;">(</span>.T.,<span style="color: #ff0000;">"SQLRDD"</span>,<span style="color: #ff0000;">"CLIE0110"</span><span style="color: #000000;">)</span><br /> DbSetOrder<span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> DbGotop<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"New TXBrowse class (only for FWH)"</span> <span style="color: #0000ff;">MDI</span> MENUINFO <span style="color: #000000;">3</span><br /> oWnd:<span style="color: #000000;">oMenu</span>:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">// Creaci¢ Objecte Ribbon,</span><br /> oRBar:= TRibbonBar<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> oWnd , <span style="color: #000000;">{</span><span style="color: #ff0000;">"tab1"</span>,<span style="color: #ff0000;">"tab2"</span>,<span style="color: #ff0000;">"tab3"</span><span style="color: #000000;">}</span> , , , , <span style="color: #000000;">132</span> , <span style="color: #000000;">25</span> <span style="color: #000000;">)</span><br /> <br /> <span style="color: #B900B9;">// Bot¢ inici amb el Menu Complert. </span><br /> @ <span style="color: #000000;">4</span>,<span style="color: #000000;">4</span> RBBTN oBtn <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"INICI"</span> <span style="color: #0000ff;">OF</span> oRBar <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">50</span>,<span style="color: #000000;">20</span> POPUP <span style="color: #0000ff;">MENU</span> BuildMenu<span style="color: #000000;">(</span> oWnd <span style="color: #000000;">)</span><br /> oBtn:<span style="color: #000000;">lBalloon</span>:= .T.<br /> oBtn:<span style="color: #000000;">ResetBorder</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> ADD GROUP aGrups<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> RIBBON oRBar <span style="color: #0000ff;">TO</span> OPTION <span style="color: #000000;">1</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"GRUP1"</span><br /> Aadd<span style="color: #000000;">(</span>oGBtn,<span style="color: #00C800;">NIL</span><span style="color: #000000;">)</span><br /> oGBtn<span style="color: #000000;">[</span><span style="color: #000000;">-1</span><span style="color: #000000;">]</span>:= aGrups<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span>:<span style="color: #000000;">AddButton</span><span style="color: #000000;">(</span> <span style="color: #000000;">5</span> , <span style="color: #000000;">5</span> , <span style="color: #000000;">50</span> , <span style="color: #000000;">70</span> , <span style="color: #ff0000;">"Incremental"</span> ,<span style="color: #000000;">{</span>|| Incremental<span style="color: #000000;">(</span> oWnd <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> ,,,,,,,<span style="color: #000000;">)</span><br /> <br /> ADD GROUP aGrups<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> RIBBON oRBar <span style="color: #0000ff;">TO</span> OPTION <span style="color: #000000;">2</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"GRUP2"</span><br /> Aadd<span style="color: #000000;">(</span>oGBtn,<span style="color: #00C800;">NIL</span><span style="color: #000000;">)</span><br /> oGBtn<span style="color: #000000;">[</span><span style="color: #000000;">-1</span><span style="color: #000000;">]</span>:= aGrups<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span>:<span style="color: #000000;">AddButton</span><span style="color: #000000;">(</span> <span style="color: #000000;">5</span> , <span style="color: #000000;">5</span> , <span style="color: #000000;">50</span> , <span style="color: #000000;">70</span> , <span style="color: #ff0000;">"yyyy"</span> ,<span style="color: #000000;">{</span>|| <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"2"</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span> ,,,,,,,<span style="color: #000000;">)</span><br /> ADD GROUP aGrups<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> RIBBON oRBar <span style="color: #0000ff;">TO</span> OPTION <span style="color: #000000;">3</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"GRUP3"</span><br /> Aadd<span style="color: #000000;">(</span>oGBtn,<span style="color: #00C800;">NIL</span><span style="color: #000000;">)</span><br /> oGBtn<span style="color: #000000;">[</span><span style="color: #000000;">-1</span><span style="color: #000000;">]</span>:= aGrups<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span>:<span style="color: #000000;">AddButton</span><span style="color: #000000;">(</span> <span style="color: #000000;">5</span> , <span style="color: #000000;">5</span> , <span style="color: #000000;">50</span> , <span style="color: #000000;">70</span> , <span style="color: #ff0000;">"ZZZZ"</span> ,<span style="color: #000000;">{</span>|| <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"3"</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span> ,,,,,,,<span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd<br /><br /><span style="color: #00C800;">EndIf</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">Nil</span><br /><br /><span style="color: #00C800;">function</span> BuildMenu<span style="color: #000000;">(</span> oWnd <span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> oMenu<br /><br /><span style="color: #0000ff;">MENU</span> oMenu POPUP <span style="color: #000000;">2007</span><br /> <span style="color: #0000ff;">MENUITEM</span> <span style="color: #ff0000;">"Browse RDD data"</span><br /> <span style="color: #0000ff;">MENU</span><br /> <span style="color: #0000ff;">MENUITEM</span> <span style="color: #ff0000;">"Incremental Seek and Inset style"</span> ;<br /> <span style="color: #0000ff;">ACTION</span> Incremental<span style="color: #000000;">(</span> oWnd <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">ENDMENU</span><br /><span style="color: #0000ff;">ENDMENU</span><br /><br /><span style="color: #00C800;">Return</span> oMenu<br /><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> Incremental<span style="color: #000000;">(</span> oWnd <span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> oChild, oBrw,oFld,oRect, oCol<br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oChild <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Proves amb SQLRDD"</span> <span style="color: #0000ff;">MDICHILD</span> <span style="color: #0000ff;">OF</span> oWnd<br />oRect:= oChild:<span style="color: #000000;">GetCliRect</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #B900B9;">// Creem els Tabs de l'Actualitzador.</span><br />oFld:= TFolder<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> <span style="color: #000000;">0</span> , <span style="color: #000000;">0</span> , <span style="color: #000000;">{</span><span style="color: #ff0000;">"BROWSE"</span>,<span style="color: #ff0000;">"FORMULARI"</span><span style="color: #000000;">}</span> , , oChild , , , , .T. , , oRect:<span style="color: #000000;">nWidth</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> , oRect:<span style="color: #000000;">nHeight</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> ,, .T. ,,<span style="color: #000000;">)</span><br /><br />@ <span style="color: #000000;">30</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">"CLIE0110"</span> <span style="color: #0000ff;">SIZE</span> oRect:<span style="color: #000000;">nWidth</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">-20</span> , oRect:<span style="color: #000000;">nHeight</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">-50</span> <span style="color: #0000ff;">OF</span> oFld:<span style="color: #000000;">aDialogs</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">PIXEL</span> CELL LINES<br /><br />oCol:= oBrw:<span style="color: #000000;">AddCol</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oCol:<span style="color: #000000;">cHeader</span> := <span style="color: #ff0000;">"Codi"</span><br />oCol:<span style="color: #000000;">bStrData</span> := FieldBlock<span style="color: #000000;">(</span><span style="color: #ff0000;">"COD_CLIENT"</span><span style="color: #000000;">)</span><br /><br />oCol:= oBrw:<span style="color: #000000;">AddCol</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oCol:<span style="color: #000000;">cHeader</span> := <span style="color: #ff0000;">"Nom Fiscal"</span><br />oCol:<span style="color: #000000;">bStrData</span> := FieldBlock<span style="color: #000000;">(</span><span style="color: #ff0000;">"NOM_F"</span><span style="color: #000000;">)</span><br /><br /><br />oBrw:<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br />oChild:<span style="color: #000000;">oClient</span> := oBrw<br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oChild <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> oBrw:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">Function</span> IniciarRdd<span style="color: #000000;">(</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">// Llibreries SQLRDD</span><br /> REQUEST SQLRDD <span style="color: #B900B9;">// SQLRDD should be linked in</span><br /> REQUEST SQLEX <span style="color: #B900B9;">// SQLRDD Extreme should be linked in</span><br /> <br /> REQUEST SR_ODBC <span style="color: #B900B9;">// Needed if you plan to connect with ODBC</span><br /> REQUEST SR_MYSQL <span style="color: #B900B9;">// Needed if you plan to use native connection to MySQL</span><br /> REQUEST SR_PGS <span style="color: #B900B9;">// Needed if you plan to use native connection to Postgres</span><br /> <br /> SR_USEDELETEDS<span style="color: #000000;">(</span>.T.<span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">Nil</span><br /><br /><br /> </div>[/code:1u10vlqh]
Me estoy iniciando en FWH siento todas mis consultas, y agradezco su ayuda.
Muchas gracias por adelantado.
Pere |
xBrowse | Hola,
Alguien me puede ayudar con el xbrowse con SQLRDD. He dejado el ejemplo anterior.
Con archivos DBF funciona bien.
Gracias.
Pere |
xBrowse | Alguna ayuda para empezar a mirar algo ?
no se por donde empezar ...
Por favor!!
Pere |
xBrowse | Hola,
Como solicitó [b:3csfarwz]joseluisysturiz[/b:3csfarwz] puse el codigo de ejemplo.
Por favor, [b:3csfarwz]Antonio[/b:3csfarwz] o el mismo [b:3csfarwz]joseluisysturiz[/b:3csfarwz], si me pueden echar una mano se lo agradecería muchísimo.
Gracias.
Pere Cordonet |
xBrowse | We have not tested XBrowse with SQLRDD. But you may please try this suggestion.
For SQLRDD, after creating XBROWSE, please add the following lines of code:
[code=fw:2x2ekmnv]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oBrw:<span style="color: #000000;">bKeyNo</span> := oBrw:<span style="color: #000000;">bBookMark</span><br />oBrw:<span style="color: #000000;">bKeyCount</span> := <span style="color: #000000;">{</span> || <span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">cAlias</span> <span style="color: #000000;">)</span>-><span style="color: #000000;">(</span> LastRec<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> </div>[/code:2x2ekmnv] |
xBrowse | Gracias, por responder.
Por fin un poco de ayuda.
He probado las lineas de código que me ofreció y no funciona, sigue haciendo lo mismo.
De todos modos muchas gracias por su respuesta, si quiere que me mire algún tipo de dato, solo tiene que comentarlo.
Muchas gracias de nuevo.
Pere |
xBrowse | Buenos dia, de nuevo.
Ya que nadie me puede echar una mano, seria posible que me respondiera alguien que esté utilizando SQLRDD ?
Y si se puede confirmar la compatibilidad de SQLRDD con xBrowse
Gracias. |
xBrowse | Is possible select multiple Row ?
and get a Array of nRow selected, or it is only to listbox ?
thanks. |
xBrowse | Lailton
[code=fw:vszoogoj]<div class="fw" id="{CB}" style="font-family: monospace;">oBrw:<span style="color: #000000;">nMarqueeStyle</span> = MARQSTYLE_HIGHLROWMS</div>[/code:vszoogoj] |
xBrowse | Guys:
How can I filter an xBrowse so I can include records matching a criteria ?
Thanks |
xBrowse | Hunter
Filters, scopes, or conditional indexes.
James |
xBrowse | James:
How do I implement a filter ? Thank you. |
xBrowse | Hunter,
SET FILTER TO ...
Or, better:
(cAlias)->(dbsetfilter( bCondition, cCondition ))
Be advised that filters can be very slow for large databases. Indexes with scopes are very fast.
James |
xBrowse | Thank you James. I thought that xBrowse has a data for filters. |
xBrowse | Hi all,
Using a DBF with no index...
Which is the rigth way to programatically delete the current record from a Browse???
oBrw:Delete() does not seem to doit for me... |
xBrowse | Do you have SET DELETED ON in your code?
Best regards,
Otto |
xBrowse | [code=fw:13jti5q7]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">cAlias</span> <span style="color: #000000;">)</span>-><span style="color: #000000;">(</span> DbDelete<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br />oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span></div>[/code:13jti5q7] |
xBrowse | [quote="Otto":3cdaozwy]Do you have SET DELETED ON in your code?
[/quote:3cdaozwy]
Thanks Otto, Yes It's ON
[quote:3cdaozwy][code=fw:3cdaozwy]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">cAlias</span> <span style="color: #000000;">)</span>-><span style="color: #000000;">(</span> DbDelete<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br />oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span></div>[/code:3cdaozwy][/quote:3cdaozwy]
Thanks Mr. Rao, It worked as I needed after a few changes in my other code...
Amazingly I did not find It's correct use, on a quick lookup... But I knew that you had the right solution, next time I am going to start by reading your post's... |
xBrowse | After deleting a random row, I get this visual problem now:
[img:2w1fg00z]http://www.mayapos.com/FiveWin/xbrowse3.png[/img:2w1fg00z]
I achieve the effect using :bClrStd
Is there a way to refresh the colors of the browse???
.OR.
I tried to avoid this not turning SET DELETED ON, but the row does not appears DISABLED as it should be, and the button in that deleted row still works, and the text is still shown as Non Deleted.
Is there a way to show it disabled???? |
xBrowse | Bayron,
[quote:10zx2t5s]I achieve the effect using :bClrStd[/quote:10zx2t5s]
Please post the code you use for bClrStd, thanks |
xBrowse | [code=fw:2pwbuheq]<div class="fw" id="{CB}" style="font-family: monospace;">:<span style="color: #000000;">bClrStd</span> := <span style="color: #000000;">{</span> || <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> Eval<span style="color: #000000;">(</span> ListVen:<span style="color: #000000;">bKeyNo</span>,,ListVen <span style="color: #000000;">)</span> % <span style="color: #000000;">2</span> == <span style="color: #000000;">0</span>, <span style="color: #000000;">{</span> CLR_BLACK, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">224</span>, <span style="color: #000000;">236</span>, <span style="color: #000000;">255</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span>, <span style="color: #000000;">{</span> CLR_BLACK, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">189</span>, <span style="color: #000000;">211</span>, <span style="color: #000000;">253</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span></div>[/code:2pwbuheq] |
xBrowse | oBrw:KeyNo() returns the OrdKeyNo() as returned by the RDD. Less known is the fact that OrdKeyNo() returns correct serial number only when FILTER is set on ".NOT. DELETED()" when SET DELETED is ON.
So,
USE <dbf>
SET DELETED ON !DELETED()
GO TOP
Then browse as usual. |
xBrowse | [code=fw:1x1kacdp]<div class="fw" id="{CB}" style="font-family: monospace;">SET DELETED <span style="color: #0000ff;">ON</span> !DELETED<span style="color: #000000;">(</span><span style="color: #000000;">)</span></div>[/code:1x1kacdp]
Does not work on FWH10.2 and xHarbour 1.21...
I also tried:
[code=fw:1x1kacdp]<div class="fw" id="{CB}" style="font-family: monospace;">SET DELETED <span style="color: #0000ff;">ON</span><br />SET FILTER <span style="color: #0000ff;">TO</span> !DELETED<span style="color: #000000;">(</span><span style="color: #000000;">)</span></div>[/code:1x1kacdp]
Anyhow, xBrowse is behaven normally...
The problem is that each line is painted before a row is deleted... and when oBrw:Refresh() is called, :bClrStd is not Evaluated and Repainted again...
[color=#FF0000:1x1kacdp]So if there is not an easy solution ?????? [/color:1x1kacdp]I think I am just going to have to paint a single color in the browse...
Which leads to my next question:
[color=#FF0000:1x1kacdp]Is there a way to paint the Browse Client Area when the Database is Empty??? Right now is ALL WHITE...
[/color:1x1kacdp] |
xBrowse | Bayron,
Use that FOR ... condition to create the index:
INDEX ON ... FOR ! Deleted() ...
example:
[code=fw:yaplcoi3]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">Name</span> TAG <span style="color: #ff0000;">"Name"</span> ;<br /> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">(</span> cPath + <span style="color: #ff0000;">"<span style="color: #000000;">\T</span>est"</span> <span style="color: #000000;">)</span> <span style="color: #00C800;">FOR</span> ! Test-><span style="color: #000000;">(</span> Deleted<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span></div>[/code:yaplcoi3] |
xBrowse | Thanks for taking the time to answer my post, but the problem is not about the Deleted Records, but is that when I delete a record, the color of that row is lost and I get two consecutive rows with the same color....As you can see the above picture... |
xBrowse | Here is a working sample:
Please adopt this logic to your case.
[code=fw:39zfz4lx]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.Ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"ord.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"xbrowse.ch"</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br />REQUEST DBFCDX<br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oDlg, oBrw, oFont<br /><br /> SET DELETED <span style="color: #0000ff;">ON</span><br /><br /> USE CUSTOMER<br /> SET FILTER <span style="color: #0000ff;">TO</span> !DELETED<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> GO TOP<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">'TAHOMA'</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-12</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">600</span>,<span style="color: #000000;">400</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /> @ <span style="color: #000000;">10</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">-10</span>,<span style="color: #000000;">-10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> COLUMNS <span style="color: #ff0000;">"First"</span>, <span style="color: #ff0000;">"City"</span>, <span style="color: #ff0000;">"State"</span>, <span style="color: #ff0000;">"Salary"</span> ;<br /> <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">'CUSTOMER'</span> CELL LINES NOBORDER<br /><br /> WITH OBJECT oBrw<br /> :<span style="color: #000000;">bClrStd</span> := <span style="color: #000000;">{</span> || <span style="color: #000000;">{</span> CLR_BLACK, <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">KeyNo</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> % <span style="color: #000000;">2</span> == <span style="color: #000000;">0</span>, RGB<span style="color: #000000;">(</span><span style="color: #000000;">224</span>,<span style="color: #000000;">236</span>,<span style="color: #000000;">255</span><span style="color: #000000;">)</span>, RGB<span style="color: #000000;">(</span><span style="color: #000000;">189</span>,<span style="color: #000000;">211</span>,<span style="color: #000000;">253</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">bKeyDown</span> := <span style="color: #000000;">{</span> |nKey| <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> nKey == VK_DELETE, <span style="color: #000000;">(</span>oBrw:<span style="color: #000000;">cAlias</span><span style="color: #000000;">)</span>-><span style="color: #000000;">(</span> BrwDelete<span style="color: #000000;">(</span> oBrw <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, <span style="color: #00C800;">nil</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> END<br /><br /><br /> oBrw:<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /><br /><span style="color: #00C800;">return</span> <span style="color: #000000;">(</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> BrwDelete<span style="color: #000000;">(</span> oBrw <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">if</span> DbrLock<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> DELETE<br /> DbUnlock<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> SKIP<br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span> eof<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> GO BOTTOM<br /> <span style="color: #00C800;">endif</span><br /> oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /> </div>[/code:39zfz4lx] |
xBrowse | [quote:3idn3qpj]FiveWin, One line of code and it's done... [/quote:3idn3qpj]
Well Said !!!! |
xBrowse | [quote:m2rnt9fa]Is there a way to paint the Browse Client Area when the Database is Empty??? Right now is ALL WHITE...
[/quote:m2rnt9fa]
As of now, no.
You may try having one blank record to get the effect you want. |
xBrowse | Thanks for your answer, I do use basicly the same logic, but as I said before
[quote:38pzpnjd]The problem is not about the Deleted Records, but is that when I delete a record, the color of that row is lost and I get two consecutive rows with the same color....As you can see the above picture...[/quote:38pzpnjd]
I think the problem is with the painting, when I use oBrw:Refresh() :bClrStd is not Evaluated and Repainted again...
I am just going to set the browse records on a single color... to avoid all of the trouble... |
xBrowse | A note on "SET FILTER TO !DELETED()".
This does not slow down the navigation, if proper care is taken. (Applies to DBFCDX and ADSCDX). On the contrary this will greatly improve the speed in case the DBF contains lots of deleted records.
Important:
Create one tag compulsorily on all medium and large tables on DELETED().'
Example: INDEX ON DELETED() TAG DELETED.
Instead of clearing filter
SET FILTER TO !DELETED()
For setting a filter:
SET FILTER TO <condition> .AND. !DELETED().
Performance will considerably improve on DBFs having many deleted records. |
xBrowse | [quote="Bayron":3kfmrtya]Thanks for your answer, I do use basicly the same logic, but as I said before
[quote:3kfmrtya]The problem is not about the Deleted Records, but is that when I delete a record, the color of that row is lost and I get two consecutive rows with the same color....As you can see the above picture...[/quote:3kfmrtya]
I think the problem is with the painting, when I use oBrw:Refresh() :bClrStd is not Evaluated and Repainted again...
I am just going to set the browse records on a single color... to avoid all of the trouble...[/quote:3kfmrtya]
NOT AT ALL.
I prepared the sample to show you that the alternating colors are painted correctly after deleting records. You see my sample. Works PERFECTLY.
If it is not working for you, please recheck your code.
Note: Hope you are using DBFCDX |
xBrowse | That should be my problem... I am not using Indexes...
I'm sorry, for the misunderstanding, I only mentionated it on the first post!!!
I'll try with indexes... |
xBrowse | Mr. Rao,
I Tested your Sample, and It work's as expected...
I am testing to see how I can apply this to my case, because I am using the browse to add items that do not need sorting, because it's a receipt...
If I use a blank field to index, should the Index leave the order as is???? |
xBrowse | The sample I give works perfectly whether there is any index or not.
But does not work with DBFNTX.
Now I understand that you must be using DBFNTX. If you use DBFCDX, it works as expected, with or without index/
If for some reason you have to use DBFNTX, please keep in mind that you may not be able to avail certain features like this. |
xBrowse | Mr. Rao,
Yes, I Confirm it now, It works with and without Indexes as long as the VIA "DBFCDX" is included when openning the database even if no index is created and used...and the other commands are included:
[code=fw:1sd9wjk0]<div class="fw" id="{CB}" style="font-family: monospace;">REQUEST DBFCDX<br />....<br />SET DELETED <span style="color: #0000ff;">ON</span><br />....<br />....<br /><br />SET FILTER <span style="color: #0000ff;">TO</span> !DELETED<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> </div>[/code:1sd9wjk0]
Thanks for your patience and concise expanations!!!
It is for your very well explanated answers that we can unsderstand how easy it's to use the very complex right use of the powerfull xbrowse... |
xBrowse | to color lines in a browser, try:
[code=fw:36y72gs5]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> <span style="color: #B900B9;">// Setup alternating row flag </span><br /> lClrFlag:=.f. <br /> olbx1:<span style="color: #000000;">bSkip</span>:=<span style="color: #000000;">{</span>| nRecs | <span style="color: #000000;">(</span> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span>nRecs == <span style="color: #00C800;">nil</span>, nRecs := <span style="color: #000000;">1</span>,<span style="color: #000000;">)</span>,nRecs:= arccod-><span style="color: #000000;">(</span>dbskipper<span style="color: #000000;">(</span> nRecs <span style="color: #000000;">)</span><span style="color: #000000;">)</span>, lClrFlag:= <span style="color: #00C800;">if</span><span style="color: #000000;">(</span> nRecs % <span style="color: #000000;">2</span> = <span style="color: #000000;">0</span>, lClrFlag,!lClrFlag<span style="color: #000000;">)</span>, nRecs<span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <br /><br /> <span style="color: #B900B9;">// Define alternating row colors </span><br /> olbx1:<span style="color: #000000;">bClrStd</span>:= <span style="color: #000000;">{</span>|| <span style="color: #00C800;">if</span><span style="color: #000000;">(</span>lClrFlag,<span style="color: #000000;">{</span> CLR_BLACK, RGB<span style="color: #000000;">(</span><span style="color: #000000;">196</span>,<span style="color: #000000;">226</span>,<span style="color: #000000;">255</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span>,<span style="color: #000000;">{</span> CLR_BLACK, RGB<span style="color: #000000;">(</span><span style="color: #000000;">221</span>,<span style="color: #000000;">245</span>,<span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <br /> </div>[/code:36y72gs5]
works both with a set filter to .... and with record delete
I do not remember where I found this code ... perhaps tsbrowse ???
arccod -- name archive
Ciao
Stefano |
xBrowse | Yes, Mr. Stefano's solution works in all cases. |
xBrowse | Dear Mr. Rao,
I will remember that you have worked on a xBrowse version with flexible row high.
What is the status of this project.
Best regards,
Otto |
xBrowse | Mr Otto
Not ready yet. |
xBrowse | Working on this proposal. |
xBrowse and bLClickHeader | Hello RAO
I have an xbrowse with AutoSort: = .t. and bLClickHeader on some columns.
Is it possible not to execute setorder on columns that have bLClickHeader?
Regards Maurizio |
xBrowse and bLClickHeader | Dear Maurizio, try with
[code=fw:2ycquypv]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /> WITH OBJECT :<span style="color: #000000;">oCol</span><span style="color: #000000;">(</span> <span style="color: #000000;">3</span> <span style="color: #000000;">)</span><br /> :<span style="color: #000000;">cSortOrder</span> := <span style="color: #00C800;">nil</span><br /> :<span style="color: #000000;">cOrder</span> := <span style="color: #00C800;">nil</span><br /> END<br /> </div>[/code:2ycquypv] |
xBrowse and bLClickHeader | It works
Thanks Navorro |
xBrowse - no funciona el bEditBlock ?? | Hola a Todos:
Tengo un problema con el xBrowse , no se si estoy haciendo algo mal o es un error de la clase.
Lo que sucede es que no se ejecuta el codeblock del edit
[b:6hh6730l]( bEditBlock ) [/b:6hh6730l], al estar editando directamente en la grilla del browse.
Les adjunto una parte del código.
[code:6hh6730l]
oBrw:aCols[5]:cHeader := "P. COSTO"
oBrw:aCols[5]:nHeadStrAlign := AL_CENTER
oBrw:aCols[5]:nWidth := 80
oBrw:aCols[5]:oHeaderFont := aFont[3]
oBrw:aCols[5]:nEditType := EDIT_GET
oBrw:aCols[5]:bEditBlock := { || MsgInfo( " AVISO - se Uso el Edit Block" ) }
oBrw:aCols[5]:nDataStrAlign := AL_RIGHT
oBrw:aCols[3]:cEditPicture := "@E 999,999,999.99"
oBrw:aCols[5]:bOnPostEdit := { | o,x | aDatos[ oBrw:nArrayAt, 5 ] := x }
[/code:6hh6730l]
Porque no se ejecuta el oBrw:aCols[5]:bEditBlock ??
No se supone que al terminar de editar con un enter, se debería mostrar el mensaje ?? Eso esto correcto ?? O como se debe usar bien ??
Alguna idea .
Saludos, |
xBrowse - no funciona el bEditBlock ?? | Juan,
El dato bEditBlock es para otro uso:
bEditBlock // codeblock to evaluate for the "..." button;
Quizás lo que buscas es bEditValid |
xBrowse - no funciona el bEditBlock ?? | GRACIAS Antonio,
Tienes razón es bEditValid lo que buscaba, requería que al terminar de digitar, se valide una función.
Saludos, |
xBrowse < LINESTYLE > question | Hello,Because i use defined colors and pen-size for lines, are some settings of LINESTYLE not needed anymore ?( i can use them as predefined settings if needed )INSET and RAISED works perfect with defined lines and colors.[img:1hb6zee0]http://www.pflegeplus.com/pictures/xbrtools22.jpg[/img:1hb6zee0]Inset[img:1hb6zee0]http://www.pflegeplus.com/pictures/xbrtools23.jpg[/img:1hb6zee0]Raised[img:1hb6zee0]http://www.pflegeplus.com/pictures/xbrtools24.jpg[/img:1hb6zee0]RegardsUwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
xBrowse < LINESTYLE > question | Uwe,It seems that a user defined pen has priority over a predefined built-in line style |
xBrowse < LINESTYLE > question | Antonio,i will keep both selections.Because the style-color-part belongs to pen-color-selection,i will shift the color-style-part to the pen-color-part. ( predefined internal used ).RegardsUwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
xBrowse FWH 13.07 problem with cSortOrder | Hello
with FWH 13.07 this doesn't works , with FWH 13.03 it works
ADD COLUMN oCol TO oBrw DATA FieldWBlock('DESCRIZ',Select( cAlias))
oCol:cSortOrder := "INU_DE"
I know that I could use
ADD COLUMN oCol TO oBrw DATA FieldWBlock('DESCRIZ',Select( cAlias)) ORDER "INU_DE"
but this break compatibility
Regards Maurizio |
xBrowse FWH 13.07 problem with cSortOrder | In case you did not create XBROWSE with AUTOSORT clause, please set
oBrw:lAutoSort := .t. |
xBrowse FWH 13.07 problem with cSortOrder | Thanks |
xBrowse SetEditType FONT | How can I change the font in edit modus.
Thanks in advance
Otto
[img:23um8vb7]http://www.atzwanger-software.com/fw/xbrwfont.jpg[/img:23um8vb7] |
xBrowse SetEditType FONT | Otto,
The edit font defaults to the same font as the display font so assuming you have changed the display font, then this should work:
oBrw:oEditFont := oFont
James |
xBrowse SetEditType FONT | Thank you, James.
It is working.
Best regards,
Otto |
xBrowse SetEditType FONT | James, do you also know how to change
EDIT_LISTBOX FONT.
Thanks in advance
Otto |
xBrowse SetEditType FONT | Otto,
You can't specify the listbox font. The listbox is defined in this methd:
[code=fw:3gfcut3x]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">METHOD</span> ShowBtnList<span style="color: #000000;">(</span> nKey <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TXBrwColumn<br /> ...<br /> @ <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #0000ff;">LISTBOX</span> ::<span style="color: #000000;">oEditLbx</span> <span style="color: #0000ff;">VAR</span> nAt <span style="color: #0000ff;">OF</span> ::<span style="color: #000000;">oBrw</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">0</span> <span style="color: #0000ff;">ITEMS</span> ::<span style="color: #000000;">aEditListTxt</span></div>[/code:3gfcut3x]
Defining it without specifying a font means that it will default to the Windows default font.
Perhaps you can convince Antonio to make changes to allow it.
James |
xBrowse ascending order | xBrowse
I can’t remember how to fix XBrowse on ascending order when clicking on Header.
Thanks in advance
Otto |
xBrowse ascending order | When we click on header of an unsorted column, it will be sorted in Ascending Order. If we click again on the header of a sorted column, the order keeps toggling between ascending and descending. |
xBrowse ascending order | oCol := obrow1:AddCol()
oCol:bStrData := {||odb1:startdate}
oCol:cHeader := "????"
oCol:cOrder := "A"
oCol:nHeadBmpNo := 1
oCol:bLClickHeader := {|r,c,f,o| ::bas1205( r,c,o) }
...
method bas1205(nrow,ncol,oCol) class bas12class
local aCols,cOrder,nFor,nLen
local nat,id1
aCols := oCol:oBrw:aCols
cOrder := oCol:cOrder
nAt := oCol:nCreationOrder
nLen := LEN(aCols)
for nFor := 1 to nLen
aCols[ nFor ]:nHeadBmpNo := 0
aCols[ nFor ]:cOrder := ""
next
do case
case nAt==1
id1:=::odb1:custid
::odb1:cQuery:="select * from custm1 order by custid"+if(corder=="A"," desc","")
::odb1:refresh()
::obrow:refresh()
::obrow:bseek:={|v|::odb1:SEEK(v,,{||::odb1:custid})}
::obrow:SEEK(id1)
case nAt==3
id1:=::odb1:custm
::odb1:cQuery:="select * from custm1 order by custm"+if(corder=="A"," desc","")
::odb1:refresh()
::obrow:refresh()
::obrow:bseek:={|v|::odb1:SEEK(v,,{||::odb1:custm})}
::obrow:SEEK(id1)
case nAt==5
id1:=::odb1:sales
::odb1:cQuery:="select * from custm1 order by sales"+if(corder=="A"," desc","")
::odb1:refresh()
::obrow:refresh()
::obrow:bseek:={|v|::odb1:SEEK(v,,{||::odb1:sales})}
::obrow:SEEK(id1)
case nAt==6
id1:=::odb1:addrc
::odb1:cQuery:="select * from custm1 order by addrc"+if(corder=="A"," desc","")
::odb1:refresh(.t.)
::obrow:refresh()
::obrow:bseek:={|v|::odb1:SEEK(v,,{||::odb1:addrc})}
::obrow:SEEK(id1)
endcase
if nat==1.or.nat==3.or.nat==5.or.nat==6
if cOrder == "" .or. cOrder == "D"
oCol:cOrder := "A"
oCol:nHeadBmpNo := 1
else
oCol:cOrder := "D"
oCol:nHeadBmpNo := 2
endif
end
return |
xBrowse ascending order | Thank you for your help.
Mr. Rao is it possible to switch off toggling.
Thanks in advance
Otto |
xBrowse ascending order | Mr Otto
We have not provided for disabling toggling.
Do you want to disable toggling globally for the entire project or for selected browses only? |
xBrowse ascending order | Otto
I believe you can just omit AUTOSORT when you create your browse ... if I recall that disables the header click to sort.
Rick Lipkin |
xBrowse ascending order | Mr Rick
He wants autosort.
What he does not want is descending sort.
I shall help when he explains to me whether he wants to suppress Descending sort globally or for selected browses. i shall think of introducing a switch for that purpose. |
xBrowse ascending order | Dear Mr. Rao,
to suppress toggling for a single browser would be fine for me.
Thanks in advance
Otto |
xBrowse ascending order | Mr Otto
Please introduce new DATA by adding this line in the class declaration section of xbrowse.prg
[code=fw:2wjaz8pq]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">DATA</span> lSortDescend AS LOGICAL <span style="color: #0000ff;">INIT</span> .t.<br /> </div>[/code:2wjaz8pq]
Desirable position is next to DATA lAutoSort.
In the METHOD SetOrder CLASS TXBrwColumn, insert these three lines of code just after local declaration:
[code=fw:2wjaz8pq]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">cOrder</span> == <span style="color: #ff0000;">'A'</span> .and. ! ::<span style="color: #000000;">oBrw</span>:<span style="color: #000000;">lSortDescend</span><br /> <span style="color: #00C800;">return</span> .f.<br /> <span style="color: #00C800;">endif</span><br /> </div>[/code:2wjaz8pq]
For whichever browse, you do not want descend sort, please set
oBrw:lSortDescend := .f. |
xBrowse database locking problem | If I use for example
::oBrw:Paste( "test" )
::oBrw:Name:VarPut(( "test" ) the record is locked but not unlocked.
How can we unlock this record again.
Thanks in advance
Otto
[code=fw:3bzgwr2n]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">METHOD</span> Paste<span style="color: #000000;">(</span> cText <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TXBrwColumn<br /><br /> <span style="color: #00C800;">local</span> uNew, cType<br /><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">cDataType</span> $ <span style="color: #ff0000;">'CM'</span><br /> <span style="color: #00C800;">if</span> Eval<span style="color: #000000;">(</span> ::<span style="color: #000000;">oBrw</span>:<span style="color: #000000;">bLock</span> <span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">Value</span> := Trim<span style="color: #000000;">(</span> cText <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">else</span><br /> uNew := uCharToVal<span style="color: #000000;">(</span> cText, @cType <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> uNew != <span style="color: #00C800;">nil</span><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">cDataType</span> == <span style="color: #00C800;">nil</span> .or. ::<span style="color: #000000;">cDataType</span> == cType<br /> <span style="color: #00C800;">if</span> EVal<span style="color: #000000;">(</span> ::<span style="color: #000000;">oBrw</span>:<span style="color: #000000;">bLock</span> <span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">Value</span> := uNew<br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span></div>[/code:3bzgwr2n] |
xBrowse database locking problem | Hello Antonio,
Do you think this fix is save?
Best regards,
Otto
[code=fw:3a1ndqq8]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">FUNCTION</span> SetColFromRDD<span style="color: #000000;">(</span> oCol, nFld, cAlias, aFldInfo <span style="color: #000000;">)</span><br />...<br /><br />changed <span style="color: #0000ff;">to</span>:<br /><br /> <span style="color: #000000;">oCol</span>:<span style="color: #000000;">bOnPostEdit</span> := <span style="color: #000000;">{</span> |o,x,n| <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> n != VK_ESCAPE .and. Eval<span style="color: #000000;">(</span> o:<span style="color: #000000;">oBrw</span>:<span style="color: #000000;">bLock</span> <span style="color: #000000;">)</span>, <span style="color: #000000;">(</span> o:<span style="color: #000000;">Value</span> := x, Eval<span style="color: #000000;">(</span> o:<span style="color: #000000;">oBrw</span>:<span style="color: #000000;">bunLock</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> </div>[/code:3a1ndqq8] |
xBrowse database locking problem | Otto,
Yes, it seems fine to me. Is it working fine ? |
xBrowse database locking problem | Fixed in version 13.01 |
xBrowse one dimensional array | Does xBrowse work on a one dimensional array.Regards,Otto |
xBrowse one dimensional array | No <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( -->Wish it works. Right ? |
xBrowse one dimensional array | Hello NageswaraRao,Thank you.I tested the printer code from Richard and wanted to show the result in a Xbrowse.<!-- m --><a class="postlink" href="http://forums.fivetechsoft.com/viewtopic.php?t=11640">http://forums.fivetechsoft.com/viewtopic.php?t=11640</a><!-- m -->But it didn’t work. I added a extra field and then all was ok.Regards,Otto |
xBrowse one dimensional array | Mr OttoI am extremely sorry for my hasty comment. Single dimentional arrays can be browsed like this.[code:31t5a6df]
#include "fivewin.ch"
#include "xbrowse.ch"
function Main()
local oWnd, oBrw
local aList := { "One..", "Two..", "Three", "Four.", "Five." }
DEFINE WINDOW oWnd
@ 0,0 XBROWSE oBrw ARRAY aList OF oWnd
ADD TO oBrw DATA oBrw:aRow HEADER 'Item'
oBrw:CreateFromCode()
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd
return nil
/*
otherways of writing the above code.
ADD TO oBrw DATA aList[ oBrw:nArrayAt ] HEADER "item"
or
oCol := oBrw:AddCol()
oCol:bStrData := { || aList[ oBrw:nArrayAt ] }
But I prefer to write the shortest code as above. XBrowse pampers my laziness.
*/
[/code:31t5a6df] |
xBrowse one dimensional array | Hello NageswaraRao,thank you for your help.The dBase syntax is working perfectly but trying the other two ways you suggested I get an error.ADDCOL no method ( I am not sure but I think I am still on FW 8.02) And the first test errors out with argument error Len from errorsys, line 0.Would you please be so kind to help me.Thanks in advanceOttoSTATIC FUNCTION ShowPrinters( oWnd ) local oChild, oBrw, oCol local ADEVICES := {} local aStruc:={} ADEVICES := GETIMPRI(ADEVICES) DEFINE WINDOW oChild TITLE "DBF structrure without record selector" MDICHILD OF oWnd oBrw := TXBrowse():New( oChild ) oBrw:SetArray( ADEVICES) ADD TO oBrw DATA ADEVICES[ oBrw:nArrayAt ] HEADER "item" // oCol := oBrw:AddCol() // oCol:bStrData := { || ADEVICES[ oBrw:nArrayAt ] } // @ 0,0 XBROWSE oBrw ARRAY ADEVICES OF oChild // ADD TO oBrw DATA oBrw:aRow HEADER 'Item' oBrw:CreateFromCode() oChild:oClient := oBrw ACTIVATE WINDOW oChild ON INIT oBrw:SetFocus()RETURN NIL//----------------------------------------------------------------------------//FUNCTION GETIMPRI(ADEVICES)*----------------------------------------LOCAl cAllEntries, cEntry, I, cName, cPrn, cPort, JcAllEntries := STRTRAN( GetProfString( "Devices" ), Chr( 0 ), CRLF )FOR I:= 1 TO MlCount( cAllEntries )cName := MemoLine( cAllEntries,,I)cEntry := GetProfString( "Devices",cName,"")J := 2WHILE ! EMPTY(cPort := StrToken(cEntry,J++,","))// AADD(aDevices,TRIM(cName))AADD(aDevices,TRIM(cName) + "," + CENTRY ) // CHIDIAKENDDONEXTRETURN aDevices |
xBrowse one dimensional array | Mr Otto>oCol := oBrw:AddCol() oCol:bStrData := { || ADEVICES[ oBrw:nArrayAt ] }>This syntax should work even with the oldest version of XBrowse. I can't think of any reason why it should not work for you. Will you please try again ?I personally suggest you to use the latest version 8.05. Do you have any techinical problems in upgrading to 8.05 ? |
xBrowse one dimensional array | Mr OttoI checked up the source code of xbrowse in 8.02.If you are using this version, please make the following change in the orginal XBrowse.Prg[code:2iphobnu]
METHOD SetArray( ........... )
<< FWH code >>
::aCols := {} // after this is FWH code
if ValType( aData[ 1 ] ) == 'A' // insert this line here
// fwh code continues
for nFor := 1 to len( aData[ 1 ] )
oCol := ::AddCol()
<< FWH code >>
next
// after this FWH code,
endif // insert this line here
<< fwh code continues >>
[/code:2iphobnu]
After making this change, you can now use it for single dimentional array.
[code:2iphobnu]
oBrw := TXBrowse():New( oChild )
oBrw:SetArray( ADEVICES )
oCol := oBrw:AddCol()
oCol:bStrData := { || ADEVICES[ oBrw:nArrayAt ] }
[/code:2iphobnu]Hope this works for you, if you are using version 8.02 |
xBrowse one dimensional array | Thank you very much for your help.Regards,Otto |
xBrowse one dimensional array | FWH 8.06 handles single dimensional arrays ( even with mixed type values ) easily:Example[code:1ensbc4h]
#include 'fivewin.ch'
#include 'xbrowse.ch'
function main()
local oDlg, oBrw
local aData := { 'one ', 'two ', 'three', 20, DATE() }
DEFINE DIALOG oDlg SIZE 200,200 PIXEL
oBrw := TXBrowse():New( oDlg )
oBrw:SetArray( aData )
oBrw:aCols[ 1 ]:nWidth := 50
oBrw:aCols[ 1 ]:cHeader := 'Array'
oBrw:nStretchCol := 1
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
return nil
[/code:1ensbc4h] |
xBrowse & Column Widths | All,
I have an xbrowse with six data lines. I set the length of each line to 25 chars and set all columns to be the same width.
The problem is some of the datalines do not fit within the column width and require more room horizontally. This causes the other data lines to wrap and they are not visible unless the user manually widens the column.
For a normal one dataline browse the data is simply truncated. Is there any way to get the multi dataline browse to behave the same way? Or are there any other suggestions?
Using FWH 8.01
Thanks,
Randal Ferguson |
xBrowse & Edit Cell | Hi!
It's necessary for me, that cell editing in some xBrowse cells started with the end of value of a cell.
(User input the address. He selects street from the another browse, then the pointer in a cell has to go on the end of streets name, and then the user input house and apartment numbers)
I tried :
[code=fw:5rollwyl]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">6</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">bEditWhen</span>:=<span style="color: #000000;">{</span>|uVal,<span style="color: #00C800;">self</span>,nkey|<span style="color: #000000;">(</span>SelectStreet<span style="color: #000000;">(</span>@uVal,@nkey<span style="color: #000000;">)</span>,oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">6</span> <span style="color: #000000;">]</span>:<span style="color: #00C800;">Edit</span><span style="color: #000000;">(</span>VK_END<span style="color: #000000;">)</span>,.F.<span style="color: #000000;">)</span><span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">Function</span> SelectStreet<span style="color: #000000;">(</span>uVal,nkey<span style="color: #000000;">)</span><br /> ...<br /> uVal:=oemtoansi<span style="color: #000000;">(</span>ALLTRIM<span style="color: #000000;">(</span>street->NAMES<span style="color: #000000;">)</span><span style="color: #000000;">)</span>+space<span style="color: #000000;">(</span><span style="color: #000000;">30</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">return</span> .t.<br /> </div>[/code:5rollwyl]
but it doesn't work...
How can I make it?
Thank's |
xBrowse & Edit Cell | So... I made it by changing this string in the end of method Edit(nKey) in class TXBrwColumn:
Instead
[code=fw:31vy2wbj]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">if</span> nKey != <span style="color: #00C800;">nil</span><br /> PostMessage<span style="color: #000000;">(</span> ::<span style="color: #000000;">oEditGet</span>:<span style="color: #000000;">hWnd</span>, WM_CHAR, nKey <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> </div>[/code:31vy2wbj]
I put:
[code=fw:31vy2wbj]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> <span style="color: #00C800;">if</span> nKey != <span style="color: #00C800;">nil</span><br /> <span style="color: #00C800;">if</span> !GetKeyState<span style="color: #000000;">(</span> VK_SHIFT <span style="color: #000000;">)</span>.and.<span style="color: #000000;">(</span>nKey IN <span style="color: #000000;">{</span>VK_END,VK_HOME<span style="color: #000000;">}</span><span style="color: #000000;">)</span><br /> PostMessage<span style="color: #000000;">(</span> ::<span style="color: #000000;">oEditGet</span>:<span style="color: #000000;">hWnd</span>, WM_KEYDOWN, nKey <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> PostMessage<span style="color: #000000;">(</span> ::<span style="color: #000000;">oEditGet</span>:<span style="color: #000000;">hWnd</span>, WM_CHAR, nKey <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /> </div>[/code:31vy2wbj]
In that case the code above (in first post) is work fine. But I don't know, is this way correct? <!-- s:roll: --><img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" /><!-- s:roll: --> |
xBrowse & Excel | Hi:
I have a customer that is using MS Office 2010. When I call ToExcel in xbrowse they get an error message stating "spreadsheet software not installed". It works fine with Office 2003 and 2007.
Can anyone tell me what the problem might be?
Using FWH 10.9 and xHarbour 1.2.1.
Thanks,
Randal |
xBrowse & Excel | Please see this topic
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=18483&p=96817&hilit=office#p96817">viewtopic.php?f=3&t=18483&p=96817&hilit=office#p96817</a><!-- l -->
Is this of any help? |
xBrowse & Excel | [quote="nageswaragunupudi":apo4pp5b]Please see this topic
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=18483&p=96817&hilit=office#p96817">viewtopic.php?f=3&t=18483&p=96817&hilit=office#p96817</a><!-- l -->
Is this of any help?[/quote:apo4pp5b]
Thanks for your reply. I'll try changing the internet security options and see if it helps.
Randal |
xBrowse & Recordset related errors in FWH 9.06 | I am using FWH 9.06. I have found the following errors in Xbrowse when associated with Recordsets.
1) In line no.5971, Method ToCalc() is trying to make a call to CopyFromRecordSet(). I understand that OpenOffice Calc does not support this function. This function is only supported by Excel and there is no equivalent function in OpenOffice Calc. XBrowse errors out at this line. This function is called only when the xBrowse condition [b:2zspge6e]"Len( aCols ) == ::oRs:Fields:Count()"[/b:2zspge6e] is evaluated as .T., otherwise xbrowse uses the regular ClipBoard copy/paste method to transfer the xBrowse contents to Calc/Excel and it may work if the recordset does not contain a numeric column.
I tried to by pass this error by adding an extra column to the recordset, so that the condition [b:2zspge6e]"Len( aCols ) == ::oRs:Fields:Count()"[/b:2zspge6e] is evaluated to .F. and xBrowse tries to use ClipBoard copy/paste method. But then another problem rises ie, if the recordset contains numeric column, it errors out at line 9405 ie
RetVal := AllTrim( Eval( ::bStrData ) ) // Alltrim will generate error.
I found that the same problem exists in the Method To Excel() when the CopyFromRecordSet() is not utilised to transfer xBrowse data contents to Excel. XBrowse will not use CopyFromRecordSet() when the xBrowse displayed columns and RecordSet FieldCount() differs
For testing purpose you can recreate the error by following the below given steps
1. Create a record set containing a numeric column
For eg. Name, Salary, Address. Salary should be a numeric column
2. Make xBrowse to display only column 1 and 2 ie Name & Salary.
3. Try to call ToExcel()
I understand that xBrowse expects the bStrData to be of character type and it tries to do Alltrim() (Line 9405) and StrTran() in the Method ClpRow() Line No. 5155 and errors out when the bStrData type is not of a character type
Any help is appreciated.
Regards
Anser |
xBrowse & Recordset related errors in FWH 9.06 | Mr Anser
[quote:1xz5j86s]This function is only supported by Excel and there is no equivalent function in OpenOffice Calc. XBrowse errors out at this line.[/quote:1xz5j86s]
You are right. This seems to be an inadvertent copy of ToExcel code to ToCalc method when the ToCalc method was introduced. This line should be removed from ToCalc method. Hope this will be fixed in version 9.08
About bStrData:
Actually XBrowse expects bStrData to return Character value only. We are not supposed to assign a codeblock returning non-character value to bStrData.
In fact direct use of bStrData is deprecated long time back.
Please read this extract from Whatsnew.txt version 8.03 ( March 2008 )
[code=fw:1xz5j86s]<div class="fw" id="{CB}" style="font-family: monospace;">* TXBrowse Enhancements: <span style="color: #000000;"><span style="color: #000000;">(</span>please</span> review samples\TestXBr3.prg<span style="color: #000000;">)</span><br /><br /> a<span style="color: #000000;">)</span> bStrData: <span style="color: #000000;">Deprecated</span>, Users are advised <span style="color: #0000ff;">to</span> assign a codeblock returning the <span style="color: #00C800;">data</span> in<br /> its native type <span style="color: #000000;">(</span> <span style="color: #ff0000;">'N'</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #ff0000;">"D"</span>, <span style="color: #ff0000;">"L"</span> <span style="color: #000000;">)</span> and optionally assigining the <span style="color: #0000ff;">picture</span> <span style="color: #0000ff;">to</span><br /> oCol:<span style="color: #000000;">cEditPicture</span>. Browse <span style="color: #00C800;">class</span> will automatically derive the bStrData <span style="color: #0000ff;">from</span> the<br /> bEditValue and cEditPicture, <span style="color: #00C800;">if</span> specified, and in addition the Browse can<br /> appropriately handle the values <span style="color: #00C800;">for</span> alignment, formatting, copy / export <span style="color: #0000ff;">to</span><br /> excel and reports.<br /><br /> </div>[/code:1xz5j86s]
We are advised to use bEditValue only. Codeblocks returning any datatype ( numeric, date, or whatever ) can be assigned to bEditValue. XBrowse internally constructs bStrData codeblock from bEditValue and cEditPicture ( if assigned ).
It is also desirable to use xbrowse command syntax than direct assignment to the data in oops way. If we use command syntax, xbrowse internally handles many dependant codeblocks automatically. Particularly for recordsets, it is all the more advantageous to depend on xbrowse's automatically generated codeblocks rather than our own codeblocks.
In your case:
[quote:1xz5j86s]For testing purpose you can recreate the error by following the below given steps
1. Create a record set containing a numeric column
For eg. Name, Salary, Address. Salary should be a numeric column
2. Make xBrowse to display only column 1 and 2 ie Name & Salary.
3. Try to call ToExcel()
[/quote:1xz5j86s]
Your code should be :
[code=fw:1xz5j86s]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oCol:<span style="color: #000000;">bEditValue</span> := <span style="color: #000000;">{</span> || oRs:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Salary"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> <span style="color: #000000;">}</span><br />oCol:<span style="color: #000000;">cEditPicture</span> := <span style="color: #ff0000;">'999,999.99'</span> <span style="color: #B900B9;">// This is optional</span><br /> </div>[/code:1xz5j86s]
You will not get any error.
In fact it is all the more easier and advantageous to use command syntax
[code=fw:1xz5j86s]<div class="fw" id="{CB}" style="font-family: monospace;"><br />@ <span style="color: #000000;">0</span>,<span style="color: #000000;">0</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">OF</span> oWnd COLUMNS <span style="color: #ff0000;">'Name'</span>, <span style="color: #ff0000;">'Salary'</span> RECORDSET oRs</div>[/code:1xz5j86s]
In this case xbrowse generates codeblocks which are empty recorset tolerant, assigns appropriate picture clause etc. To write all the code directly in our program would take atleast 4 or 5 lines of code for each column |
xBrowse & Recordset related errors in FWH 9.06 | Dear Mr.Rao,
Thank you for the effort. You are right.
[b:1g1bz8ec]This did the trick[/b:1g1bz8ec]
[code=fw:1g1bz8ec]<div class="fw" id="{CB}" style="font-family: monospace;">oCol:<span style="color: #000000;">bEditValue</span> := <span style="color: #000000;">{</span> || oRs:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Salary"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> <span style="color: #000000;">}</span><br />oCol:<span style="color: #000000;">cEditPicture</span> := <span style="color: #ff0000;">'999,999.99'</span> <span style="color: #B900B9;">// This is optional</span></div>[/code:1g1bz8ec]
(Below given code) This was how I used to write the code while using RecordSets with xBrowse. Now I understand that I was wrong
[code=fw:1g1bz8ec]<div class="fw" id="{CB}" style="font-family: monospace;">oBrw:=TxBrowse<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span>oDlg<span style="color: #000000;">)</span><br /><br />oCol:=oBrw:<span style="color: #000000;">AddCol</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oCol:<span style="color: #000000;">bStrData</span> := <span style="color: #000000;">{</span> || <span style="color: #00C800;">IF</span><span style="color: #000000;">(</span>oRecSet:<span style="color: #000000;">BOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> .AND. oRecSet:<span style="color: #000000;">EOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>,SPACE<span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span>,oRecSet:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"EmpName"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><br />oCol:<span style="color: #000000;">cHeader</span> := <span style="color: #ff0000;">"Employee Name"</span><br />oCol:<span style="color: #000000;">nHeadStrAlign</span> := AL_LEFT<br />oCol:<span style="color: #000000;">nDataStrAlign</span> := AL_LEFT<br />oCol:<span style="color: #000000;">nWidth</span> := <span style="color: #000000;">216</span><br /><br /><span style="color: #B900B9;">// Numeric Column</span><br />oCol:=oBrw:<span style="color: #000000;">AddCol</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oCol:<span style="color: #000000;">bStrData</span> := <span style="color: #000000;">{</span> || <span style="color: #00C800;">IF</span><span style="color: #000000;">(</span>oRecSet:<span style="color: #000000;">BOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> .AND. oRecSet:<span style="color: #000000;">EOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>,SPACE<span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span>,oRecSet:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Salary"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><br />oCol:<span style="color: #000000;">cHeader</span> := <span style="color: #ff0000;">"Salary"</span><br />oCol:<span style="color: #000000;">nHeadStrAlign</span> := AL_LEFT<br />oCol:<span style="color: #000000;">nDataStrAlign</span> := AL_LEFT<br />oCol:<span style="color: #000000;">nWidth</span> := <span style="color: #000000;">216</span><br /><br />xBrwAdoSettings<span style="color: #000000;">(</span>oBrw,oRecSet<span style="color: #000000;">)</span> <span style="color: #B900B9;">// ADO Settings for xBrowse</span><br />oBrw:<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span> ;<br /> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> <span style="color: #000000;">(</span>oBrw:<span style="color: #000000;">nHeight</span>:= oDlg:<span style="color: #000000;">nHeight</span><span style="color: #000000;">-35</span>,oBrw:<span style="color: #000000;">nWidth</span>:=oBrw:<span style="color: #000000;">nWidth</span><span style="color: #000000;">+110</span><span style="color: #000000;">)</span><br /><br />*-----------------------------------*<br /><span style="color: #00C800;">Function</span> xBrwAdoSettings<span style="color: #000000;">(</span>oBrw,oRecSet<span style="color: #000000;">)</span><br />*-----------------------------------*<br />oBrw:<span style="color: #000000;">bGoTop</span> := <span style="color: #000000;">{</span> || <span style="color: #00C800;">IF</span><span style="color: #000000;">(</span> ! oRecSet:<span style="color: #000000;">BOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> .AND. ! oRecSet:<span style="color: #000000;">EOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oRecSet:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br />oBrw:<span style="color: #000000;">bGoBottom</span> := <span style="color: #000000;">{</span> || <span style="color: #00C800;">IF</span><span style="color: #000000;">(</span> ! oRecSet:<span style="color: #000000;">BOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> .AND. ! oRecSet:<span style="color: #000000;">EOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oRecSet:<span style="color: #000000;">MoveLast</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br />oBrw:<span style="color: #000000;">bBof</span> := <span style="color: #000000;">{</span> || oRecSet:<span style="color: #000000;">BOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br />oBrw:<span style="color: #000000;">bEof</span> := <span style="color: #000000;">{</span> || oRecSet:<span style="color: #000000;">EOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br />oBrw:<span style="color: #000000;">bBookMark</span> := <span style="color: #000000;">{</span> |uBm| <span style="color: #00C800;">IF</span><span style="color: #000000;">(</span> oRecSet:<span style="color: #000000;">BOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> .AND. oRecSet:<span style="color: #000000;">EOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, <span style="color: #000000;">0</span>, <span style="color: #00C800;">IF</span><span style="color: #000000;">(</span> uBm == <span style="color: #00C800;">NIL</span>, oRecSet:<span style="color: #000000;">BookMark</span>, oRecSet:<span style="color: #000000;">BookMark</span> := uBm <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br />oBrw:<span style="color: #000000;">bKeyNo</span> := <span style="color: #000000;">{</span> |n| <span style="color: #00C800;">IF</span><span style="color: #000000;">(</span> oRecSet:<span style="color: #000000;">BOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> .AND. oRecSet:<span style="color: #000000;">EOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, <span style="color: #000000;">0</span>, <span style="color: #00C800;">IF</span><span style="color: #000000;">(</span> n == <span style="color: #00C800;">NIL</span>, oRecSet:<span style="color: #000000;">AbsolutePosition</span>, oRecSet:<span style="color: #000000;">AbsolutePosition</span> := n <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br />oBrw:<span style="color: #000000;">bKeyCount</span> := <span style="color: #000000;">{</span> || oRecSet:<span style="color: #000000;">RecordCount</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br />oBrw:<span style="color: #000000;">SetAdo</span><span style="color: #000000;">(</span>oRecSet<span style="color: #000000;">)</span><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:1g1bz8ec]
Once again thank you for pointing me towards the right direction
Regards
Anser |
xBrowse & Recordset related errors in FWH 9.06 | I would advise you to use the command syntax suggested by me above. You will notice that 3 or 4 lines of code is equivalent to 100s of lines of code written in the oops way. In addition the xbrowse internally generates well tested codeblocks and does lot more work than we can do. For example the above single line code also generates picture clauses (comma delimited where needed), posteditblocks, ready for edit and a lot more.
testxbr3.prg in the samples folder gives examples of building xbrowse from ADO recordsets. If we write the same code in oops way ourselves we would have to write several pages of code to achieve the same result |
xBrowse & SELECT parameter | I am working in conversion of old FW & Clipper systems.
I just discovered that the SELECT clause in REDEFINE XBROWSE is accepted but not processed. (I tested with several FWH versions)
Discovered also that oBrw:SetFilter("field", <field>) does not exist in xBrowse.
In this case, there are NTX index files. (cannot use ordscope).
Any suggestions?
TIA Euclides. |
xBrowse & SELECT parameter | This feature is not available in XBrowse. |
xBrowse & SELECT parameter | Hi, sorry for hearing that... In this case, I suggest to elininate the line:
[code=fw:2xkzz6t0]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #000000;">[</span> <span style="color: #0000ff;">SELECT</span> <cField> <span style="color: #00C800;">FOR</span> <uValue1> <span style="color: #000000;">[</span> <span style="color: #0000ff;">TO</span> <uValue2> <span style="color: #000000;">]</span> <span style="color: #000000;">]</span> ;<br /> </div>[/code:2xkzz6t0]
from the DEFINE & REDEFINE statements in th XBROWSE.CH
I will keep using TWBROWSE
Regards, Euclides |
xBrowse & SELECT parameter | It is your choice to use xbrowse or wbrowse.
We did not implement in xbrowse because now ORDSCOPE() works for DBFNTX also and this is a lot better than implementation inside browse logic.
ORDSCOPE( 0, "B" )
ORDSCOPE( 1, "D" )
GO TOP
and XBrowse.
This is quite efficient |
xBrowse & SELECT parameter | You should consider moving to CDXs--they all exist in one file and you can globally set them to open automatically whenever you open the DBF.
Better yet, you should consider moving to database objects--no more using aliases or work areas. You can eliminate lots of code this way. This provides easier to read code with less bugs, and it is easier to maintain.
oCustomer:= TCustomer():New( cCustNo )
msgInfo( oCustomer:balance() )
How easy is that? |
xBrowse & SELECT parameter | [quote="James Bott":2sdg79ri]You should consider moving to CDXs--they all exist in one file and you can globally set them to open automatically whenever you open the DBF.
Better yet, you should consider moving to database objects--no more using aliases or work areas. You can eliminate lots of code this way. This provides easier to read code with less bugs, and it is easier to maintain.
oCustomer:= TCustomer():New( cCustNo )
msgInfo( oCustomer:balance() )
How easy is that?[/quote:2sdg79ri]
Mr James.
Your advise is good. But every programmer here has already running applications with large code. It is not so easy to convert the entire project to oops or even converting from ntx to cdx.
They need simple solution to work without undertaking a major change.
Using OrdScope() is much simpler for dbfntx also.
I am considering why not we translate the SELECT .... clause in xbrowse to apply OrdScope() inside the xbrowse.prg which makes it easier for migration from wbrowse to xbrowse. May be we provide this in the next release. |
xBrowse & SELECT parameter | Thanks Mr.Rao. I was not aware about using ORDSCOPE with DBFNTX.
But let me insist...
in XBROWSE.CH, in the statement #xcommand:
#xcommand @ <nRow>, <nCol> [ COLUMN ] XBROWSE <oBrw> ;
... the line:
[ SELECT <cField> FOR <uValue1> [ TO <uValue2> ] ] ;
should be deleted
Your thougths please...
Regards, Euclides |
xBrowse & SELECT parameter | Hi James, thanks for the info...
As I stated in the beggining, I am converting an old FiveWin-Clipper app.
I used (until today in smal systems) to load the DBF into an Array and after the dialog, load it back to DBF (scatter & gather functions).
Would be a lot of work rewrite it to use TDatabase
In the newest systems, I am using TDatabase extesively.
Regards, Euclides |
xBrowse & SELECT parameter | For your information, class TDataRow is created to be used in the place of scatter/gather logic, but this class is robust and safer. We can also address the fieldnames as oRec:fieldname.
TDataRow works with DBF, TDatabase, ADO Recordset, TRecSet, DolphinQry exactly the same way. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.