topic
stringlengths 1
63
| text
stringlengths 1
577k
⌀ |
---|---|
xbrowse -Unselect line | Other way:
oBrw:nMarqueeStyle := 0 |
xbrowse -Unselect line | Francisco;
Thanks for your reply. If I understand correctly, I'm afraid this won't work. The problem is a bit more complicated. The xbrowse is displayed so that the user may pick multiple lines. They achieve this by clicking on the record while pressing cntrl. But the problem is that the first record is already selected. Unless the users unselects the record, it comes back on the ::aSelection data of the xbrowse. Since upgrading my fwh, my users are not happy about having to Un-select the first record before selecting the ones they really want selected.
So painting the first record on another color, will not remove it from aSelection.
nMarqueestyle =0, will not work, since you can not do multiple selections with value zero on nmarqueestyle.
With Regards,
Reinaldo. |
xbrowse -Unselect line | I see now. But users can select the first line they want, by clicking without pressing ctrl, and then to do click on the next record while pressing ctrl. I know ... customer is always right.
On the other hand, I think it's interesting that you post. I'll do some tests, and if I get something positive, I'll let you know.
Regards. |
xbrowse -Unselect line | Francisco;
Yes. You are correct. The user may click on any other line, and that removes the 1st record from aSelection.
But, most times my users don't want any record selected. My previous xbrowse does NOT autoselects a record when nMarqueeStyle = 5. It makes no sense to auto-select a row when you are showing a multiple-selection xbrowse.
Reinaldo. |
xbrowse -Unselect line | Reinaldo, test this code, please.
oBrw2:CreateFromResource(181)
oBrw2:SetRDD()
[b:3qyodq1c] oBrw2:bKeyDown := { |nKey| if(oBrw2:nMarqueeStyle==0,oBrw2:nMarqueeStyle := MARQSTYLE_HIGHLROWMS,) }[/b:3qyodq1c]
...
ACTIVATE DIALOG oDlg CENTERED ;
[b:3qyodq1c] ON INIT ( if(oBrw2:nMarqueeStyle == MARQSTYLE_HIGHLROWMS,; //Multiselect
(oBrw2:aSelected:={},oBrw2:Select(0),oBrw2:nMarqueeStyle:=0),) )
[/b:3qyodq1c]
Francisco |
xbrowse -Unselect line | [quote="reinaldocrespo":17laqpd3]Hi.
Is there a way to open an xbrowsed array with NO record selected?
Thank you,
Reinaldo.[/quote:17laqpd3]
I can think of this workaround for the time being:
[code=fw:17laqpd3]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span>/<span style="color: #0000ff;">DIALOG</span> ....... <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> <span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">aSelected</span> := <span style="color: #000000;">{</span><span style="color: #000000;">}</span>, oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oBrw:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span></div>[/code:17laqpd3]
OR
[code=fw:17laqpd3]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> <span style="color: #000000;">(</span>oBrw:<span style="color: #0000ff;">Select</span><span style="color: #000000;">(</span> <span style="color: #000000;">0</span> <span style="color: #B900B9;">/* or 2 */</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">oBrw</span>:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span></div>[/code:17laqpd3]
Can you also please indicate which older version the first record was NOT selected initially? This would help trace changes between the present and the older version. To the best of my knowledge, there was no intentional change in the multi-select behavior but it is possible that there was some change in the code at sometime inadvertantly. |
xbrowse -Unselect line | Modification to XBrowse:
Please locate these three lines in the METHOD Adjust() of XBrowse calss:
[code=fw:uqatuwsw]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">nMarqueeStyle</span> == MARQSTYLE_HIGHLROWMS<br /> ::<span style="color: #0000ff;">Select</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> </div>[/code:uqatuwsw]
Comment out these three lines.
Then initially no row will be selected.
But were these lines of code not there in the older version? |
xbrowse -get date - resolved | Nages,
here not run ok
I have an array ( aItems)
[code=fw:s9qgni08]<div class="fw" id="{CB}" style="font-family: monospace;"> <br />@ <span style="color: #000000;">120</span>, <span style="color: #000000;">02</span> <span style="color: #0000ff;">XBROWSE</span> oBrowse <span style="color: #0000ff;">OF</span> oFolder:<span style="color: #000000;">aDialogs</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> ;<br /> COLUMNS <span style="color: #000000;">3</span>,<span style="color: #000000;">4</span>,<span style="color: #000000;">5</span>,<span style="color: #000000;">6</span>,<span style="color: #000000;">7</span>,<span style="color: #000000;">8</span>,<span style="color: #000000;">9</span>,<span style="color: #000000;">10</span>,<span style="color: #000000;">11</span>,<span style="color: #000000;">12</span>,<span style="color: #000000;">13</span>;<br /> HEADERS <span style="color: #ff0000;">"Ico"</span>,<span style="color: #ff0000;">"Tipo"</span>,<span style="color: #ff0000;">"Servizio"</span>,<span style="color: #ff0000;">"Q.tà"</span>,<span style="color: #ff0000;">"Costo"</span>,<span style="color: #ff0000;">"Tot p q.tà"</span>,<span style="color: #ff0000;">"Dal"</span>,<span style="color: #ff0000;">"al"</span>,<span style="color: #ff0000;">"Giorni"</span>,<span style="color: #ff0000;">"Sconto"</span>,<span style="color: #ff0000;">"Totale"</span> ;<br /> COLSIZES <span style="color: #000000;">30</span>, <span style="color: #000000;">30</span>,<span style="color: #000000;">100</span>,<span style="color: #000000;">50</span>,<span style="color: #000000;">90</span>,<span style="color: #000000;">90</span>,<span style="color: #000000;">80</span>,<span style="color: #000000;">80</span>,<span style="color: #000000;">60</span>,<span style="color: #000000;">90</span>,<span style="color: #000000;">90</span> ;<br /> PICTURES <span style="color: #00C800;">nil</span>, <span style="color: #00C800;">nil</span>,<span style="color: #ff0000;">"@!"</span>,<span style="color: #ff0000;">"9999"</span>,<span style="color: #ff0000;">"999,999,999"</span>,<span style="color: #ff0000;">"999,999,999"</span>, <span style="color: #ff0000;">"dd-mmmm-yyyy"</span>,<span style="color: #ff0000;">"dd-mmmm-yyyy"</span>,<span style="color: #ff0000;">"999"</span>,<span style="color: #ff0000;">"999,99"</span>,<span style="color: #ff0000;">"999,999,999"</span>;<br /> ARRAY aItems ;<br /> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>,<span style="color: #000000;">82</span> <span style="color: #0000ff;">PIXEL</span> NOBORDER<br /><br /> ADD COLUMN <span style="color: #0000ff;">TO</span> <span style="color: #0000ff;">XBROWSE</span> oBrowse<br /><br /> bCalcRow := <span style="color: #000000;">{</span> || <span style="color: #000000;">(</span>oBrowse:<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;">VarPut</span><span style="color: #000000;">(</span> oBrowse:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">4</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">Value</span> * oBrowse:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">5</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">Value</span> <span style="color: #000000;">)</span>,;<br /> oBrowse:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">11</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">VarPut</span><span style="color: #000000;">(</span><span style="color: #000000;">(</span> oBrowse:<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;">value</span> * oBrowse:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">9</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">value</span><span style="color: #000000;">)</span>-oBrowse:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">10</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">value</span><span style="color: #000000;">)</span>,;<br /> CalcoloTotali<span style="color: #000000;">(</span>oBrowse,aGet<span style="color: #000000;">)</span> <span style="color: #000000;">)</span><span style="color: #000000;">}</span><br /><br /><br /> WITH OBJECT oBrowse<br /> :<span style="color: #000000;">nRowHeight</span> := <span style="color: #000000;">30</span><br /><br /> WITH OBJECT oBrowse:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span><span style="color: #000000;">]</span><br /> :<span style="color: #000000;">bFooter</span> := <span style="color: #000000;">{</span> || Ltrim<span style="color: #000000;">(</span> Str<span style="color: #000000;">(</span> oBrowse:<span style="color: #000000;">KeyNo</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">" / "</span> + LTrim<span style="color: #000000;">(</span> Str<span style="color: #000000;">(</span> oBrowse:<span style="color: #000000;">KeyCount</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>+<span style="color: #ff0000;">" servizi"</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">lBmpStretch</span> := .F.<br /> :<span style="color: #000000;">lBmpTransparent</span> := .T.<br /> :<span style="color: #000000;">nwidth</span> := <span style="color: #000000;">30</span><br /> :<span style="color: #000000;">bStrImage</span> := <span style="color: #000000;">{</span>|| oBrowse:<span style="color: #000000;">aArrayData</span><span style="color: #000000;">[</span> oBrowse:<span style="color: #000000;">narrayat</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> <span style="color: #000000;">}</span><br /><br /> END<br /><br /> WITH OBJECT oBrowse:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">2</span><span style="color: #000000;">]</span><br /> :<span style="color: #000000;">AddBitmap</span><span style="color: #000000;">(</span><span style="color: #000000;">{</span><span style="color: #ff0000;">"INVOICE_ELEMENTO"</span>,;<br /> <span style="color: #ff0000;">"INVOICE_SERVIZIO"</span>,;<br /> <span style="color: #ff0000;">"INVOICE_PACCHETTO"</span>,;<br /> <span style="color: #ff0000;">"INVOICE_LISTINO"</span><span style="color: #000000;">}</span><span style="color: #000000;">)</span><br /><br /> :<span style="color: #000000;">lBtnTransparent</span> := .t.<br /> :<span style="color: #000000;">bStrImage</span> := <span style="color: #000000;">{</span>|| GiveType<span style="color: #000000;">(</span>alltrim<span style="color: #000000;">(</span>oBrowse:<span style="color: #000000;">aArrayData</span><span style="color: #000000;">[</span> oBrowse:<span style="color: #000000;">narrayat</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">4</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> END<br /><br /><br /><br /> WITH OBJECT oBrowse:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">4</span><span style="color: #000000;">]</span><br /> :<span style="color: #000000;">nWidth</span> := <span style="color: #000000;">100</span><br /> :<span style="color: #000000;">nDataStrAlign</span> := AL_CENTER<br /> :<span style="color: #000000;">AddBitmap</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> FW_BmpPlus<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, FW_BmpMinus<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">// Right Button</span><br /> :<span style="color: #000000;">nEditType</span> := EDIT_BUTTON<br /> :<span style="color: #000000;">bEditBlock</span> := <span style="color: #000000;">{</span> |r,c,oCol| oCol:<span style="color: #000000;">Value</span> + <span style="color: #000000;">1</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">nBtnBmp</span> := <span style="color: #000000;">1</span><br /> :<span style="color: #000000;">lBtnTransparent</span> := .t.<br /><br /> <span style="color: #B900B9;">// Left Button</span><br /> :<span style="color: #000000;">bBmpData</span> := <span style="color: #000000;">{</span> |v,lSel| <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> lSel, <span style="color: #000000;">2</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">bBmpAction</span> := <span style="color: #000000;">{</span> |oCol| IIF<span style="color: #000000;">(</span> oCol:<span style="color: #000000;">Value</span>><span style="color: #000000;">0</span>,oCol:<span style="color: #000000;">VarPut</span><span style="color: #000000;">(</span> oCol:<span style="color: #000000;">Value</span> - <span style="color: #000000;">1</span> <span style="color: #000000;">)</span>,<span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">bOnChange</span> := bCalcRow<br /><br /> END<br /><br /><br /> <span style="color: #B900B9;">// colona per totale x qut riga</span><br /> WITH OBJECT oBrowse:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">6</span><span style="color: #000000;">]</span><br /> :<span style="color: #000000;">nFooterType</span> := AGGR_SUM<br /> :<span style="color: #000000;">cEditPicture</span> := <span style="color: #ff0000;">'@ €99,999.99'</span><br /> END<br /><br /><br /><br /><br /> WITH OBJECT oBrowse:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">7</span><span style="color: #000000;">]</span><br /> :<span style="color: #000000;">nEditType</span> := EDIT_BUTTON<br /> :<span style="color: #000000;">AddBitmap</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"c:<span style="color: #000000;">\w</span>ork<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\c</span>alendar.bmp"</span> <span style="color: #000000;">)</span><br /> :<span style="color: #000000;">nBtnBmp</span> := <span style="color: #000000;">1</span><br /> :<span style="color: #000000;">bEditBlock</span> := <span style="color: #000000;">{</span> |r,c,o,k| XbrGetDate<span style="color: #000000;">(</span> o <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> END<br /><br /> WITH OBJECT oBrowse:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">8</span><span style="color: #000000;">]</span><br /> :<span style="color: #000000;">nEditType</span> := EDIT_BUTTON<br /> :<span style="color: #000000;">AddBitmap</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"c:<span style="color: #000000;">\w</span>ork<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\c</span>alendar.bmp"</span> <span style="color: #000000;">)</span><br /> :<span style="color: #000000;">nBtnBmp</span> := <span style="color: #000000;">1</span><br /> :<span style="color: #000000;">bEditBlock</span> := <span style="color: #000000;">{</span> |r,c,o,k| XbrGetDate<span style="color: #000000;">(</span> o <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> END<br /> WITH OBJECT oBrowse:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">10</span><span style="color: #000000;">]</span><br /> :<span style="color: #000000;">nEditType</span> := EDIT_GET<br /> :<span style="color: #000000;">bOnChange</span> := bCalcRow<br /> END<br /><br /><br /> <span style="color: #B900B9;">// colona per totale riga</span><br /> WITH OBJECT oBrowse:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">11</span><span style="color: #000000;">]</span><br /> :<span style="color: #000000;">nFooterType</span> := AGGR_SUM<br /> :<span style="color: #000000;">cEditPicture</span> := <span style="color: #ff0000;">'@ €99,999.99'</span><br /> END<br /><br /> WITH OBJECT oBrowse:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">12</span><span style="color: #000000;">]</span><br /> :<span style="color: #000000;">AddBitmap</span><span style="color: #000000;">(</span><span style="color: #000000;">{</span><span style="color: #ff0000;">"INVOICE_CANCELLA"</span>,<span style="color: #ff0000;">"INVOICE_INCOLLA"</span><span style="color: #000000;">}</span><span style="color: #000000;">)</span><br /> :<span style="color: #000000;">nBtnBmp</span> := <span style="color: #000000;">1</span><br /> :<span style="color: #000000;">lBmpStretch</span> := .F.<br /> :<span style="color: #000000;">lBmpTransparent</span> := .T.<br /> :<span style="color: #000000;">nwidth</span> := <span style="color: #000000;">30</span><br /> :<span style="color: #000000;">nEditType</span> := EDIT_BUTTON<br /> :<span style="color: #000000;">bEditBlock</span> := <span style="color: #000000;">{</span> ||DeleteRow<span style="color: #000000;">(</span>oBrowse,aGet<span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">nHeadBmpNo</span> := <span style="color: #000000;">2</span><br /> :<span style="color: #000000;">cHeader</span> := <span style="color: #ff0000;">""</span><br /> :<span style="color: #000000;">bLClickHeader</span> := <span style="color: #000000;">{</span> ||DeleteAllRows<span style="color: #000000;">(</span>oBrowse,aGet<span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> END<br /><br /><br /> :<span style="color: #000000;">lHscroll</span> := .F.<br /> :<span style="color: #000000;">l2007</span> := .F.<br /> :<span style="color: #000000;">l2015</span> := .T.<br /> :<span style="color: #000000;">nStretchCol</span> := STRETCHCOL_WIDEST<br /> :<span style="color: #000000;">nColDividerStyle</span> := LINESTYLE_LIGHTGRAY<br /> :<span style="color: #000000;">lAllowRowSizing</span> := .F.<br /> :<span style="color: #000000;">lAllowColSwapping</span> := .F.<br /> :<span style="color: #000000;">lAllowColHiding</span> := .F.<br /> :<span style="color: #000000;">nMarqueeStyle</span> := MARQSTYLE_HIGHLROWMS<br /> :<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> END<br /><br /><br /><br /> </div>[/code:s9qgni08] |
xbrowse -get date - resolved | to inser on a column a calenda I made
WITH OBJECT oBrowse:aCols[ 7]
:AddBitmap( "INVOICE_CALENDARIO")
:nBtnBmp := 1
:lBtnTransparent := .t.
* :lBmpStretch := .f.
:nwidth := 120
:nDataStrAlign := AL_CENTER
:nHeadStrAlign := AL_CENTER
:nDataStrAlign := oBrowse:aCols[ 7]:DefStyle(AL_LEFT,.f.)
:nEditType := EDIT_BUTTON
:bEditBlock := { |r,c,o,k|(XbrGetDate( o,"Seleziona una data",,1 ),oBrowse:refresh()) }
END
But it make error , how I can resolve please ? |
xbrowse -get date - resolved | [code=fw:1x0bm1gc]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br />REQUEST DBFCDX<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, oFont, oBrw<br /><br /> USE CUSTOMER SHARED<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;">-14</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;">800</span>,<span style="color: #000000;">600</span> <span style="color: #0000ff;">PIXEL</span> TRUEPIXEL <span style="color: #0000ff;">FONT</span> oFont<br /><br /> @ <span style="color: #000000;">20</span>,<span style="color: #000000;">20</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">-20</span>,<span style="color: #000000;">-20</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> DATASOURCE <span style="color: #ff0000;">"CUSTOMER"</span> ;<br /> COLUMNS <span style="color: #ff0000;">"FIRST"</span>,<span style="color: #ff0000;">"CITY"</span>,<span style="color: #ff0000;">"HIREDATE"</span>,<span style="color: #ff0000;">"AGE"</span>, <span style="color: #ff0000;">"SALARY"</span> ;<br /> PICTURES <span style="color: #00C800;">nil</span>, <span style="color: #00C800;">nil</span>, <span style="color: #ff0000;">"dd-mmmm-yyyy"</span> ;<br /> CELL LINES NOBORDER<br /><br /> WITH OBJECT oBrw<br /> :<span style="color: #000000;">nEditTypes</span> := EDIT_GET<br /> WITH OBJECT :<span style="color: #000000;">HireDate</span><br /> :<span style="color: #000000;">nEditType</span> := EDIT_BUTTON<br /> :<span style="color: #000000;">AddBitmap</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"c:<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\c</span>alendar.bmp"</span> <span style="color: #000000;">)</span><br /> :<span style="color: #000000;">nBtnBmp</span> := <span style="color: #000000;">1</span><br /> :<span style="color: #000000;">bEditBlock</span> := <span style="color: #000000;">{</span> |r,c,o,k| XbrGetDate<span style="color: #000000;">(</span> o <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> END<br /> <span style="color: #B900B9;">//</span><br /> :<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> END<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;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> </div>[/code:1x0bm1gc]
[url=https://imageshack.com/i/poe7tDlnp:1x0bm1gc][img:1x0bm1gc]https://imagizer.imageshack.com/v2/xq90/924/e7tDln.png[/img:1x0bm1gc][/url:1x0bm1gc] |
xbrowse -get date - resolved | Sorry, now t it run ok , there was also the oldest datepick compiled!!!!
only i have no transparent bitmap also tried with pngs |
xbrowse / ADS failure | In another thread, we identified there is still a continuing problem with xBrowse and ADS.
When we open a browse and the dbf does not have an index opened, when going towards the end of the file, the pointer has an error. We have shown this consistently and it has also been previously reported by at least one other person. If an index is open, the error does not occur.
The previous threads on this topic were specific and the error was noted, but no fix has yet taken place.
The specific build uses FWH 15.09 xBrowse, Harbour, MSVC 2013, and ADS Server mode.
Can we please go back and get this resolved correctly ? Thank you. Although the temporary work around is to set the index before browsing the file, often we want to go to the last records added and natural order ( no index ) is the fastest way. |
xbrowse / ADS failure | All these navigation problems xbrowse already decided to put runs on TADs class, The Linear Sr could study and add in xBrowse class.
In xbrowse.prg method SetRdd() change:
[code=fw:34hlbck6]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> <span style="color: #00C800;">If</span> <span style="color: #000000;">(</span> <span style="color: #ff0000;">"ADS"</span>$<span style="color: #000000;">(</span> ::<span style="color: #000000;">cAlias</span> <span style="color: #000000;">)</span>-><span style="color: #000000;">(</span> RddName<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> .or. <span style="color: #ff0000;">'ADT'</span> $ <span style="color: #000000;">(</span> ::<span style="color: #000000;">cAlias</span> <span style="color: #000000;">)</span>-><span style="color: #000000;">(</span> RddName<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">//.and. ;</span><br /> <span style="color: #B900B9;">//( ::cAlias )->( LastRec() ) > 200</span><br /><br /> <span style="color: #B900B9;">// Modified in FWH 9.06</span><br /> <span style="color: #B900B9;">// AdsGetRelKeyPos() returns approximate position as % and when multipilied by 100 and rounded off</span><br /> <span style="color: #B900B9;">// returns incorrect values occassionally on smaller tables. OrdKeyNo() mapped to AdsKeyNo() gives reliable</span><br /> <span style="color: #B900B9;">// result in such cases. For large tables OrdKeyNo() is unacceptably slow. Limit of 200 is chosen because</span><br /> <span style="color: #B900B9;">// 0.5% is 1/200.</span><br /><br /> cAdsKeyNo := <span style="color: #ff0000;">"{| n, Self | iif( n == nil, "</span> +;<br /> <span style="color: #ff0000;">"nCalcRelPos( "</span> + cAlias + <span style="color: #ff0000;">"->( ADSGetRelKeyPos() ) * Self:nLen, Self ), "</span>+;<br /> cAlias + <span style="color: #ff0000;">"->( ADSSetRelKeyPos( n / Self:nLen ) ) ) }"</span><br /><br /> cAdsKeyCount := <span style="color: #ff0000;">"{|| "</span> + cAlias + <span style="color: #ff0000;">"->( ADSKeyCount(,,1) )}"</span> <br /><br /> <span style="color: #00C800;">DEFAULT</span> ::<span style="color: #000000;">bKeyNo</span> := &cAdsKeyNo ,;<br /> ::<span style="color: #000000;">bKeyCount</span> := &cAdsKeyCount<br /><br /> </div>[/code:34hlbck6]
Function nCalcRalPos()
[code=fw:34hlbck6]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> nCalcRelPos<span style="color: #000000;">(</span>f_nVal,f_oXBrw<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Local</span> nLenRegs := f_oXBrw:<span style="color: #000000;">nLen</span>, nRowPos := f_oXBrw:<span style="color: #000000;">nRowSel</span><br /> <span style="color: #00C800;">Local</span> nRetorno := <span style="color: #000000;">0</span><br /> <br /> nRetorno := <span style="color: #0000ff;">Round</span><span style="color: #000000;">(</span>f_nVal,<span style="color: #000000;">3</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">If</span> nRetorno == <span style="color: #000000;">0</span><br /> nRetorno := <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">EndIf</span><br /><br /> <span style="color: #00C800;">If</span> nRetorno < nRowPos<br /> nRetorno := nRowPos<br /> <span style="color: #00C800;">EndIf</span> <br /><br /> nRetorno := Int<span style="color: #000000;">(</span>nRetorno<span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> nRetorno<br /> </div>[/code:34hlbck6]
When I use the TADS class I use the tCtrlxBrw class ()
here is the class, most only works with TADS ().
Class tCtrlxbrw:
[code=fw:34hlbck6]<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;">"xBrowse.ch"</span><br /><br /><span style="color: #00D7D7;">#Define</span> df_BaseMySql <span style="color: #000000;">1</span><br /><br /><span style="color: #00C800;">Class</span> tCtrlxBrw <br /><br /> <span style="color: #00C800;">Data</span> oXBrwCtrl, oDbDs_DataBaseAds<br /> <span style="color: #00C800;">Data</span> bStrData<br /> <span style="color: #00C800;">Data</span> oGetDsFilter, nTpCampoFilter, cCampoFilter, lLastRecZero<br /> <span style="color: #00C800;">Data</span> bChangeBrw<br /> <br /> <span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span>f_oXBrowse,f_oDbDs_DataBaseAds<span style="color: #000000;">)</span> Constructor<br /> <span style="color: #00C800;">Method</span> End<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">Method</span> SetTAds<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">Method</span> tCtrlxBrw_Skip<span style="color: #000000;">(</span>f_nKip<span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">Method</span> tCtrlxBrw_Seek<span style="color: #000000;">(</span>f_oBjCol,f_uVar<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Method</span> tCtrlxBrw_EditFilterRdd<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Method</span> tCtrlxBrw_EditFilterSql<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Method</span> tCtrlxBrw_EditChange<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Method</span> tCtrlxBrw_EditClearChar<span style="color: #000000;">(</span>f_cTxt, f_nTipo<span style="color: #000000;">)</span><br /><br /><br /><span style="color: #00C800;">Endclass</span><br /><span style="color: #B900B9;">//-----------------------------------------------------------------------------</span><br /><span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span>f_oXBrowse,f_oDbDs_DataBaseAds,f_aGetFilter<span style="color: #000000;">)</span> <span style="color: #00C800;">Class</span> tCtrlxBrw<br /> <span style="color: #00C800;">Local</span> oSelf<br /><br /> <span style="color: #B900B9;">// f_aGetFilter[1] > oBjeto Get</span><br /> <span style="color: #B900B9;">// f_aGetFilter[2] > Tipo Filtro 1=SetAof contains / 2=Sql select Contains</span><br /> <span style="color: #B900B9;">// f_aGetFilter[3] > Nome do campo a pesquisar</span><br /> <br /> <span style="color: #B900B9;">///Override Method Skip In Class Txbrowse With oSelf:tCtrlxBrw_Skip</span><br /><br /> ::<span style="color: #000000;">lLastRecZero</span> := .F.<br /><br /> ::<span style="color: #000000;">oDbDs_DataBaseAds</span> := f_oDbDs_DataBaseAds<br /> ::<span style="color: #000000;">oXBrwCtrl</span> := f_oXBrowse<br /> <br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">cAlias</span> := ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">cAlias</span><br /> <br /> <span style="color: #00C800;">If</span> !Hb_IsNil<span style="color: #000000;">(</span>f_aGetFilter<span style="color: #000000;">)</span><br /><br /> ::<span style="color: #000000;">oGetDsFilter</span> := f_aGetFilter<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span><br /> ::<span style="color: #000000;">nTpCampoFilter</span> := f_aGetFilter<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><br /> ::<span style="color: #000000;">cCampoFilter</span> := f_aGetFilter<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span><br /> <br /> <span style="color: #00C800;">If</span> f_aGetFilter<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> == <span style="color: #000000;">2</span> <span style="color: #B900B9;">// Sql Contains</span><br /> ::<span style="color: #000000;">oGetDsFilter</span>:<span style="color: #000000;">bChange</span> := <span style="color: #000000;">{</span>||::<span style="color: #000000;">tCtrlxBrw_EditFilterSql</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><br /> <br /> ElseIf f_aGetFilter<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> == <span style="color: #000000;">1</span> <span style="color: #B900B9;">// Rdd set aof</span><br /><br /> ::<span style="color: #000000;">oGetDsFilter</span>:<span style="color: #000000;">bChange</span> := <span style="color: #000000;">{</span>||::<span style="color: #000000;">tCtrlxBrw_EditFilterRdd</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><br /> <br /> <span style="color: #00C800;">EndIf</span><br /><br /> ::<span style="color: #000000;">bChangeBrw</span> := ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">bChange</span><br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">bChange</span> := <span style="color: #000000;">{</span>||::<span style="color: #000000;">tCtrlxBrw_EditChange</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">bGotFocus</span> := <span style="color: #000000;">{</span>||::<span style="color: #000000;">tCtrlxBrw_EditChange</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><br /> <br /> <span style="color: #00C800;">EndIf</span> <br /><br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">bClrSel</span> := <span style="color: #000000;">{</span>|| <span style="color: #000000;">{</span> CLR_BLACK, CLR_HGRAY<span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <span style="color: #B900B9;">// Giovany</span><br /> ::<span style="color: #000000;">SetTAds</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">Self</span><br /><span style="color: #B900B9;">//-----------------------------------------------------------------------------</span><br /><span style="color: #00C800;">Method</span> End<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">Class</span> tCtrlxBrw<br /><br /><span style="color: #00C800;">Self</span> := <span style="color: #00C800;">Nil</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">Nil</span><br /><span style="color: #B900B9;">//-----------------------------------------------------------------------------</span><br /><span style="color: #00C800;">Method</span> SetTAds<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">Class</span> tCtrlxBrw<br /> <span style="color: #00C800;">Local</span> nTpGetRelPos := <span style="color: #000000;">1</span>, cTmpQry := <span style="color: #ff0000;">""</span>, nTmp := <span style="color: #000000;">0</span><br /><br /> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">lBufferOnSkip</span> := .T.<br /> <br /> <span style="color: #00C800;">If</span> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">nOpenType</span> == <span style="color: #000000;">3</span> <span style="color: #B900B9;">// Open via Dataset</span><br /> cTmpQry := Upper<span style="color: #000000;">(</span>::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">cQrySql</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">If</span> <span style="color: #00C800;">At</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"{STATIC}"</span>,cTmpQry<span style="color: #000000;">)</span> == <span style="color: #000000;">0</span> <br /> nTpGetRelPos := <span style="color: #000000;">2</span><br /> <span style="color: #00C800;">Else</span><br /> nTpGetRelPos := <span style="color: #000000;">1</span> <br /> <span style="color: #00C800;">EndIf</span><br /> <span style="color: #00C800;">Else</span><br /> nTpGetRelPos := <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">EndIf</span><br /><br /> <span style="color: #00C800;">If</span> nTpGetRelPos == <span style="color: #000000;">2</span> <span style="color: #B900B9;">// Open via Sql Dataset cursor vivo </span><br /><br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">bKeyNo</span> := <span style="color: #000000;">{</span>| n, _Self | <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> n == <span style="color: #00C800;">nil</span>, ;<br /> nCalcRelPos<span style="color: #000000;">(</span><span style="color: #000000;">(</span>::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">GetRelKeyPos</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> * _Self:<span style="color: #000000;">nLen</span><span style="color: #000000;">)</span> /<span style="color: #000000;">10</span>,::<span style="color: #000000;">oXBrwCtrl</span><span style="color: #000000;">)</span> , ;<br /> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">SetRelKeyPos</span><span style="color: #000000;">(</span> <span style="color: #0000ff;">Round</span><span style="color: #000000;">(</span>n / _Self:<span style="color: #000000;">nLen</span>,<span style="color: #000000;">3</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">Else</span> <span style="color: #B900B9;">// Viao Rdd ou Static Cursor</span><br /><br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">bKeyNo</span> := <span style="color: #000000;">{</span>| n, _Self | <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> n == <span style="color: #00C800;">nil</span>, ;<br /> nCalcRelPos<span style="color: #000000;">(</span><span style="color: #000000;">(</span>::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">GetRelKeyPos</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> * _Self:<span style="color: #000000;">nLen</span><span style="color: #000000;">)</span>,::<span style="color: #000000;">oXBrwCtrl</span> <span style="color: #000000;">)</span> , ;<br /> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">SetRelKeyPos</span><span style="color: #000000;">(</span> <span style="color: #0000ff;">Round</span><span style="color: #000000;">(</span>n / _Self:<span style="color: #000000;">nLen</span>,<span style="color: #000000;">3</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">EndIf</span><br /><br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">bBookMark</span> := <span style="color: #000000;">{</span>| n | iif<span style="color: #000000;">(</span> n == <span style="color: #00C800;">nil</span>,;<br /> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">Recno</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> , ;<br /> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">GoTo</span><span style="color: #000000;">(</span> n <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /><br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">bKeyCount</span> := <span style="color: #000000;">{</span>|| ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">KeyCount</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">bBof</span> := <span style="color: #000000;">{</span> || ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">Bof</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">bEof</span> := <span style="color: #000000;">{</span> || ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">Eof</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">bSkip</span> := <span style="color: #000000;">{</span> |n| Iif<span style="color: #000000;">(</span> n == <span style="color: #00C800;">Nil</span>, n := <span style="color: #000000;">1</span>, <span style="color: #000000;">)</span>, ::<span style="color: #000000;">tCtrlxBrw_Skip</span><span style="color: #000000;">(</span> n <span style="color: #000000;">)</span><span style="color: #000000;">}</span> <br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">bGoTop</span> := <span style="color: #000000;">{</span> || ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">bGoBottom</span> := <span style="color: #000000;">{</span> || ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">GoBottom</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /><br /> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">OnSkip</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 /><span style="color: #B900B9;">//-----------------------------------------------------------------------------</span><br /><span style="color: #00C800;">Method</span> tCtrlxBrw_Skip<span style="color: #000000;">(</span>f_nSkip<span style="color: #000000;">)</span> <span style="color: #00C800;">Class</span> tCtrlxBrw<br /> <span style="color: #00C800;">Local</span> nSkipper := <span style="color: #000000;">0</span><br /> <br /> <span style="color: #00C800;">Default</span> f_nSkip := <span style="color: #000000;">1</span> <br /><br /> nSkipper := <span style="color: #000000;">(</span>::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">cAlias</span><span style="color: #000000;">)</span>-><span style="color: #000000;">(</span>DbSkipper<span style="color: #000000;">(</span>f_nSkip<span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">OnSkip</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /><span style="color: #00C800;">Return</span> nSkipper <br /><span style="color: #B900B9;">//-----------------------------------------------------------------------------</span><br /><span style="color: #00C800;">Method</span> tCtrlxBrw_Seek<span style="color: #000000;">(</span>f_oBjCol,f_uVar,f_lTpSeek<span style="color: #000000;">)</span> <span style="color: #00C800;">Class</span> tCtrlxBrw<br /><span style="color: #00C800;">LOCAL</span> nRecMarca := ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">Recno</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, cTpData := <span style="color: #ff0000;">""</span><br /><br /> cTpData := VALTYPE<span style="color: #000000;">(</span>f_uVar<span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">IF</span> cTpData == <span style="color: #ff0000;">"N"</span><br /> f_lTpSeek := .F.<br /> ELSEIF cTpData == <span style="color: #ff0000;">"D"</span><br /> f_lTpSeek := .F.<br /> ELSEIF cTpData == <span style="color: #ff0000;">"C"</span><br /> f_lTpSeek := .T.<br /> <span style="color: #00C800;">ENDIF</span><br /> <br /> <span style="color: #B900B9;">//If ::oDbDs_DataBaseAds:nOpenType == 1</span><br /> f_oBjCol:<span style="color: #000000;">SetOrder</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">Seek</span><span style="color: #000000;">(</span>f_uVar,f_oBjCol:<span style="color: #000000;">cSortOrder</span>,f_lTpSeek<span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">//EndIf</span><br /> <br /> <span style="color: #00C800;">IF</span> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">EOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">GoTo</span><span style="color: #000000;">(</span>nRecMarca<span style="color: #000000;">)</span><br /> <br /> MSGSTOP<span style="color: #000000;">(</span><span style="color: #ff0000;">"A ocorrencia solicitada não foi encontrada."</span>,;<br /> <span style="color: #ff0000;">"Procedimento abortado..."</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">ENDIF</span><br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span>.T.<span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">IF</span> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">bChange</span> != <span style="color: #00C800;">nil</span><br /> EVAL<span style="color: #000000;">(</span>::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #000000;">bChange</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 /><span style="color: #B900B9;">//-----------------------------------------------------------------------------</span><br /><span style="color: #00C800;">Method</span> tCtrlxBrw_EditFilterRdd<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">Class</span> tCtrlxBrw<br /> <span style="color: #00C800;">Local</span> cTxtDigitacao := <span style="color: #ff0000;">""</span>, cAof := <span style="color: #ff0000;">""</span><br /><br /> <span style="color: #B900B9;">//::oGetDsFilter:Save()</span><br /> cTxtDigitacao := Alltrim<span style="color: #000000;">(</span>::<span style="color: #000000;">tCtrlxBrw_EditClearChar</span><span style="color: #000000;">(</span>::<span style="color: #000000;">oGetDsFilter</span>:<span style="color: #000000;">cText</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">If</span> Len<span style="color: #000000;">(</span>cTxtDigitacao<span style="color: #000000;">)</span> < <span style="color: #000000;">5</span><br /> cTxtDigitacao := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">Else</span><br /> ::<span style="color: #000000;">lLastRecZero</span> := .F.<br /> <span style="color: #00C800;">EndIf</span><br /> <br /> <span style="color: #00C800;">If</span> ::<span style="color: #000000;">lLastRecZero</span><br /> <span style="color: #00C800;">Return</span> <span style="color: #00C800;">Nil</span><br /> <span style="color: #00C800;">EndIf</span><br /> <span style="color: #B900B9;">///? cTxtDigitacao</span><br /><br /> cAof := <span style="color: #ff0000;">"CONTAINS("</span>+::<span style="color: #000000;">cCampoFilter</span>+<span style="color: #ff0000;">","</span>+cTxtDigitacao+<span style="color: #ff0000;">")"</span><br /><br /> ::<span style="color: #000000;">oGetDsFilter</span>:<span style="color: #000000;">oWnd</span>:<span style="color: #000000;">cTitle</span> := cAof<br /> ::<span style="color: #000000;">oGetDsFilter</span>:<span style="color: #000000;">oWnd</span>:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">///msginfo(cAof)</span><br /> <br /> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">Filter</span><span style="color: #000000;">(</span>cAof<span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span>.T.<span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">If</span> Len<span style="color: #000000;">(</span>cTxtDigitacao<span style="color: #000000;">)</span> < <span style="color: #000000;">5</span><br /> ::<span style="color: #000000;">lLastRecZero</span> := .T.<br /> <span style="color: #00C800;">EndIf</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">Nil</span><br /><span style="color: #B900B9;">//-----------------------------------------------------------------------------</span><br /><span style="color: #00C800;">Method</span> tCtrlxBrw_EditFilterSql<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">Class</span> tCtrlxBrw<br /> <span style="color: #00C800;">Local</span> cTxtDigitacao := <span style="color: #ff0000;">""</span><br /><br /> <span style="color: #B900B9;">//::oGetDsFilter:Save()</span><br /> cTxtDigitacao := Alltrim<span style="color: #000000;">(</span>::<span style="color: #000000;">tCtrlxBrw_EditClearChar</span><span style="color: #000000;">(</span>::<span style="color: #000000;">oGetDsFilter</span>:<span style="color: #000000;">cText</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">If</span> Len<span style="color: #000000;">(</span>cTxtDigitacao<span style="color: #000000;">)</span> < <span style="color: #000000;">5</span><br /> cTxtDigitacao := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">Else</span><br /> ::<span style="color: #000000;">lLastRecZero</span> := .F.<br /> <span style="color: #00C800;">EndIf</span><br /> <br /> <span style="color: #00C800;">If</span> ::<span style="color: #000000;">lLastRecZero</span><br /> <span style="color: #00C800;">Return</span> <span style="color: #00C800;">Nil</span><br /> <span style="color: #00C800;">EndIf</span><br /> <span style="color: #B900B9;">///? cTxtDigitacao</span><br /><br /> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">aVarsSql</span> := <span style="color: #000000;">{</span><span style="color: #000000;">{</span><span style="color: #ff0000;">"_TxtDigitacao_"</span>,cTxtDigitacao<span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"_Campo_"</span>,::<span style="color: #000000;">cCampoFilter</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span><br /> <br /> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">DsExecute</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">oXBrwCtrl</span>:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span>.T.<span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">If</span> Len<span style="color: #000000;">(</span>cTxtDigitacao<span style="color: #000000;">)</span> < <span style="color: #000000;">5</span><br /> ::<span style="color: #000000;">lLastRecZero</span> := .T.<br /> <span style="color: #00C800;">EndIf</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">Nil</span><br /><span style="color: #B900B9;">//-----------------------------------------------------------------------------</span><br /><span style="color: #00C800;">Method</span> tCtrlxBrw_EditChange<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">Class</span> tCtrlxBrw<br /><br /> <span style="color: #00C800;">If</span> ::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">LastRec</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> == <span style="color: #000000;">0</span><br /> <span style="color: #00C800;">Return</span> <span style="color: #00C800;">Nil</span><br /> <span style="color: #00C800;">EndIf</span><br /> <br /> ::<span style="color: #000000;">oGetDsFilter</span>:<span style="color: #000000;">VarPut</span><span style="color: #000000;">(</span>::<span style="color: #000000;">oDbDs_DataBaseAds</span>:<span style="color: #000000;">VarGet</span><span style="color: #000000;">(</span>::<span style="color: #000000;">cCampoFilter</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">oGetDsFilter</span>:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">If</span> !Hb_IsNil<span style="color: #000000;">(</span>::<span style="color: #000000;">bChangeBrw</span><span style="color: #000000;">)</span><br /> Eval<span style="color: #000000;">(</span>::<span style="color: #000000;">bChangeBrw</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 /><span style="color: #00C800;">Method</span> tCtrlxBrw_EditClearChar<span style="color: #000000;">(</span>f_cTxt<span style="color: #000000;">)</span> <span style="color: #00C800;">Class</span> tCtrlxBrw<br /> <span style="color: #00C800;">Local</span> cRetTxt := f_cTxt<br /> <span style="color: #00C800;">Local</span> iFor := <span style="color: #000000;">0</span>, cAnd := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">Local</span> aCharDeletes := <span style="color: #000000;">{</span> chr<span style="color: #000000;">(</span><span style="color: #000000;">34</span><span style="color: #000000;">)</span>,<span style="color: #ff0000;">"-"</span>,<span style="color: #ff0000;">"."</span>,<span style="color: #ff0000;">"+"</span>,<span style="color: #ff0000;">"="</span>,<span style="color: #ff0000;">"&"</span>,<span style="color: #ff0000;">"'"</span>,<span style="color: #ff0000;">"´"</span><span style="color: #000000;">}</span><br /> <span style="color: #00C800;">Local</span> aPalavras := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /> <br /> cRetTxt := _CHAR_CLEAN<span style="color: #000000;">(</span>cRetTxt,<span style="color: #000000;">{</span> <span style="color: #ff0000;">" AND "</span>,;<br /> <span style="color: #ff0000;">" NEAR "</span>,;<br /> <span style="color: #ff0000;">" ANY "</span><span style="color: #000000;">}</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">For</span> iFor := <span style="color: #000000;">1</span> <span style="color: #0000ff;">To</span> Len<span style="color: #000000;">(</span>aCharDeletes<span style="color: #000000;">)</span><br /> cRetTxt := StrTran<span style="color: #000000;">(</span>cRetTxt,aCharDeletes<span style="color: #000000;">[</span>iFor<span style="color: #000000;">]</span>,<span style="color: #ff0000;">" "</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Next</span><br /><br /> aPalavras := Hb_aTokens<span style="color: #000000;">(</span>cRetTxt<span style="color: #000000;">)</span><br /><br /> cRetTxt := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">For</span> iFor := <span style="color: #000000;">1</span> <span style="color: #0000ff;">To</span> Len<span style="color: #000000;">(</span>aPalavras<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">If</span> Len<span style="color: #000000;">(</span>aPalavras<span style="color: #000000;">[</span>iFor<span style="color: #000000;">]</span><span style="color: #000000;">)</span> > <span style="color: #000000;">3</span><br /> cRetTxt += <span style="color: #000000;">(</span>cAnd + Chr<span style="color: #000000;">(</span><span style="color: #000000;">34</span><span style="color: #000000;">)</span>+aPalavras<span style="color: #000000;">[</span>iFor<span style="color: #000000;">]</span><span style="color: #000000;">)</span>+Chr<span style="color: #000000;">(</span><span style="color: #000000;">34</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">//+ " "</span><br /> cAnd := <span style="color: #ff0000;">" and "</span><br /> <span style="color: #00C800;">Endif</span><br /> <span style="color: #00C800;">Next</span><br /><br /><span style="color: #00C800;">Return</span> cRetTxt<br /><span style="color: #B900B9;">///////////////////////////////////////////////////////////////////////////////</span><br /><span style="color: #00C800;">FUNCTION</span> nCalcRelPos<span style="color: #000000;">(</span>f_nVal,f_oXBrw<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Local</span> nLenRegs := f_oXBrw:<span style="color: #000000;">nLen</span>, nRowPos := f_oXBrw:<span style="color: #000000;">nRowSel</span><br /> <span style="color: #00C800;">Local</span> nRetorno := <span style="color: #000000;">0</span><br /> <br /> nRetorno := <span style="color: #0000ff;">Round</span><span style="color: #000000;">(</span>f_nVal,<span style="color: #000000;">3</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">If</span> nRetorno == <span style="color: #000000;">0</span><br /> nRetorno := <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">EndIf</span><br /><br /> <span style="color: #00C800;">If</span> nRetorno < nRowPos<br /> nRetorno := nRowPos<br /> <span style="color: #00C800;">EndIf</span> <br /><br /> nRetorno := Int<span style="color: #000000;">(</span>nRetorno<span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> nRetorno<br /><span style="color: #B900B9;">///////////////////////////////////////////////////////////////////////////////</span><br /><span style="color: #00C800;">FUNCTION</span> _CHAR_CLEAN<span style="color: #000000;">(</span>f_cTxt,f_aCaracteresRetira<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Local</span> cTxtRetorno := f_cTxt, iFor := <span style="color: #000000;">0</span><br /> <br /> <span style="color: #00C800;">For</span> iFor := <span style="color: #000000;">1</span> <span style="color: #0000ff;">To</span> Len<span style="color: #000000;">(</span>f_aCaracteresRetira<span style="color: #000000;">)</span><br /> cTxtRetorno := StrTran<span style="color: #000000;">(</span>cTxtRetorno,f_aCaracteresRetira<span style="color: #000000;">[</span>iFor<span style="color: #000000;">]</span>,<span style="color: #ff0000;">""</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Next</span><br /> <br /><span style="color: #00C800;">RETURN</span> cTxtRetorno<br /><br /> </div>[/code:34hlbck6]
Exemplo com tAds
[code=fw:34hlbck6]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> ::<span style="color: #000000;">oDb_BoletoNucleo</span> := DB_BOLNUCL<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">OpenRdd</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> ::<span style="color: #000000;">oBrw361_Remessas</span> := tXBrowse<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;">oDlgBoletosGeral</span> <span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">cAlias</span> := ::<span style="color: #000000;">oDb_BoletoNucleo</span>:<span style="color: #000000;">cAlias</span><br /> ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">nMarqueeStyle</span> := MARQSTYLE_HIGHLROW<br /> ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">nRowDividerStyle</span> := LINESTYLE_BLACK<br /> ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">nColDividerStyle</span> := LINESTYLE_BLACK<br /> ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">nColSel</span> := <span style="color: #000000;">1</span><br /> ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">l2007</span> := .T.<br /> ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">nRowHeight</span> := <span style="color: #000000;">24</span><br /> ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">nHeaderHeight</span> := <span style="color: #000000;">24</span> <br /> ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">bClrRowFocus</span> := <span style="color: #000000;">{</span>||<span style="color: #000000;">{</span> GetSysColor<span style="color: #000000;">(</span> <span style="color: #000000;">9</span> <span style="color: #000000;">)</span>, GetSysColor<span style="color: #000000;">(</span> <span style="color: #000000;">16</span> <span style="color: #000000;">)</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span><br /> ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">lFooter</span> := .F.<br /><br /> aadd<span style="color: #000000;">(</span>aColunas,<span style="color: #00C800;">Nil</span><span style="color: #000000;">)</span><br /> nColTmp := Len<span style="color: #000000;">(</span>aColunas<span style="color: #000000;">)</span><br /> aColunas<span style="color: #000000;">[</span>nColTmp<span style="color: #000000;">]</span> := ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">AddCol</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> With Object aColunas<span style="color: #000000;">[</span>nColTmp<span style="color: #000000;">]</span><br /> :<span style="color: #000000;">bStrData</span> := <span style="color: #000000;">{</span>||::<span style="color: #000000;">oDb_BoletoNucleo</span>:<span style="color: #000000;">dProcesso</span><span style="color: #000000;">}</span><br /> :<span style="color: #000000;">cHeader</span> := <span style="color: #ff0000;">"Dt. Imp. "</span><br /> :<span style="color: #000000;">nWidth</span> := <span style="color: #000000;">90</span><br /> :<span style="color: #000000;">nDataStrAlign</span> := AL_RIGHT<br /> :<span style="color: #000000;">nHeadStrAlign</span> := AL_RIGHT<br /> :<span style="color: #000000;">cSortOrder</span> := <span style="color: #ff0000;">"dProcesso"</span><br /> :<span style="color: #000000;">nEditType</span> := EDIT_GET<br /> <span style="color: #B900B9;">//:cEditPicture := "!"</span><br /> <span style="color: #B900B9;">//:bEditValue := {||}</span><br /> <span style="color: #B900B9;">//:bEditWhen := {||}</span><br /> <span style="color: #B900B9;">//:bEditValid := {||}</span><br /> <span style="color: #B900B9;">//:aEditListTxt := {}</span><br /> :<span style="color: #000000;">AddResource</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"B16_BRWSEEK"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// Bitmaps</span><br /> :<span style="color: #000000;">AddResource</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"B16_LED_RED_1"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// Bitmaps</span><br /> :<span style="color: #000000;">nHeadBmpNo</span> := <span style="color: #000000;">1</span> <br /> <span style="color: #B900B9;">//:bBmpData := {||}</span><br /> <span style="color: #B900B9;">//:nBtnBmp := 2</span><br /> <span style="color: #B900B9;">//:bEditBlock := {|oSelf|::Fun_Menus(01,oSelf)}</span><br /> :<span style="color: #000000;">bOnPostEdit</span> := <span style="color: #000000;">{</span>|ooBj,vVar,nKey|::<span style="color: #000000;">oCtrl361_Remessas</span>:<span style="color: #000000;">tCtrlxBrw_Seek</span><span style="color: #000000;">(</span>ooBj,vVar<span style="color: #000000;">)</span><span style="color: #000000;">}</span> <span style="color: #B900B9;">// Automatic seek on Presskey</span><br /> <span style="color: #B900B9;">//:cFooter := "Total"</span><br /> <span style="color: #B900B9;">//:bFooter := {||20+20}</span><br /> <span style="color: #B900B9;">//:nFootStrAlign := 1</span><br /> <span style="color: #B900B9;">//:nTotal := 0</span><br /> <span style="color: #B900B9;">//:lTotal := .T.</span><br /> <span style="color: #B900B9;">//:nFootStrAlign := 1 </span><br /> <br /> End With <br /><br /> aadd<span style="color: #000000;">(</span>aColunas,<span style="color: #00C800;">Nil</span><span style="color: #000000;">)</span><br /> nColTmp := Len<span style="color: #000000;">(</span>aColunas<span style="color: #000000;">)</span><br /> aColunas<span style="color: #000000;">[</span>nColTmp<span style="color: #000000;">]</span> := ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">AddCol</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> With Object aColunas<span style="color: #000000;">[</span>nColTmp<span style="color: #000000;">]</span><br /> :<span style="color: #000000;">bStrData</span> := <span style="color: #000000;">{</span>||::<span style="color: #000000;">oDb_BoletoNucleo</span>:<span style="color: #000000;">nOcorrencias</span><span style="color: #000000;">}</span><br /> :<span style="color: #000000;">cHeader</span> := <span style="color: #ff0000;">"Qta "</span><br /> :<span style="color: #000000;">nWidth</span> := <span style="color: #000000;">30</span><br /> :<span style="color: #000000;">nDataStrAlign</span> := AL_RIGHT<br /> :<span style="color: #000000;">nHeadStrAlign</span> := AL_RIGHT<br /> <br /> End With <br /><br /><br /> ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">SetRDD</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">CreateFromResource</span><span style="color: #000000;">(</span><span style="color: #000000;">361</span><span style="color: #000000;">)</span><br /> <br /> aColunas<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span>:<span style="color: #000000;">SetOrder</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">oBrw361_Remessas</span>:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> ::<span style="color: #000000;">oCtrl361_Remessas</span> := tCtrlxBrw<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;">oBrw361_Remessas</span>,::<span style="color: #000000;">oDb_BoletoNucleo</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// Class tCtrlxBrw control xbrowse</span><br /><br /><br /> </div>[/code:34hlbck6] |
xbrowse / ADS failure | I appreciate the alternative, but I really think the most appropriate solution is to get a fix for the bug !
Antonio ? Did you receive a response to your inquiries ?
The problem does not exist with xHarbour ( .com ) builds, or DBFCDX, only ADS with Harbour ... so surely we can get the error fixed. |
xbrowse / ADS failure | Tim,
Could you prepare a small and self contained example without using FWH that reproduces the error ? |
xbrowse / ADS failure | Antonio,
This has been discussed in another thread, and Rao identified the exact lines in the xBrowse code that creates the error.
In addition, others had the exact same result.
He indicated he knew what was causing the error, but then the topic was never resolved.
[quote:19v8hfyt]Thanks for testing. From the result of your tests we understand that OrdKeyGoTo() works with dbfcdx RDD even when there is no index and with ADS RDD it fails. When I made this change in 2009 I am sure it was working and at that time most of my applications were using ADSCDX.
If you are using Harbour we need to check with xHarbour version also.
Surprisingly it appears these functions are working:
AdsGetRelKeyPos
AdsSetRelKeyPos
AdsGetKeyCount
Theoretically, these functions also should depend on the index still they work.
Interestingly there is AdsGetKeyPos() function in ACE but no comparable function to OrdKeyGoTo()
I suggest you please continue with the change we proposed earlier.
I study both xHarbour and Harbour versions of the RDD source and also Advantage documentation and implement a dependable solution.
[/quote:19v8hfyt]
That dependable solution was never provided.
Tim |
xbrowse / ADS failure | We need Rao help on this |
xbrowse / ADS failure | Did you get in touch with him ? |
xbrowse / ADS failure | Mr Tim
I'll get back on this very soon |
xbrowse / ADS failure | Resolved in FWH 15.10
Please see
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=31485&p=184767#p184767">viewtopic.php?f=3&t=31485&p=184767#p184767</a><!-- l --> |
xbrowse / problemas con checkbox | Buenos dias,
Tengo un array con uno de los campos declarados como logico.
a:= { { "","",0, .f.}}
al arrancar el programa me lo muestra bien como lo defino aca:
[code=fw:3ms5212u]<div class="fw" id="{CB}" style="font-family: monospace;"> WITH OBJECT :<span style="color: #000000;">acols</span><span style="color: #000000;">[</span> <span style="color: #000000;">4</span> <span style="color: #000000;">]</span><br /> :<span style="color: #000000;">cHeader</span> := <span style="color: #ff0000;">""</span><br /> :<span style="color: #000000;">oheaderfont</span> := oFont<br /> :<span style="color: #000000;">addresource</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"BMPSI"</span> <span style="color: #000000;">)</span><br /> :<span style="color: #000000;">addresource</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"BMPNO"</span> <span style="color: #000000;">)</span><br /> :<span style="color: #000000;">setcheck</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"ON"</span>, <span style="color: #ff0000;">"OFF"</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> :<span style="color: #000000;">bBmpdata</span> := <span style="color: #000000;">{</span> || <span style="color: #00C800;">IF</span><span style="color: #000000;">(</span> ::<span style="color: #000000;">oBrw</span>:<span style="color: #000000;">aarraydata</span><span style="color: #000000;">[</span> ::<span style="color: #000000;">oBrw</span>:<span style="color: #000000;">nArrayAt</span>, <span style="color: #000000;">4</span> <span style="color: #000000;">]</span>, <span style="color: #000000;">1</span>, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> END WITH</div>[/code:3ms5212u]
[url:3ms5212u]https://drive.google.com/file/d/1OfIntZ176WnO_a6vpqyDPBC7Q_co78TG/view?usp=sharing[/url:3ms5212u]
pero cuando RECARGO el array y hago un refresh del xbrowse me muestra de esta manera (.f. mas el cuadradito del checkbox)
[url:3ms5212u]https://drive.google.com/file/d/1nGVIEgt6BIdNgM_C5nxvRZXInkCazWbd/view?usp=sharing[/url:3ms5212u]
que puede estar pasando? ya verifique y el array contiene un dato logico.
Gracias. |
xbrowse / problemas con checkbox | Hola
Probaste con:
[code=fw:2glc7wm2]<div class="fw" id="{CB}" style="font-family: monospace;">:<span style="color: #000000;">bStrData</span> := <span style="color: #000000;">{</span>|| <span style="color: #ff0000;">""</span> <span style="color: #000000;">}</span></div>[/code:2glc7wm2] |
xbrowse / problemas con checkbox | [quote="MarioG":3lgv6dcp]Hola
Probaste con:
[code=fw:3lgv6dcp]<div class="fw" id="{CB}" style="font-family: monospace;">:<span style="color: #000000;">bStrData</span> := <span style="color: #000000;">{</span>|| <span style="color: #ff0000;">""</span> <span style="color: #000000;">}</span></div>[/code:3lgv6dcp][/quote:3lgv6dcp]
si, pero me muestra un espacio (asi no tenga nada entre " " )
de todas maneras dejo de programar con el xbrowse, pierdo el hilo de las cosas cuando
me topo con estos problemas.
ahora en el xbrowser despues de hacer una lectura:
define query oQry "select * from tbdatos"
al hacer un oQry:refresh() y luego un obrw:refresh()
no veo los cambios hasta que no haga click en alguno de los encabezados... |
xbrowse / problemas con checkbox | Please do not change the array with oBrw:SetArray( aNewArray )
Change the array like this:
[code=fw:ly97cvpq]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oBrw:<span style="color: #000000;">aArrayData</span> := aNewArray<br />oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span> .t. <span style="color: #000000;">)</span><br /> </div>[/code:ly97cvpq] |
xbrowse / problemas con checkbox | hola.
Tampoco me funciono de esa forma. |
xbrowse / problemas con checkbox | Gracias por tu información me ha sido de mucha ayuda |
xbrowse 2010/12 | Hi,
The xbrowse class from 2010/12 refers to a TMySqlQuery WSeekplus method. Where can I find this?
Thanks,
Alex |
xbrowse 2010/12 | I have never used TMySql personally. But I know that XBrowse uses :WSeekPlus method. This is there since many versions of FWH.
I also did not find this method in the TMySql class of either Harbour or xHarbour.
I understand there are different versions of TMySql that are available and original contributor of this method could be using a version having this method.
My personal advice is to override oBrw:bseek by your own codeblock using the methods available in your version of TMySql. |
xbrowse 2010/12 | Hi,
I don't find any tmysql.prg or lib, anyone an idea what or where it is? |
xbrowse 2010/12 | According to my notes:
You can download TMySQL library from <!-- m --><a class="postlink" href="http://wmormar.blogspot.com/">http://wmormar.blogspot.com/</a><!-- m -->
Regards,
James |
xbrowse 2010/12 | Hello
you can find a tmysql inside contrib [x]Harbour folder
Harbour contrib\hbmysql
xHarbour contrib\mysql |
xbrowse : Keydown() | Hello,
In mine aplication , i have :
oBrw:bkeyDown := {||....}
So , i try to trigger an action for nkey 32 or 13
The problem is that in method keydown , this action is executed twice :
[code:17rxjvyv]
METHOD KeyDown( nKey, nFlags ) CLASS TXBrowse
if ::bKeyDown != nil
Eval( ::bKeyDown, nKey, nFlags )
endif
do case
case nKey == VK_UP // and other keys
.......
otherwise
return Super:KeyDown( nKey, nFlags )
endcase
return 0
[/code:17rxjvyv]
Super:Keydown() executes also ::bKeydown
I had to change it
if ::bKeyDown = nil
return Super:KeyDown( nKey, nFlags )
end
Am i missing something ?
Frank |
xbrowse : Keydown() | I am sorry , but i saw :
* Fix: Class TXBrowse Method KeyDown() was evaluating bKeyDown twice. Now it is ok.
How is the method changed ?
Frank |
xbrowse : Keydown() | Frank,
Please remove these three lines:
[code:30szy9kr]
if ::bKeyDown != nil
Eval( ::bKeyDown, nKey, nFlags )
endif
[/code:30szy9kr] |
xbrowse : Order column with color | Hello,Working with xbrowse , i try to give the column with order (ocol:corder is 'A' or 'D') a color to make it more visible.[code:3rrtfjkv]
#include "FiveWin.ch"
#include "xbrowse.ch"
#define CLR_1 nRGB( 190, 215, 190 )
#define CLR_2 nRGB( 230, 230, 230 )
function Main()
local oDlg, oBrw , oCol
DEFINE DIALOG oDlg SIZE 300, 200
@ 0, 0 XBROWSE oBrw OF oDlg ARRAY { { "one","two","three" } , {"aOne","ztwo","bthree"}} AUTOCOLS AUTOSORT
FOR EACH oCol IN oBrw:aCols
oCol:bClrStd := {||{CLR_BLACK, iif( oBrw:nArrayAt % 2 = 0, CLR_1, CLR_2 ) + IIF(oCol:cOrder="A",2000,IIF(oCol:cOrder="D",-1000,0))}}
NEXT
//oBrw:Swapcols(1,2,.T.)
oBrw:CreateFromCode()
oBrw:bKeyDown = { || oDlg:SetText( Str( oBrw:nColSel ) ) }
ACTIVATE DIALOG oDlg CENTER ON INIT ( oDlg:oClient := oBrw, oDlg:Resize() )
return nil
[/code:3rrtfjkv]This works , BUT the code is wrong when tho columns are swapped or when a column is moved (clicking and dragging in the header)What is wrong ? maybe something in the code from fivewin ?Frank |
xbrowse : Order column with color | Hello Frank,To show the active indexed Column, I only changed the Header-color ( also you can show a symbol ),because inside the data, there can be a cell-color change.With this solution, you can change the col-position without problems.If you need a sample, i can make a copy of the application-xbrowse-partbelongs to the color-change.RegardsUwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
xbrowse : Order column with color | [quote="ukoenig":3u3u2iey]Hello Frank,
To show the active indexed Column,
I only changed the Header-color ( also you can show a symbol ),
because inside the data, there can be a cell-color change.
With this solution, you can change the col-position without problems.
If you need a sample, i can make a copy of the application-xbrowse-part
belongs to the color-change.
Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->[/quote:3u3u2iey]UweMy main concern is : why does this code doesn't work , wrong code or wrong code from fivewin ?Maybe you could test to confirm the problem ?Frank |
xbrowse : Order column with color | Hello Frank,I got your source and will check it with a sample of mine.RegardsUwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
xbrowse : Order column with color | Hello Frank, the promised source. Because it is possible to change the Col-position, you have to find the new position with < oBrw:nAt >for the col-painting and action. How it works : You can click on the Data and the Col changes the color. Inside the function : PAINT_COL(oBrw, nPos), You can define any action ( Changing Index ... ) belongs to the column-title. In this sample i moved col 3 to position 2 and changed the color.I hope it helps. [img:2t7kf6t4]http://www.pflegeplus.com/pictures/colmove.jpg[/img:2t7kf6t4][code:2t7kf6t4]
#include "FiveWin.ch"
#include "xbrowse.ch"
#define WID 300
#define HGT 150
REQUEST DBFCDX
function Main()
local oDlg, oBrw , oCol, nFor
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-18
DEFINE DIALOG oDlg SIZE 2*WID,2*HGT PIXEL FONT oFont
aValues := { { "one","two","three" } , {"aOne","ztwo","bthree"} }
oBrw := TXBrowse():new( oDlg )
WITH OBJECT oBrw
:nTop := INT(HGT/2)+5
:nLeft := 10
:nBottom := HGT-10
:nRight := WID-10
:SetArray( aValues, .f. )
END
FOR nFor := 1 to LEN( oBrw:aCols )
// set the basic-color
// -------------------------
oBrw:aCols[nFor]:bClrStd := { || { 0, 16054371 } }
oBrw:aCols[ nFor ]:blDClickData := ;
{|r,c,f,o| ( Msginfo( o:cHeader ), PAINT_COL(oBrw,oBrw:nAt)) }
NEXT
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTER ON INIT ( oDlg:oClient := oBrw, oDlg:Resize() )
RETURN NIL
// ------------------------
FUNCTION PAINT_COL(oBrw, nCol)
LOCAL nFor
FOR nFor := 1 to LEN( oBrw:aCols )
// refresh the basic-color
// --------------------------
oBrw:aCols[nFor]:bClrStd := { || { 0, 16054371 } }
// paint new Col-color
// ----------------------
IF nCol = 1
oBrw:aCols[1]:bClrStd := { || { 16054371,128 } }
// Your action
ENDIF
IF nCol = 2
oBrw:aCols[2]:bClrStd := { || { 16054371,128 } }
// Your action
ENDIF
IF nCol = 3
oBrw:aCols[3]:bClrStd := { || { 16054371,128 } }
// Your action
ENDIF
NEXT
RETURN NIL
[/code:2t7kf6t4]RegardsUwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
xbrowse : Order column with color | Uwe ,Ok , it is an intresting example how to change a column color on clicking on the data. It works also when columns are moved. But mine goal is to give in a array (AUTOSORT , incrimental search) the order column (oCol:cOrder = 'A' or 'D') a color , trying to use :[code:xtnvurcr]
FOR EACH oCol IN oBrw:aCols
oCol:bClrStd := {||{CLR_BLACK, iif( oBrw:nArrayAt % 2 = 0, CLR_1, CLR_2 ) + :
IIF(oCol:cOrder="A",2000,IIF(oCol:cOrder="D",-1000,0))}}
NEXT
[/code:xtnvurcr]I don't understand why this code doesn't work when two columns are swapped (uncomment line oBrw:Swapcols(1,2,.T.) ) or moved (clicking and draging in the header). You will see that a wrong column has the color for ordered column.I will try to test using a function like your paint_Col()Frank |
xbrowse : Order column with color Partialy solved | Hello,Sorry , i did not had the intention to start a new thread , see also the previous one[code:2qo1scdv]
#include "FiveWin.ch"
#include "xbrowse.ch"
#define CLR_1 nRGB( 190, 215, 190 )
#define CLR_2 nRGB( 230, 230, 230 )
function Main()
local oDlg, oBrw , oCol
DEFINE DIALOG oDlg SIZE 300, 200
@ 0, 0 XBROWSE oBrw OF oDlg ARRAY { { "one","two","three" } , {"aOne","ztwo","bthree"}} AUTOCOLS AUTOSORT
oBrw:Swapcols(1,2,.T.)
FOR EACH oCol IN oBrw:aCols
oCol:bClrStd := {||{CLR_BLACK, iif( oBrw:nArrayAt % 2 = 0, CLR_1, CLR_2 ) + ;
IIF(oCol:cOrder="A",2001,IIF(oCol:cOrder="D",-1000,0))}}
NEXT
oBrw:CreateFromCode()
oBrw:bKeyDown = { || oDlg:SetText( Str( oBrw:nColSel ) ) }
ACTIVATE DIALOG oDlg CENTER ON INIT ( oDlg:oClient := oBrw, oDlg:Resize() )
return nil
[/code:2qo1scdv]Note that Swapcol comes before giving oCol:bClrStd his value.IT IS NOT SOLVED WHEN THE USER MOVES COLUMNS (Clicking and dragging on the header).I hope somone can explain why this doesn't work in this case , or in the case oBrw:Swapcols() comes after asigning oCol:bClrStd.Frank |
xbrowse : Order column with color Partialy solved | Hello Frank,I wanted to compile your sample, but there are errors.I couldn't test it ( FWH 8.09 ).[code:3toreypl]
Error occurred at: 11/02/08, 12:42:13
Error description: Error BASE/1084 Argument error: /
Args:
[ 1] = N 82
[ 2] = U
Stack Calls
===========
Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:TXBROWSE(0)
Called from: => TXBROWSE:ROWCOUNT(0)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:REFRESH(0)
Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:SORTARRAYDATA(0)
Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:SETARRAY(0)
Called from: => AEVAL(0)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:SETARRAY(0)
Called from: .\source\classes\XBROWSE.PRG => XBRWSETDATASOURCE(0)
Called from: .\source\classes\XBROWSE.PRG => XBROWSENEW(0)
Called from: .\backgrd.PRG => MAIN(8)
// Line 8
// -------
@ 0, 0 XBROWSE oBrw OF oDlg ARRAY { { "one","two","three" } , {"aOne","ztwo","bthree"}} AUTOCOLS AUTOSORT
[/code:3toreypl]It seems you want to change the col-colors like the screeshot ?[img:3toreypl]http://www.pflegeplus.com/pictures/colmove1.jpg[/img:3toreypl]RegardsUwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
xbrowse : Order column with color Partialy solved | Uwe ,I am using fwh8.10 , and indeed there where changes in the code from xbrowse , as a result from some errors i reported.You can follow up the discussion between me and antonio in the forum , but i suppose only one change must be made in xbrowse , method refresh :if nKeyNo >= ::nLen .and. ::nLen > 1 .AND. ::lCreated ::nRowSel := Min( nKeyNo, ::RowCount() )endifFrank |
xbrowse : Preventing hScrolling | HelloI have a xbrowse , the browse fit the area which is defined in the rc-file (all columns are visible)Navigating with right arrow , and reaching the last column , the browse scrolls horizontal to left , creating a blanco column to the right. The fist column becomes not visibleCan it be prevented ? oBrw:lHscroll is .F. , there is no horizontal scrollbar Frank |
xbrowse : Preventing hScrolling | Demont:Try withoBrw:nFreeze := LastColumnVisibleNumberRegards |
xbrowse : Preventing hScrolling | Frank,Have you tested it with FWH 8.05 ?It should work fine. |
xbrowse : SeekOnArray | Hello,
When in a array autosort is on (incrimental search !) and two colums(search column) are swapped
nAt := Ascan( aData, {|v| Upper( cValToChar( v[ nFor ] ) ) = cSeek } )
must be changed in :
nAt := Ascan( aData, {|v| Upper( cValToChar( v[ aCols[ nFor ]:nCreationOrder ] ) ) = cSeek } )
Frank |
xbrowse : SeekOnArray | Frank,
Fixed. Thanks! <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> |
xbrowse : bchange is executed twice in lButtondown | Hello,I have a problem with wbrose , using bChangeIn this version bChange is executed twice , after linking in i can see that bChange is executed in lButtondown 1) on line 2645if nRowPos > 0 ::Skip( nRowPos - ::nRowSel ) // Eval( ::bSkip, nRowPos - ::nRowSel ) ::nRowSel := nRowPos ::Change( .t. ) <----------- 2645endif2) on line 2669This error was already present in 8.01. Looking in the source i can see the changes i made already (but was forgotten)I introduced a local var # ifdef FRANKDEMONT local lChangExecuted := .F. # endifWhich is changed when bChange is executed (line 2646)The ::change(.T.) on line 2669 is only executed when lChangeExecuted is .F.Maybe there is a better solution ???? |
xbrowse : bchange is executed twice in lButtondown | Frank,It is simpler if we remove the call to ::Change( .t. ) from line 2669 as it is already called from line 2645.Thanks for your feedback! <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> |
xbrowse : bchange is executed twice in lButtondown | [quote="Antonio Linares":1y470i5x]Frank,
It is simpler if we remove the call to ::Change( .t. ) from line 2669 as it is already called from line 2645.
Thanks for your feedback! <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->[/quote:1y470i5x]What if NOT nRowpos > 0 ? Change() would not be executed !Frank |
xbrowse : bchange is executed twice in lButtondown | Will this be okay?[code:11p83k6k]
if nRowPos > 0 .and. nRowPos != ::nRowSel
::Skip( nRowPos - ::nRowSel )
::nRowSel := nRowPos
if nColPos > 0
::nColSel := nColPos
endif
::Change( .t. )
else
if nColPos > 0 .and. nColPos != ::nColSel
::nColSel := nColPos
::Change( .f. )
endif
endif
[/code:11p83k6k]And remove the ::Change( .t. ) at the end ( just before oVSroll present line 2669 ) |
xbrowse : bchange is executed twice in lButtondown | nRowPos is only zero for the header, and the header will not change for skipping records.So IMO it is fine if we simply remove the extra call to ::Change(). Unless I am missing something <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> |
xbrowse : enhancement inline editing | Hello,Using the in line editing possibility's from fw , i see some problems :1) In all mine dialog's i use a self made comboclass (xbrowse , btnget)In xbrowse i have to use the fwh combo class . Only get and listbox are possible NO CHECKBOX ,BTNGET , DTEPICKER , BUTTON .........2) bWhen ???????3) Editing one cell , this must be written in the dbf. So we have one cyclus from rlock / append , dbunlock.This cyclus is designed for : lock one record , edit all the fields and then write , not for one field.3) ESCAPE works only on the current cell , not on the cells edited on the same rowEach from this points can be avoided :1) The columns from the obrowse which should be edited :Define the obj's as all the others from the dialog , checkbox , button , ... is possible . Also VALID , WHEN , FONT , ......Last column : a checkbox or button as OK button (write the data)ON INIT , hide this object's2) oBrw:bKeydown and oBrw:lDoubleClick are set to activate this objects , and to deasactivate all the othersThe column objects are moved and resized as needed3) Activating the OK button (or checkbox) write the data in the browse and dbf . Pressing escape before this button cancel the operation.The column objects are hidden , others enabledMaybe the code must be better designed , but i have a working example.Works also when columns are scrolled , or when columns are changed.Can be send on demand , or when someone is intrested , published here (only 400 lines off code + rc.file and some bmp-file (from fw directory) ).Frank |
xbrowse : enhancement inline editing | Frank,Will you be so kind to publish your code here ? many thanksAlso a download url for a working EXE would be of a great help. Thanks! |
xbrowse : enhancement inline editing | XBROWSE : INLINE EDITING1) For each column which must be edited , add this control to your dialog with the same syntax from the other controls oCol:bOnPostEdit can be set. If not it receives a default value (only browse is updated) Can also be set with SetPostEdit(oBrw,Arrayindex,Fieldindex) In your browse add a column (Logical value , set on .T.) and define a checkbox and ON CHANGE as in EditDbf (line 122) Not tested , but a button should also be possible2) Set oBrw:bPastEof() , oBrw:lDblClick and obrw:bKeydown (see EditDbf.prg , prg-file , line +/- 130)3) On init hide the controls from the browseEditing a row can be interupted with EscapeChanges are only written with the OK checkboxThat is allFrank DemontNotesFastedit mode is only activated when also oCol:nEdittype is setFrom all other data used to edit the column is only bPostEdit used[code:1nyzi7qm]
# include "fivewin.ch"
# include "xbrowse.ch"
# include "Common.ch"
# include "dtpicker.ch"
# define CLR_1 nRGB( 190, 215, 190 )
# define CLR_2 nRGB( 230, 230, 230 )
FUNCTION MAIN(cDbfFile)
***********************
LOCAL aStruct , lTest := .F.
LOCAL i , j
LOCAL aCountry
LOCAL oWnd , oBmp
IF IsNil(cDbfFile)
cDbfFile := "Demo.Dbf"
lTest := .T.
END
IF ! "." IN cDbfFile
cDbfFile += ".dbf"
END
IF ! File(cDbfFile)
aStruct := {{"Name","C",25,0},{"Number","N",10,2},{"Country","C",3,0},{"Maried","L",1,0},{"Date","D",8,0}}
DbCreate(cDbfFile,aStruct)
USE (cDbfFile)
aCountry := {"BE ","NL ","FR "}
j := 1
FOR i := 1 TO 20
APPEND BLANK
REPL FIELD->Name WITH PAD("Name " + LTRIM(STR(i)),25)
REPL FIELD->Number WITH i*1000
REPL FIELD->Country WITH aCountry[j++]
REPL FIELD->Maried WITH ( i%2 == 0 )
REPL FIELD->Date WITH Date() + i
IF j > 3
j := 1
END
NEXT
USE
END
USE (cDbfFile) SHARED
DEFINE WINDOW oWnd TITLE "Edit Dbf" ;
MENU BuildMenu( oWnd ) MDI ;
MENUINFO 3
DEFINE BITMAP oBmp RESOURCE "Background"
SET MESSAGE OF oWnd TO FWVERSION + ", " + FWCOPYRIGHT CENTERED TIME DATE
oWnd:bPainted = { | hDC | BmpTiled( hDC, oWnd, oBmp ) }
ACTIVATE WINDOW oWnd
return nil
//----------------------------------------------------------------------------//
function BuildMenu( oWnd )
local oMenu
MENU oMenu
MENUITEM "Edit Dbf";
ACTION EditDbf( oWnd )
ENDMENU
return oMenu
CLOS ALL
RETURN
********************************************************************************************************************************
PROC EditDbf(oWnd)
**************
LOCAL Arr[0]
LOCAL oDlg , oBrw , oBut
LOCAL aObj[3]
LOCAL i
LOCAL el := {SPACE(25),1000,"BE ", .T. , Date() , .T. }
LOCAL aCountry := {"BE ","NL ","FR "}
LOCAL lNieuw := .F.
ReadDbfData(Arr)
DEFINE DIALOG oDlg RESOURCE "TEST" OF oWnd
oBrw := TXBrowse():New( oDlg )
//oBrw := TXBrowse():New( oWnd )
oBrw:CreateFromResource( 101 )
oBrw:nMarqueeStyle := 3 //Highlight row //MARQSTYLE_HIGHLCELL
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:lHScroll := .F. ////oBrw:lColDividerComplete := .t.
oBrw:bClrStd := {|| {CLR_BLACK, iif( oBrw:nArrayAt() % 2 = 0, CLR_1, CLR_2 ) } }
oBrw:bClrSelFocus := {||{CLR_WHITE, CLR_GREEN}}
oBrw:nArrayAt := 1
oBrw:nRowSel := 1
oBrw:nRowHeight := 25 //oBrw:nRowHeight*1.2
oBrw:lFastEdit := .T.
oBrw:SetArray( Arr )
FOR i := 1 TO LEN(Arr[1])
oBrw:aCols[ i ]:cHeader = Field(i)
IF IsLogical(Arr[1,i])
oBrw:aCols[ i ]:nWidth = 20
MakeBitmapCol(oBrw,i)
END
NEXT
ATAIL(oBrw:aCols):Hide()
IF ! __ObjHasData(oBrw:aCols[1],"OBRWOBJ")
__OBJADDDATA(oBrw:aCols[1],"oBrwObj")
END
__objModMethod(oBrw:aCols[1],"Edit",@ActivateoBrwDlg(oBrw , oDlg))
REDEFINE GET oBrw:aCols[1]:oBrwObj VAR el[1] ID 100 OF oDlg VALID ! EMPTY(el[1])
oBrw:aCols[ 1 ]:nEditType := 1 // Fastedit works only when set!!!
REDEFINE GET oBrw:aCols[2]:oBrwObj VAR el[2] ID 105 OF oDlg PICTURE "9999999.99"
oBrw:aCols[ 2 ]:nWidth = 80
oBrw:aCols[ 2 ]:nEditType := 1 // Fastedit !!!
REDEFINE COMBOBOX oBrw:aCols[3]:oBrwObj VAR el[3] ITEMS aCountry;
ID 110 OF oDlg
REDEFINE CHECKBOX oBrw:aCols[4]:oBrwObj VAR el[4] ID 120 OF oDlg
oBrw:aCols[ 5 ]:nWidth = 100
REDEFINE DTPICKER oBrw:aCols[5]:oBrwObj VAR el[5] ID 130 OF oDlg
oBrw:aCols[ 6 ]:cHeader = "OK"
oBrw:aCols[ 6 ]:nWidth = 38
REDEFINE CHECKBOX oBrw:aCols[6]:oBrwObj VAR el[6] ID 140 OF oDlg;
ON CHANGE {||IIF(oBrw:aCols[6]:oBrwObj:Varget(),SaveoBrwDlg(oBrw,@lNieuw,oDlg,oBut),)}
oBrw:aCols[6]:Hide()
FOR i := 1 TO FCOUNT()
SetPostEdit(oBrw,i,i)
NEXT
OBrw:bPastEof() := {|| IIF( NewoBrwDlg(oBrw , @lNieuw) , (Sysrefresh() , ActivateoBrwDlg(oBrw , oDlg)) , ) }
oBrw:bLDblClick := {||ActivateoBrwDlg(oBrw , oDlg)}
oBrw:bkeyDown := { | nkey |IIF(nkey==13 , ActivateoBrwDlg(oBrw , oDlg) , IIF(nKey==VK_DELETE , WisoBrwDlg(oBrw , @lNieuw) , ) ) }
REDEFINE BUTTON oBut ID 300 OF oDlg ACTION oDlg:End()// WHEN ! lNieuw
ACTIVATE DIALOG oDlg ;
ON INIT ( AEVAL(oBrw:aCols,{|oCol|IIF(IsObJect(oCol:oBrwObj),oCol:oBrwObj:Hide(),) }) );
VALID IIF(GETKEYSTATE(VK_ESCAPE) , ( ActivateDlg(oDlg,oBrw,oBut,@lNieuw) , .F.) , .T. )
RETURN
********************************************************************************************************************************
PROC ReadDbfData(Arr)
*********************
LOCAL b , i
GO TOP
DO WHIL ! EOF()
b := {}
FOR i := 1 TO FCOUNT()
AADD(b,Fieldget(i))
NEXT
AADD(b,.T.)
AADD(b,Recno())
AADD(Arr,b)
SKIP
END
RETURN
********************************************************************************************************************************
PROC SetPostEdit(oBrw,i,j)
**************************
// i : Arrayindex , j : Field Index
oBrw:aCols[i]:bOnPostEdit := {|o | x := o:oBrwObj:Varget() , oBrw:aArrayData[ oBrw:nArrayAt, i ] := x , IIF(IsNil(j),,FieldPut(j,x)) }
RETURN
*****************************************************************************************************
PROC MakeBitmapCol(oBrw,i)
***************************
LOCAL oCol
LOCAL x
oCol := oBrw:aCols[i]
oCol:AddResource("CHECKON")
oCol:AddResource("CHECKOFF")
x := LEN(oCol:aBitMaps)
oCol:bBmpData := {||IIF(IsLogical(oBrw:aArrayData[oBrw:nArrayAt,i]) , IIF(oBrw:aArrayData[oBrw:nArrayAt,i],x-1,x),0)}
oCol:bStrData := {||" "}
RETURN
******************************************************************************************************
FUNC NewoBrwDlg(oBrw , lNieuw )
******************************
LOCAL Arr := {}
LOCAL x
LOCAL i
IF lNieuw
RETURN .F.
END
GO 9999999 // EOF() !
Arr := {}
FOR i := 1 TO FCOUNT()
x := Fieldget(i)
IF ValType(x) = "D"
x := Date()
END
AADD(Arr , x)
NEXT
AADD(Arr,.T.) // Ok checkbox
AADD(Arr,0) // RecNr 0 , record will be appended when the ok checkbox is clicked
AADD(oBrw:aArrayData,Arr)
oBrw:GoBottom()
oBrw:Refresh()
lNieuw := .T.
RETURN .T.
*****************************************************************************
PROC WisoBrwDlg(oBrw , lNieuw)
*********************************
LOCAL Nr := oBrw:NarrayAt
LOCAL RecNr := ATAIL(oBrw:aArrayData[Nr])
DbGoto(RecNr)
IF RLOCK()
DbDelete()
DbUnlock()
aDel(oBrw:aArrayData,Nr,.T.)
oBrw:nArrayAt := MIN(Nr,LEN(oBrw:aArraydata))
oBrw:Refresh()
IF lNieuw
lNieuw := .F.
END
END
RETURN
**********************************************************
PROC SaveoBrwDlg(oBrw , lNieuw , oDlg , oBut)
**********************************************
LOCAL Nr := oBrw:nArrayAt
LOCAL RecNr := ATAIL(oBrw:aArrayData[Nr])
LOCAL oCol , i
LOCAL lOk := .F.
FOR EACH oCol IN oBrw:aCols
IF IsObject(oCol:oBrwObj) .AND. IsBlock(oCol:oBrwObj:bValid) .AND. ! EVAL(oCol:oBrwObj:bValid)
oCol:oBrwObj:SetFocus()
RETURN
END
NEXT
IF lNieuw
IF ! DBAPPEND()
RETURN
END
RecNr := RecNo()
ATAIL(oBrw:aArrayData[Nr]) := RecNr
END
DbGoto(RecNr)
FOR EACH oCol IN oBrw:aCols
IF IsObject(oCol:oBrwObj) .AND. IsBlock(oCol:bOnPostEdit)
i := Hb_EnumIndex()
EVAL(oCol:bOnPostEdit,oCol)
END
NEXT
oBrw:DrawLine(.t.)
DbCommit()
DbGoto(recnr)
lNieuw := .F.
DBUNLOCK()
ActivateDlg(oDlg,oBrw,oBut,.F.,@lNieuw)
oBrw:SetFocus()
RETURN
********************************************************************************************************************************
PROC ActivateoBrwDlg(oBrw,oDlg)
*******************************
LOCAL nRow
LOCAL nCol
lOCAL nWidth
LOCAL nHeight
LOCAL Nr //:= oBrw:nArrayAt
LOCAL nKol //:= oBrw:nColSel
LOCAL x
LOCAL oCol , i , Obj , Gehi
LOCAL RecNr
LOCAL aDisPlay
LOCAL Self := HB_QSelf() , cKey , nKey
IF ! IsNil(Self)
nKey := IIF(IsNumber(oBrw),oBrw,nil)
oBrw := Self:oBrw
oDlg := oBrw:oWnd
IF isnumber(nKey)
cKey := Chr( nKey )
END
END
Nr := oBrw:nArrayAt
nKol := oBrw:nColSel
RecNr := ATAIL(oBrw:aArraydata[Nr])
IF RecNr > 0
DbGoto(RecNr)
IF ! RLOCK()
RETURN
END
END
FOR EACH Obj IN oDlg:aControls
Obj:Disable()
NEXT
nRow := ( ( oBrw:nRowSel - 1 ) * oBrw:nRowHeight ) + oBrw:HeaderHeight() + 2 + oBrw:nTop
nHeight := oBrw:nRowHeight - 4
aDisPlay := oBrw:GetDisplayCols()
FOR EACH oCol IN oBrw:aCols
IF IsObject(oCol:oBrwObj)
i := Hb_EnumIndex()
WITH OBJECT oCol
nCol := :nDisPlayCol + 2 + oBrw:nLeft
nWidth := :nWidth - 4
x := oBrw:aArrayData[Nr,oCol:nCreationOrder]
If oCol:cHeader = "OK"
nCol := oBrw:nWidth + oBrw:nLeft + 2
x := .F.
END
IF __ObjHasMethod(:oBrwObj,"VARPUT") // BUTTON ???
:oBrwObj:Varput(x)
:oBrwObj:Refresh()
END
IF (i IN aDisplay) .OR. oCol:cHeader = "OK"
IF (i IN aDisplay) .AND. i == aDisplay[1] // Selected col (or clicked) is no edit column
Obj := :oBrwObj
Gehi := i
END
:oBrwObj:Enable()
:oBrwObj:Move(nRow, nCol, nWidth, nHeight, .t. )
:oBrwObj:Show()
IF IsNil(:bOnPostEdit)
SetPostEdit(oBrw,i)
END
IF i == nKol // Selected col (or clicked)
Obj := :oBrwObj
Gehi := i
END
END
END
END
NEXT
IF ! IsNil(Obj)
IF IsNumber(Gehi) .AND. IsNumber(nKey)
oCol := oBrw:aCols[Gehi]
If oBrw:lFastEdit .and. oBrw:nMarqueeStyle <= MARQSTYLE_HIGHLCELL .and. ;
oCol:nEditType > 0 .and. ;
( IsAlpha( cKey ) .or. IsDigit( cKey ) .or. cKey == "-" )
IF __ObjHasMethod(oCol:oBrwObj,"VARPUT") // BUTTON ???
x := oBrw:aArrayData[Nr,oCol:nCreationOrder]
IF IsCharacter(x)
oCol:oBrwObj:bGotFocus := {|self|Self:Keychar(cKey) , Self:oGet:Pos := 2 , Self:EditUpdate() , self:Setpos(2),Self:bGotFocus:=nil}
ELSEIF IsNumber(x)
IF (48<=nKey .AND. nKey <= 57) .or. cKey == "-"
oCol:oBrwObj:bGotFocus := {|self|Self:Keychar(cKey) , Self:oGet:Pos := 2 , Self:EditUpdate() , self:Setpos(2),Self:bGotFocus:=nil}
oCol:oBrwObj:lClrFocus := .T.
END
END
oCol:oBrwObj:Refresh()
END
end
END
Obj:Setfocus()
END
RETURN
********************************************************************************************************************************
PROC ActivateDlg(oDlg,oBrw,oBut,lNieuw)
***************************************
LOCAL oCol , i , Obj
LOCAL Nr
LOCAL RecNr
IF oDlg:aControls[1]:lActive // Can give problems when this contol is a oCol:oBrwObj !!!!!!!
oBut:Setfocus()
return
END
FOR EACH Obj IN oDlg:aControls
Obj:Enable()
NEXT
FOR EACH oCol IN oBrw:aCols
IF IsObject(oCol:oBrwObj)
oCol:oBrwObj:Hide()
END
NEXT
Nr := oBrw:nArrayAt
RecNr := ATAIL(oBrw:aArrayData[Nr])
IF RecNr == 0
aDel(oBrw:aArrayData,Nr,.T.)
oBrw:nLen := LEN(oBrw:aArrayData)
oBrw:nArrayAt := MIN(oBrw:nArrayAt,oBrw:nLen)
oBrw:GoBottom()
oBrw:Refresh()
lNieuw := .F.
ELSE
DbGoto(RecNr)
DbUnlock()
END
oBrw:setFocus()
RETURN
**********************************************************************************************
PROC Trace(...) // Only to test
*************
LOCAL i , el
LOCAL tkst := ""
LOCAL arr := HB_aParams() , elem , hlp
FOR EACH el IN arr
IF Valtype(el) == "A"
FOR EACH elem IN el
hlp := cValToChar(elem)
IF IsCharacter(elem) .AND. LEN(elem) == 1 .AND. ASC(elem) < 32
hlp := 'CHR('+LTRIM(STR(Asc(elem))) + ')'
END
tkst += CRLF + hlp
NEXT
ELSEIF ValType(el) == "H"
FOR i := 1 TO LEn(el)
hlp := cValToChar(el[i])
IF IsCharacter(Hlp) .AND. LEN(Hlp) == 1 .AND. ASC(Hlp) < 32
hlp := 'CHR('+LTRIM(STR(Asc(Hlp))) + ')'
END
tkst += CRLF + PAD(HaaGetKeyAt(el,i),10) + " : " + hlp
NEXT
ELSE
tkst += CRLF + cValToChar(el)
END
NEXT
i := 0
DO WHIL ! EMPTY(PROCNAME(i))
tkst += CRLF + PROCNAME(i) + " " + "Lijn : " + LTRIM(STR(PROCLINE(i)))
i++
END
? tkst
RETU
//----------------------------------------------------------------//
STATIC FUNCTION BmpTiled( hDC, oWnd, oBmp )
local nWidth := oWnd:nWidth(), nHeight := oWnd:nHeight()
local nRow := 0, nCol := 0, n
local nBmpWidth := oBmp:nWidth(), nBmpHeight := oBmp:nHeight()
if oBmp:hBitmap == 0
return nil
endif
while nRow < nHeight
nCol = 0
while nCol < nWidth
PalBmpDraw( hDC, nRow, nCol, oBmp:hBitmap )
nCol += nBmpWidth
end
nRow += nBmpHeight
end
return nil
**************************************************************
TEST DIALOG 6, 15, 450, 227
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "TXBrowse demo"
FONT 8, "MS Sans Serif"
{
CONTROL "", 101, "TXBrowse", 0 | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 4, 5, 328 , 202
EDITTEXT 100 , 197 , 2, 20, 10, WS_BORDER | WS_TABSTOP
EDITTEXT 105 , 197 , 2, 20, 10, WS_BORDER | WS_TABSTOP
COMBOBOX 110, 8, 16, 72, 75, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP
CHECKBOX " ", 120 , 230 , 235 , 80, 14, BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP //, 8192
CONTROL "", 130 , "SysDateTimePick32", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP | DTS_SHOWNONE , 153, 108 , 55, 10
CHECKBOX "OK ", 140 , 230 , 235 , 32 , 14, BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP //, 8192
PUSHBUTTON "OK", 300 , 252, 211, 50, 14
}
CHECKON BITMAP "bitmap\Checkon.bmp"
CHECKOFF BITMAP "bitmap\Checkoff.bmp"
BACKGROUND BITMAP "bitmap\fiveback.bmp"
[/code:1nyzi7qm] |
xbrowse : enhancement inline editing | Frank,I think most users expect browses to work like a spreadsheet and there is no concept of having to check a checkbox to get the data updated. Most users are going to be very confused by this.James |
xbrowse : enhancement inline editing | James,For me is a row in a table a record. Editing it in a dialog we Lock the record , or append it Edit all the fields , with all kinds off controls , navigating with TAB or ENTER A ok button accepts the data , inviting the user to check before , writes the data and unlock . Escape should eliminate the changes from the data . You are right when you stated it is not the filosophy from excel, more these from Clipper (editing a record) In mine program editing a row is as editing a dialog . In DOS i was used to do that . The ok checkbox can maybe be discarded (updating after each field , as in oCol:edit from txbrowse) ) , but : LOCK , UNLOCK must for every field. Suppose that two users try to edit the same row . After editing the first field , the second can be blocked ESCAPE : only the editing field Navigating : No TAB or ENTERWhen a row is edited , i am convinced that the user has the intention to edit not only one cell , but also the othersThe greatest benefit is we can use all kinds off control , not only get and listboxFrank |
xbrowse : enhancement inline editing | Frank,>For me is a row in a table a record. Editing it in a dialog we >Lock the record , or append it >Edit all the fields , with all kinds off controls , navigating with TAB or >ENTER >A ok button accepts the data , inviting the user to check before , writes >the data and unlock . Escape should eliminate the changes from the data.Agreed, or, as I usually use, "optimistic" locking; edit, lock, save, unlock. This means the record is only locked for a split second. >You are right when you stated it is not the filosophy from excel, more >these from Clipper (editing a record)We do have to keep the users expectations in mind when designing our programs. >In mine program editing a row is as editing a dialog . In DOS i was used >to do that . The ok checkbox can maybe be discarded (updating after >each field , as in oCol:edit from txbrowse) ) , but : >LOCK , UNLOCK must for every field. Suppose that two users try to edit >the same row . After editing the first field , the second can be blocked >ESCAPE : only the editing field >Navigating : No TAB or ENTER >When a row is edited , i am convinced that the user has the intention to >edit not only one cell , but also the others These are all valid issues, and this is why I do not generally allow users to edit browses directly but rather use a double-click to bring up a dialog. There are other reasons too. A row of data is often too long to display on the screen at one time, but it will all fit on a dialog. Data can be grouped in a dialog and all kinds of controls can be used. Regards,James |
xbrowse : enhancement inline editing | I provided a download link at : <!-- m --><a class="postlink" href="http://rapidshare.com/files/115712013/ROWEDIT.ZIP.html">http://rapidshare.com/files/115712013/ROWEDIT.ZIP.html</a><!-- m -->Frank |
xbrowse : ocol:bEditWhen | Hello,
I try to use oCol:bEditWhen with
oCol:nEditType := EDIT_BUTTON
This works when in the cell to edit (editing not allowed) ENTER is pressed or Double clicked with the mouse
IT IS NOT WORKING WHEN THE CELL BUTTON IS CLICKED !!!!
FWH8.10
I can solve this , by dinamically setting nEditType to 0 or EDIT_BUTTON , but this gives problems with the layout from the cell , the text can be over written with the button
Frank |
xbrowse : ocol:bEditWhen | Frank,
This may help:
[code:s85exv9r]
oBrw:bLClicked := { | nRow, nCol | oBrw:LDblClick( nRow, nCol ) }
[/code:s85exv9r] |
xbrowse : sporadic error | Hello,
In a intensive used aplication i got sporadic (4 errors in 2 years) , at line 396 :
METHOD ColAtPos( nPos ) INLINE ::aCols[ ::aDisplay[ MinMax( If( nPos == nil, 1, nPos ), 1, Len( ::aDisplay ) ) ] ]
With :
#xtranslate MinMax( <xValue>, <nMin>, <nMax> ) => ;
Min( Max( <xValue>, <nMin> ), <nMax> )
The error indicates
Error description: Error BASE/1132 Bound error: array access
Args:
[ 1] = A { ... }
[ 2] = N 0
ColAtPos seems to be called with parameter 1. When Minmax returns 0 , it can only be declared as LEN(::aDisplay) == 0
I can simulate this error with hiding all the columns from the browse . It gives the same error , but the calllist is much longer.
I have no idea how ::aDisplay can become empty , for this browe ocol:hide() is not used at all
I note also that the error occurs always on the same computer ( network from +/- 10 computers) , so could it be a hardware problem ?
Frank |
xbrowse : sporadic error | I do get it very often:
It is not a hardware problem.
It happens randomly when painting xBrowse.
[code=fw:134khs8m]<div class="fw" id="{CB}" style="font-family: monospace;"> Error description: <span style="color: #000000;">Error</span> BASE/<span style="color: #000000;">1132</span> Bound error: <span style="color: #000000;">array</span> access<br /><br /> Args:<br /> <span style="color: #000000;">[</span> <span style="color: #000000;">1</span><span style="color: #000000;">]</span> = A <span style="color: #000000;">{</span> ... <span style="color: #000000;">}</span><br /> <span style="color: #000000;">[</span> <span style="color: #000000;">2</span><span style="color: #000000;">]</span> = N <span style="color: #000000;">0</span><br /><br />Stack Calls<br />===========<br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\<span style="color: #0000ff;">xbrowse</span>.prg => <span style="color: #000000;">(</span>b<span style="color: #000000;">)</span>TXBROWSE<span style="color: #000000;">(</span><span style="color: #000000;">517</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\<span style="color: #0000ff;">xbrowse</span>.prg => TXBROWSE:<span style="color: #000000;">COLATPOS</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\<span style="color: #0000ff;">xbrowse</span>.prg => <span style="color: #000000;">(</span>b<span style="color: #000000;">)</span>TXBROWSE<span style="color: #000000;">(</span><span style="color: #000000;">519</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\<span style="color: #0000ff;">xbrowse</span>.prg => TXBROWSE:<span style="color: #000000;">SELECTEDCOL</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\<span style="color: #0000ff;">xbrowse</span>.prg => TXBROWSE:<span style="color: #0000ff;">PAINT</span><span style="color: #000000;">(</span><span style="color: #000000;">1250</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\<span style="color: #0000ff;">xbrowse</span>.prg => TXBROWSE:<span style="color: #00C800;">DISPLAY</span><span style="color: #000000;">(</span><span style="color: #000000;">1228</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: .\source\classes\CONTROL.PRG => TCONTROL:<span style="color: #000000;">HANDLEEVENT</span><span style="color: #000000;">(</span><span style="color: #000000;">1686</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\<span style="color: #0000ff;">xbrowse</span>.prg => TXBROWSE:<span style="color: #000000;">HANDLEEVENT</span><span style="color: #000000;">(</span><span style="color: #000000;">11511</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: .\source\classes\<span style="color: #0000ff;">WINDOW</span>.PRG => _FWH<span style="color: #000000;">(</span><span style="color: #000000;">3443</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: => DIALOGBOX<span style="color: #000000;">(</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: .\source\classes\<span style="color: #0000ff;">DIALOG</span>.PRG => TDIALOG:<span style="color: #0000ff;">ACTIVATE</span><span style="color: #000000;">(</span><span style="color: #000000;">277</span><span style="color: #000000;">)</span><br /> </div>[/code:134khs8m] |
xbrowse : sporadic error | Demont,
Please try it this way:
METHOD ColAtPos( nPos ) INLINE ::aCols[ ::aDisplay[ MinMax( If( nPos == nil, 1, nPos ), 1, [color=#FF0000:12ngh4rh]Max[/color:12ngh4rh]( Len( ::aDisplay ), 1 ) ) ] ] |
xbrowse : sporadic error | Antonio,
/*
METHOD ColAtPos( nPos ) INLINE ::aCols[ ::aDisplay[ MinMax( If( nPos == nil, 1, nPos ), 1, Max( Len( ::aDisplay ), 1 ) ) ] ]
*/
I don't believe it will solve the problem , the real problem is that for some reason ::aDisplay is empty. With this corection we have ::aDisplay[1] , it should also give a error.
The translate :
#xtranslate MinMax( <xValue>, <nMin>, <nMax> ) => Min( Max( <xValue>, <nMin> ), <nMax> )
doesn't work when for some reason nMax < nMin , the translate gives then nMax ( the lowest value from nmin,nmax)
#xtranslate MinMax( <xValue>, <nMin>, <nMax> ) => Min( Max( <xValue>, MIN(<nMin>,<nMax>) ), MAX(<nMin>,<nMax>) )
Should work ! |
xbrowse : sporadic error | [quote:30orspkk]I don't believe it will solve the problem , the real problem is that for some reason ::aDisplay is empty. [/quote:30orspkk]
Yes.
This is the real reason.
One case was resolved recently. When HScroll bar is moved in a single column browse, this was happening. This was fixed.
We need to see under what other situations ::aDisplay is becoming empty. Any feedback on this is welcome. |
xbrowse : sporadic error | With version 8.10 i got nearly the same callist.
I do not understand this callist . Simulating this error , we got the error when the dialog is build , but the list is longer , the first 7 items :
original error list :
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\xbrowse.prg => (b)TXBROWSE:TXBROWSE(396)
Called from: => TXBROWSE:COLATPOS(0)
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\xbrowse.prg => TXBROWSE:PAINT(996)
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\xbrowse.prg => TXBROWSE:DISPLAY(922)
Called from: .\source\classes\CONTROL.PRG => TXBROWSE:HANDLEEVENT(0)
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\window.prg => _FWH(3308)
[b:j198yctn]Called from: => WINRUN(0)[/b:j198yctn]
Sumulating :
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\xbrowse.prg => (b)TXBROWSE:TXBROWSE(396)
Called from: => TXBROWSE:COLATPOS(0)
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\xbrowse.prg => TXBROWSE:PAINT(996)
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\xbrowse.prg => TXBROWSE:DISPLAY(922)
Called from: .\source\classes\CONTROL.PRG => TXBROWSE:HANDLEEVENT(0)
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\window.prg => _FWH(3308)
[b:j198yctn]Called from: => CREATEDLG(0)[/b:j198yctn]
So the error doesn't occur when the dialog is build , maybe when the dialog becomes focus. In ACTIVATE DIALOG i have NOMODAL
[quote="ukservice":j198yctn]I do get it very often:
It is not a hardware problem.
It happens randomly when painting xBrowse.
[code=fw:j198yctn]<div class="fw" id="{CB}" style="font-family: monospace;"> Error description: <span style="color: #000000;">Error</span> BASE/<span style="color: #000000;">1132</span> Bound error: <span style="color: #000000;">array</span> access<br /><br /> Args:<br /> <span style="color: #000000;">[</span> <span style="color: #000000;">1</span><span style="color: #000000;">]</span> = A <span style="color: #000000;">{</span> ... <span style="color: #000000;">}</span><br /> <span style="color: #000000;">[</span> <span style="color: #000000;">2</span><span style="color: #000000;">]</span> = N <span style="color: #000000;">0</span><br /><br />Stack Calls<br />===========<br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\<span style="color: #0000ff;">xbrowse</span>.prg => <span style="color: #000000;">(</span>b<span style="color: #000000;">)</span>TXBROWSE<span style="color: #000000;">(</span><span style="color: #000000;">517</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\<span style="color: #0000ff;">xbrowse</span>.prg => TXBROWSE:<span style="color: #000000;">COLATPOS</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\<span style="color: #0000ff;">xbrowse</span>.prg => <span style="color: #000000;">(</span>b<span style="color: #000000;">)</span>TXBROWSE<span style="color: #000000;">(</span><span style="color: #000000;">519</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\<span style="color: #0000ff;">xbrowse</span>.prg => TXBROWSE:<span style="color: #000000;">SELECTEDCOL</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\<span style="color: #0000ff;">xbrowse</span>.prg => TXBROWSE:<span style="color: #0000ff;">PAINT</span><span style="color: #000000;">(</span><span style="color: #000000;">1250</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\<span style="color: #0000ff;">xbrowse</span>.prg => TXBROWSE:<span style="color: #00C800;">DISPLAY</span><span style="color: #000000;">(</span><span style="color: #000000;">1228</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: .\source\classes\CONTROL.PRG => TCONTROL:<span style="color: #000000;">HANDLEEVENT</span><span style="color: #000000;">(</span><span style="color: #000000;">1686</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\<span style="color: #0000ff;">xbrowse</span>.prg => TXBROWSE:<span style="color: #000000;">HANDLEEVENT</span><span style="color: #000000;">(</span><span style="color: #000000;">11511</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: .\source\classes\<span style="color: #0000ff;">WINDOW</span>.PRG => _FWH<span style="color: #000000;">(</span><span style="color: #000000;">3443</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: => DIALOGBOX<span style="color: #000000;">(</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: .\source\classes\<span style="color: #0000ff;">DIALOG</span>.PRG => TDIALOG:<span style="color: #0000ff;">ACTIVATE</span><span style="color: #000000;">(</span><span style="color: #000000;">277</span><span style="color: #000000;">)</span><br /> </div>[/code:j198yctn][/quote:j198yctn] |
xbrowse : sporadic error | See also mine previous post.
The program uses obrw:bGotfocus.
oBrw:bGotFocus := { ||TestHid(oBrw,oCol) , .......}
PROC TestHid(oBrw,oCol)
STATIC n := 0
IF n > 0 // prevent error when the dialog is created
FOR EACH oCol IN oBrw:aCols
oCol:Hide()
NEXT
END
n++
RETURN
I got exact the same error list as mine user
Frank
[quote="nageswaragunupudi":1u0q5je1][quote:1u0q5je1]I don't believe it will solve the problem , the real problem is that for some reason ::aDisplay is empty. [/quote:1u0q5je1]
Yes.
This is the real reason.
One case was resolved recently. When HScroll bar is moved in a single column browse, this was happening. This was fixed.
We need to see under what other situations ::aDisplay is becoming empty. Any feedback on this is welcome.[/quote:1u0q5je1] |
xbrowse : sporadic error | #1. You should never hide all columns. Atleast one column should be visible.
#2. When there is only one column in the browse, using horizontal scroll bar was resulting in this error. This is fixed in the latest version. For previous versions, the work around was not to have HScroll bar when there is only one column in the browse. |
xbrowse : sporadic error | Nages ,
I try to simulate the same error list from mine user. I have no intention to hide all the columns in a browse
Frank
[quote="nageswaragunupudi":79tsu031]#1. You should never hide all columns. Atleast one column should be visible.
#2. When there is only one column in the browse, using horizontal scroll bar was resulting in this error. This is fixed in the latest version. For previous versions, the work around was not to have HScroll bar when there is only one column in the browse.[/quote:79tsu031] |
xbrowse : sporadic error | [quote:1pzd2r8a]Nages ,
I try to simulate the same error list from mine user. I have no intention to hide all the columns in a browse
Frank
[/quote:1pzd2r8a]
I understand and appreciate.
This also means that we need to take care of a situation where the user by himself hides all columns. We need to protect this either in the application program or in xbrowse. Later option is better. We shall see how we can do this within xbrowse.prg. But for existing applications, the applications need to take care of this possibility. Thanks for your feedback.
We would also be interested in knowing if this error is encountered in any situations other than the two I mentioned above.
We are always grateful for your feedback, because that helps us to improve the library. |
xbrowse : sporadic error | Rao ,
I tested to hide all columns (8.10) , but xbrowse doesn't allow to hide the last column.
Frank |
xbrowse : sporadic error | That means the user can not hide all columns.
If at all all columns are hidden that is done by the programmer. Ofcourse we expect the programmer not to do it. So this is not an issue. |
xbrowse : sporadic error | Mr. Nao,
In my case, I don´t hide any columns.
The error appears just ramdonly. |
xbrowse : sporadic error | Hello again,
I am getting this error more often. Sometimes when the dbf is empty.
Is there any advance?.
Thank you. |
xbrowse : sporadic error | aDisplay is created from METHOD GetDisplayCols() CLASS TXBrowse, so I guess thats where we could place some traces:
1. If you are not using any frozen coluns, then this loop should not be executed:
[code=fw:17h1o355]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">do</span> <span style="color: #00C800;">while</span> nFreeze > <span style="color: #000000;">0</span> .and. nCol <= nLen<br /> oCol := ::<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> nCol <span style="color: #000000;">]</span><br /> <span style="color: #00C800;">if</span> ! oCol:<span style="color: #000000;">lHide</span><br /> AAdd<span style="color: #000000;">(</span> aDisplay, nCol <span style="color: #000000;">)</span><br /> oCol:<span style="color: #000000;">nPos</span> := Len<span style="color: #000000;">(</span> aDisplay <span style="color: #000000;">)</span><br /> nFreeze--<br /> <span style="color: #00C800;">endif</span><br /> nCol++<br /> <span style="color: #00C800;">enddo</span></div>[/code:17h1o355]
2. In the above case, aDisplay will be generated here:
[code=fw:17h1o355]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">do</span> <span style="color: #00C800;">while</span> nCol <= nLen<br /> oCol := ::<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> nCol <span style="color: #000000;">]</span><br /> <span style="color: #00C800;">if</span> ! oCol:<span style="color: #000000;">lHide</span><br /> AAdd<span style="color: #000000;">(</span> aDisplay, nCol <span style="color: #000000;">)</span><br /> oCol:<span style="color: #000000;">nPos</span> := Len<span style="color: #000000;">(</span> aDisplay <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> nCol++<br /> <span style="color: #00C800;">enddo</span></div>[/code:17h1o355]
So we could place a trace just after it:
[code=fw:17h1o355]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">if</span> Len<span style="color: #000000;">(</span> aDisplay <span style="color: #000000;">)</span> == <span style="color: #000000;">0</span><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"aDisplay is zero! and nCol is: "</span> + AllTrim<span style="color: #000000;">(</span> Str<span style="color: #000000;">(</span> nCol <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">" nLen is: "</span> + AllTrim<span style="color: #000000;">(</span> Str<span style="color: #000000;">(</span> nLen <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /> ::<span style="color: #000000;">aDisplay</span> := aDisplay<br /> </div>[/code:17h1o355]
nLen is the total amount of columns.
For those of you that are able to reproduce the error, we kindly ask you to use the above trace and tell us what you get, thanks! <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> |
xbrowse : sporadic error | [quote="Antonio Linares":1o6t2ymw]aDisplay is created from METHOD GetDisplayCols() CLASS TXBrowse, so I guess thats where we could place some traces:
So we could place a trace just after it:
[code=fw:1o6t2ymw]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">if</span> Len<span style="color: #000000;">(</span> aDisplay <span style="color: #000000;">)</span> == <span style="color: #000000;">0</span><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"aDisplay is zero! and nCol is: "</span> + AllTrim<span style="color: #000000;">(</span> Str<span style="color: #000000;">(</span> nCol <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">" nLen is: "</span> + AllTrim<span style="color: #000000;">(</span> Str<span style="color: #000000;">(</span> nLen <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /> ::<span style="color: #000000;">aDisplay</span> := aDisplay<br /> </div>[/code:1o6t2ymw]
nLen is the total amount of columns.
For those of you that are able to reproduce the error, we kindly ask you to use the above trace and tell us what you get, thanks! <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->[/quote:1o6t2ymw]
Maybe the callist is also from intrest :
MsgInfo( ... , procname(1) , procname(2),procname(3),procname(4),procname(5))
Frank |
xbrowse : sporadic error | Dear All,
Any update on this topic..
I still experiencing this random error using FWH11.05..
I followed suggested alternatives but I cant explain further how this error still popup randomly..
[code=fw:18l69pyq]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> <span style="color: #00C800;">METHOD</span> ColAtPos<span style="color: #000000;">(</span> nPos <span style="color: #000000;">)</span> <span style="color: #00C800;">INLINE</span> ::<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> ::<span style="color: #000000;">aDisplay</span><span style="color: #000000;">[</span> MinMax<span style="color: #000000;">(</span> <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> nPos == <span style="color: #00C800;">nil</span> .or. nPos == <span style="color: #000000;">0</span>, <span style="color: #000000;">1</span>, nPos <span style="color: #000000;">)</span>, <span style="color: #000000;">1</span>, <span style="color: #0000ff;">Max</span><span style="color: #000000;">(</span> Len<span style="color: #000000;">(</span> ::<span style="color: #000000;">aDisplay</span> <span style="color: #000000;">)</span>, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">]</span> <span style="color: #000000;">]</span><br /> </div>[/code:18l69pyq]
Any update? |
xbrowse : sporadic error | Hello,
This error was fixed and it is working fine in 11.11. |
xbrowse : sporadic error | Hi
How to apply that fix to v11.05? |
xbrowse : sporadic error | anyone... |
xbrowse <-> Tree and viceversa | I have the customer.dbf table,
[img:2uhduvpo]https://i.postimg.cc/XJvNGgBR/1.png[/img:2uhduvpo]
and above the table I can do a search then a get and a combox
I would like to make groupings for example for the State field, so I could use an Xbrowse Tree control and create the same columns you see in the picture.
But I would also like the end user to be able to select the grouping via a popup menu above the dialog .
the end user can select to do the grouping by the "State" field or not to do it.
If it decides not to do the grouping the procedure has to go back to the initial table
That is, I would like to show both a normal table ( xbrowse) and a tree ( xbrowse) in the same xbrowse.
if i have a tree how can i make the lookup work the same as i do with the regular table?
how could i do it?
I made a test but not run ok [b:2uhduvpo]see the video [/b:2uhduvpo]
[img:2uhduvpo]https://i.postimg.cc/QtD406Jz/video2.gif[/img:2uhduvpo] |
xbrowse <-> Tree and viceversa | Hello Silvio;
Your images don't show when I browse but regardless, I think I understand what you're looking for and want to suggest a way to get it.
1. Declare a regular xbrowse on a dialog and also another xbrowse hosting an otree with the very same data source on another dialog.
2. Have both occupy the very same area.
3. When you want to show the regular browse, show that dialog and hide the other and vise versa.
4. When you make changes on one, just make sure to refresh both.
Being that both xbrowses occupy the very same real estate on the screen. only one of the two will be visible at a time.
I hope that helps, |
xbrowse <-> Tree and viceversa | the problem is that i use a scheme ie i use xbrowse search with a get and a combobox, and also the multiselect . When I create the tree it could also work but the search doesn't work
I really don't think I have to use two separate dialogs, the dialog and the xbrowse must be the same, I created something that doesn't work but I'm sure nages will find the solution. It is important to have a grouping, for example in an archive of articles we can view the normal table or a grouping by category, it must be a fluid system. Must have research in both situations
see your mail. |
xbrowse <-> Tree and viceversa | Yes, obrw search probably wont work for searching but if that is the problem, then perhaps something like this extended cb is the idea you are looking for:
[code=fw:2r3fw5hh]<div class="fw" id="{CB}" style="font-family: monospace;"> ::<span style="color: #000000;">bSearch</span> := ;<br /> < | isFromStart, isJump | <br /> <span style="color: #00C800;">LOCAL</span> isFound := .F. <br /> <span style="color: #00C800;">LOCAL</span> oBranch := IIF<span style="color: #000000;">(</span> isFromStart, ::<span style="color: #000000;">oBrw</span>:<span style="color: #000000;">oTree</span>:<span style="color: #000000;">oFirst</span>, ::<span style="color: #000000;">oBrw</span>:<span style="color: #000000;">oTreeItem</span> <span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">DEFAULT</span> isJump := .T. <br /><br /> <span style="color: #00C800;">WHILE</span> oBranch != <span style="color: #00C800;">NIL</span> .AND. ;<br /> !<span style="color: #000000;">(</span> isFound := ALLTRIM<span style="color: #000000;">(</span> oBranch:<span style="color: #000000;">cPrompt</span> <span style="color: #000000;">)</span> == ::<span style="color: #000000;">cSeek</span> <span style="color: #000000;">)</span> .AND. ;<br /> !<span style="color: #000000;">(</span> isFound := ALLTRIM<span style="color: #000000;">(</span> oBranch:<span style="color: #000000;">Cargo</span><span style="color: #000000;">[</span> _ADMNUM <span style="color: #000000;">]</span> <span style="color: #000000;">)</span> == ::<span style="color: #000000;">cSeek</span> <span style="color: #000000;">)</span> .AND. ;<br /> !<span style="color: #000000;">(</span> isFound := UPPER<span style="color: #000000;">(</span> ALLTRIM<span style="color: #000000;">(</span> ::<span style="color: #000000;">cSeek</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> $ UPPER<span style="color: #000000;">(</span> oBranch:<span style="color: #000000;">Cargo</span><span style="color: #000000;">[</span> _PATNAME <span style="color: #000000;">]</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <br /> oBranch := oBranch:<span style="color: #000000;">GetNext</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> END<br /><br /> <span style="color: #00C800;">IF</span> isFound .AND. isJump ;EVAL<span style="color: #000000;">(</span> ::<span style="color: #000000;">oBrw</span>:<span style="color: #000000;">bBookmark</span>, oBranch:<span style="color: #000000;">ItemNo</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> ;ENDIF<br /> <br /> <span style="color: #00C800;">RETURN</span> isFound<br /> ><br /> </div>[/code:2r3fw5hh]
This code searches on various columns of the xbrowse tree. Change to search on more columns or just 1 column by adjusting _ADMNUM and _PTENAME to column index you want to search on.
Hope it helps or at least points towards the solution you are looking for. |
xbrowse <-> Tree and viceversa | Hello Silvio,
I asked ChatGPT:
I pass the Fivewin documentation along with my question.
Best regards,
Otto
[code=fw:3to9lbcj]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">To</span> achieve the desired functionality <span style="color: #0000ff;">of</span> displaying both a regular table <span style="color: #000000;">(</span><span style="color: #0000ff;">xBrowse</span><span style="color: #000000;">)</span> and a tree <span style="color: #000000;">(</span><span style="color: #0000ff;">xBrowse</span><span style="color: #000000;">)</span> in the same <span style="color: #0000ff;">xBrowse</span> control with the ability <span style="color: #0000ff;">to</span> <span style="color: #00C800;">switch</span> between grouping and non-grouping modes, you can follow these steps:<br /><br /><span style="color: #000000;">Create</span> the <span style="color: #0000ff;">xBrowse</span> control and attach the initial table <span style="color: #000000;">(</span>customer.dbf<span style="color: #000000;">)</span> as the <span style="color: #00C800;">data</span> source using the SetRDD<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">method</span>.<br /><br /><span style="color: #0000ff;">Define</span> the columns <span style="color: #00C800;">for</span> the regular table view <span style="color: #0000ff;">of</span> the <span style="color: #0000ff;">xBrowse</span>. You can use the AddColumn<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">method</span> <span style="color: #0000ff;">to</span> add columns with field names or expressions, similar <span style="color: #0000ff;">to</span> how you would <span style="color: #0000ff;">define</span> columns <span style="color: #00C800;">for</span> a regular <span style="color: #0000ff;">xBrowse</span>.<br /><br />Implement the grouping functionality using an <span style="color: #0000ff;">xBrowse</span> Tree control. You can create a separate <span style="color: #0000ff;">xBrowse</span> Tree control and attach it as a child <span style="color: #0000ff;">of</span> the main <span style="color: #0000ff;">xBrowse</span> control. Configure the <span style="color: #0000ff;">xBrowse</span> Tree control <span style="color: #0000ff;">to</span> <span style="color: #00C800;">display</span> the grouped <span style="color: #00C800;">data</span> based <span style="color: #0000ff;">on</span> the <span style="color: #ff0000;">"State"</span> field.<br /><br />Implement the <span style="color: #0000ff;">popup</span> <span style="color: #0000ff;">menu</span> above the <span style="color: #0000ff;">dialog</span> <span style="color: #0000ff;">to</span> allow the end user <span style="color: #0000ff;">to</span> <span style="color: #0000ff;">select</span> the grouping option. <span style="color: #0000ff;">When</span> the user selects the grouping option, <span style="color: #00C800;">switch</span> the <span style="color: #0000ff;">xBrowse</span> control <span style="color: #0000ff;">to</span> <span style="color: #00C800;">display</span> the <span style="color: #0000ff;">xBrowse</span> Tree control with the grouped <span style="color: #00C800;">data</span>.<br /><br />Handle the scenario <span style="color: #0000ff;">when</span> the user decides not <span style="color: #0000ff;">to</span> <span style="color: #00C800;">do</span> grouping. In this <span style="color: #00C800;">case</span>, you need <span style="color: #0000ff;">to</span> <span style="color: #00C800;">switch</span> the <span style="color: #0000ff;">xBrowse</span> control back <span style="color: #0000ff;">to</span> <span style="color: #00C800;">display</span> the regular table view. You can achieve this by hiding or removing the <span style="color: #0000ff;">xBrowse</span> Tree control and reattaching the initial table as the <span style="color: #00C800;">data</span> source using the SetRDD<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">method</span>.<br /><br /><span style="color: #0000ff;">To</span> make the lookup work the same as with the regular table, you can handle the lookup functionality separately <span style="color: #00C800;">for</span> the regular table view and the grouped view <span style="color: #000000;">(</span><span style="color: #0000ff;">xBrowse</span> Tree control<span style="color: #000000;">)</span>. <span style="color: #0000ff;">When</span> the <span style="color: #0000ff;">xBrowse</span> control is displaying the regular table view, you can handle the lookup functionality as you normally would <span style="color: #00C800;">for</span> a regular <span style="color: #0000ff;">xBrowse</span>. <span style="color: #0000ff;">When</span> the <span style="color: #0000ff;">xBrowse</span> control is displaying the grouped view, you can implement custom lookup functionality specific <span style="color: #0000ff;">to</span> the grouped <span style="color: #00C800;">data</span> structure, such as searching within the grouped nodes or expanding/collapsing the nodes <span style="color: #0000ff;">to</span> perform the lookup.<br /><br />By combining these steps, you can create an <span style="color: #0000ff;">xBrowse</span> control that can <span style="color: #00C800;">display</span> both a regular table view and a grouped view using an <span style="color: #0000ff;">xBrowse</span> Tree control, allowing the end user <span style="color: #0000ff;">to</span> <span style="color: #00C800;">switch</span> between the two and perform lookups in a consistent manner.<br /><br /><br /><br /><br /><br /> </div>[/code:3to9lbcj] |
xbrowse <-> Tree and viceversa | I sent to fwteam a test. It can runn but the search run only with normale xbrowse and not with xbrowse tree |
xbrowse <-> Tree and viceversa | [quote="Silvio.Falconi":fp1z8zzd]I sent to fwteam a test. It can runn but the search run only with normale xbrowse and not with xbrowse tree[/quote:fp1z8zzd]
Dear Silvio
To use Tree or normal view in an xbrowse, you have an example in xbrtree.prg ( samples folder).
Allow to search in the tree as in the normal xbrowse, with what criteria? I don't understand that you can search, for example, for a surname that can be in several groups of the tree, that is, the table cannot be sorted at that moment because the tree would be lost.
If a custom search is set (manually), I understand it can be done. |
xbrowse <-> Tree and viceversa | Otto, I'm really impressed with the answer. It opens our minds.
I wonder if you can follow up that same chat and ask to write sample code that implements those steps and then compare to how close to working code it produces. |
xbrowse <-> Tree and viceversa | [quote="Otto":21zn7xbu]Hello Silvio,
I asked ChatGPT:
I pass the Fivewin documentation along with my question.
Best regards,
Otto
[code=fw:21zn7xbu]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">To</span> achieve the desired functionality <span style="color: #0000ff;">of</span> displaying both a regular table <span style="color: #000000;">(</span><span style="color: #0000ff;">xBrowse</span><span style="color: #000000;">)</span> and a tree <span style="color: #000000;">(</span><span style="color: #0000ff;">xBrowse</span><span style="color: #000000;">)</span> in the same <span style="color: #0000ff;">xBrowse</span> control with the ability <span style="color: #0000ff;">to</span> <span style="color: #00C800;">switch</span> between grouping and non-grouping modes, you can follow these steps:<br /><br /><span style="color: #000000;">Create</span> the <span style="color: #0000ff;">xBrowse</span> control and attach the initial table <span style="color: #000000;">(</span>customer.dbf<span style="color: #000000;">)</span> as the <span style="color: #00C800;">data</span> source using the SetRDD<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">method</span>.<br /><br /><span style="color: #0000ff;">Define</span> the columns <span style="color: #00C800;">for</span> the regular table view <span style="color: #0000ff;">of</span> the <span style="color: #0000ff;">xBrowse</span>. You can use the AddColumn<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">method</span> <span style="color: #0000ff;">to</span> add columns with field names or expressions, similar <span style="color: #0000ff;">to</span> how you would <span style="color: #0000ff;">define</span> columns <span style="color: #00C800;">for</span> a regular <span style="color: #0000ff;">xBrowse</span>.<br /><br />Implement the grouping functionality using an <span style="color: #0000ff;">xBrowse</span> Tree control. You can create a separate <span style="color: #0000ff;">xBrowse</span> Tree control and attach it as a child <span style="color: #0000ff;">of</span> the main <span style="color: #0000ff;">xBrowse</span> control. Configure the <span style="color: #0000ff;">xBrowse</span> Tree control <span style="color: #0000ff;">to</span> <span style="color: #00C800;">display</span> the grouped <span style="color: #00C800;">data</span> based <span style="color: #0000ff;">on</span> the <span style="color: #ff0000;">"State"</span> field.<br /><br />Implement the <span style="color: #0000ff;">popup</span> <span style="color: #0000ff;">menu</span> above the <span style="color: #0000ff;">dialog</span> <span style="color: #0000ff;">to</span> allow the end user <span style="color: #0000ff;">to</span> <span style="color: #0000ff;">select</span> the grouping option. <span style="color: #0000ff;">When</span> the user selects the grouping option, <span style="color: #00C800;">switch</span> the <span style="color: #0000ff;">xBrowse</span> control <span style="color: #0000ff;">to</span> <span style="color: #00C800;">display</span> the <span style="color: #0000ff;">xBrowse</span> Tree control with the grouped <span style="color: #00C800;">data</span>.<br /><br />Handle the scenario <span style="color: #0000ff;">when</span> the user decides not <span style="color: #0000ff;">to</span> <span style="color: #00C800;">do</span> grouping. In this <span style="color: #00C800;">case</span>, you need <span style="color: #0000ff;">to</span> <span style="color: #00C800;">switch</span> the <span style="color: #0000ff;">xBrowse</span> control back <span style="color: #0000ff;">to</span> <span style="color: #00C800;">display</span> the regular table view. You can achieve this by hiding or removing the <span style="color: #0000ff;">xBrowse</span> Tree control and reattaching the initial table as the <span style="color: #00C800;">data</span> source using the SetRDD<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">method</span>.<br /><br /><span style="color: #0000ff;">To</span> make the lookup work the same as with the regular table, you can handle the lookup functionality separately <span style="color: #00C800;">for</span> the regular table view and the grouped view <span style="color: #000000;">(</span><span style="color: #0000ff;">xBrowse</span> Tree control<span style="color: #000000;">)</span>. <span style="color: #0000ff;">When</span> the <span style="color: #0000ff;">xBrowse</span> control is displaying the regular table view, you can handle the lookup functionality as you normally would <span style="color: #00C800;">for</span> a regular <span style="color: #0000ff;">xBrowse</span>. <span style="color: #0000ff;">When</span> the <span style="color: #0000ff;">xBrowse</span> control is displaying the grouped view, you can implement custom lookup functionality specific <span style="color: #0000ff;">to</span> the grouped <span style="color: #00C800;">data</span> structure, such as searching within the grouped nodes or expanding/collapsing the nodes <span style="color: #0000ff;">to</span> perform the lookup.<br /><br />By combining these steps, you can create an <span style="color: #0000ff;">xBrowse</span> control that can <span style="color: #00C800;">display</span> both a regular table view and a grouped view using an <span style="color: #0000ff;">xBrowse</span> Tree control, allowing the end user <span style="color: #0000ff;">to</span> <span style="color: #00C800;">switch</span> between the two and perform lookups in a consistent manner.<br /><br /><br /><br /><br /><br /> </div>[/code:21zn7xbu][/quote:21zn7xbu]
aside I don't think chatGpt knows fivewin and Harbor because I've already tried a thousand times and I haven't succeeded, if he replies to you why don't you try to ask this:
"Please create me a little Harbor/fivewin language program that does a xbrowse tree with grouping to one field and a normal xbrowse in the same xbrowse and creates record lookup" |
xbrowse <-> Tree and viceversa | Silvio,
You need to include the Fivewin documentation along with your question as a knowledge base.
Best regards,
Otto |
xbrowse <-> Tree and viceversa | this is a small test
the search not run
I used array
[code=fw:2nm64efh]<div class="fw" id="{CB}" style="font-family: monospace;"> <br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br />REQUEST DBFCDX<br /><br /><span style="color: #00C800;">static</span> lTipo1:=.f.,ltipo2:=.f.<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> aData<br /><br /> FERASE<span style="color: #000000;">(</span> <span style="color: #ff0000;">"CUSTOMER.CDX"</span> <span style="color: #000000;">)</span><br /> USE CUSTOMER <span style="color: #00C800;">NEW</span> EXCLUSIVE VIA <span style="color: #ff0000;">"DBFCDX"</span><br /> aData := FW_DbfToArray<span style="color: #000000;">(</span> <span style="color: #ff0000;">"FIRST,LAST,STREET,STATE"</span>, , <span style="color: #000000;">{</span> || RECNO<span style="color: #000000;">(</span><span style="color: #000000;">)</span> < <span style="color: #000000;">11</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> GO TOP<br /> FW_CdxCreate<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> CLOSE CUSTOMER<br /><br /> Customers<span style="color: #000000;">(</span>aData<span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><br /><span style="color: #00C800;">function</span> Customers<span style="color: #000000;">(</span>aData<span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oDlg, oBrw, oGroup<br /><br /> <span style="color: #00C800;">local</span> oSay:=array<span style="color: #000000;">(</span><span style="color: #000000;">2</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> cSeek:=Space<span style="color: #000000;">(</span><span style="color: #000000;">100</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> oGet<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">800</span>,<span style="color: #000000;">400</span> <span style="color: #0000ff;">PIXEL</span> TRUEPIXEL RESIZABLE<br /><br /> @ <span style="color: #000000;">10</span>, <span style="color: #000000;">165</span> <span style="color: #0000ff;">GET</span> oGet <span style="color: #0000ff;">VAR</span> cSeek <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">200</span>,<span style="color: #000000;">19</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"@!"</span><br /><br /><br /> <span style="color: #B900B9;">/* @ nRow - 1, 10 COMBOBOX nFilter SIZE 60, If( IsAppThemed(), 14, 60 ) PIXEL OF oDlg ;<br /> ITEMS { "Search For", "Show Only" } ;<br /> ON CHANGE ( oBrw:Seek( "" ), oBrw:lIncrFilter := nFilter > 1, oBrw:SetFocus() )<br /><br /> @ nRow - 1, 72 COMBOBOX nSeekWild ;<br /> size 60, If( IsAppThemed(), 14, 60 ) pixel of oDlg ;<br /> ITEMS { "Starting With", "Containing" } ;<br /> on change ( oBrw:lSeekWild := ( nSeekWild > 1 ), oBrw:Seek( "" ), oBrw:SetFocus() )<br /> */</span><br /><br /><br /><br /> @ <span style="color: #000000;">10</span>, <span style="color: #000000;">700</span> <span style="color: #0000ff;">BTNBMP</span> oGroup <span style="color: #0000ff;">Prompt</span> <span style="color: #ff0000;">"group on"</span> ;<br /> FLAT <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">80</span>, <span style="color: #000000;">20</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">PIXEL</span> ;<br /> BITMAP <span style="color: #ff0000;">".<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\c</span>ombo.bmp"</span> <span style="color: #0000ff;">RIGHT</span> NOROUND;<br /> <span style="color: #0000ff;">ACTION</span> ::<span style="color: #000000;">ShowPopUp</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> |oBtn| BtnPop<span style="color: #000000;">(</span> aData, oDlg, oBrw,oGet <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;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span>;<br /> <span style="color: #0000ff;">on</span> <span style="color: #0000ff;">init</span> oBrw:= MyBrowse<span style="color: #000000;">(</span>aData,oDlg, oBrw<span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><span style="color: #B900B9;">//--------------------------------------------------------------------------------//</span><br /><span style="color: #00C800;">Function</span> MyBrowse<span style="color: #000000;">(</span>aData,oDlg, oBrw, oGet<span style="color: #000000;">)</span><br /><br /><br /> @ <span style="color: #000000;">60</span>,<span style="color: #000000;">20</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">-20</span>,<span style="color: #000000;">-20</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> DATASOURCE aData ;<br /> <span style="color: #0000ff;">AUTOCOLS</span> ;<br /> HEADERS <span style="color: #ff0000;">"NAME"</span>,<span style="color: #ff0000;">"SURNAME"</span>,<span style="color: #ff0000;">"ADDRESS"</span>,<span style="color: #ff0000;">"STATE"</span> ;<br /> AUTOSORT ;<br /> NOBORDER LINES<br /><br /> WITH OBJECT oBrw<br /><br /> :<span style="color: #000000;">lHScroll</span> := .f.<br /> :<span style="color: #000000;">SetMultiSelectCol</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">//---</span><br /> :<span style="color: #000000;">lIncrFilter</span> := .t.<br /> :<span style="color: #000000;">bOnSort</span> := <span style="color: #000000;">{</span> |b,oCol| oBrw:<span style="color: #000000;">Seek</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span>, ;<br /> oBrw:<span style="color: #000000;">cFilterFld</span> := oCol:<span style="color: #000000;">cExpr</span>, ;<br /> oBrw:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">oSeek</span> := oGet<br /> <span style="color: #B900B9;">//----</span><br /> :<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> END<br /><br /><br /> @ <span style="color: #000000;">10</span>,<span style="color: #000000;">20</span> <span style="color: #0000ff;">COMBOBOX</span> oBrw:<span style="color: #000000;">oSortCbx</span> <span style="color: #0000ff;">VAR</span> oBrw:<span style="color: #000000;">cSortOrder</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>,<span style="color: #000000;">400</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg<br /><br /><span style="color: #00C800;">return</span> oBrw<br /><span style="color: #B900B9;">//--------------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">Function</span> BtnPop<span style="color: #000000;">(</span>aData, oDlg, oBrw,oGet<span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> oItem1,oItem2<br /><span style="color: #0000ff;">MENU</span> oMenu <span style="color: #0000ff;">POPUP</span><br /><span style="color: #0000ff;">MENUITEM</span> oItem1 <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"State"</span> ;<br /><span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span>lTipo1 := !lTipo1,;<br /> <span style="color: #000000;">(</span> Iif<span style="color: #000000;">(</span> ltipo1,MakeGroup<span style="color: #000000;">(</span>oBrw,oGet,oDlg<span style="color: #000000;">)</span>,;<br /> MyBrowse<span style="color: #000000;">(</span>aData,oDlg, oBrw,oGet<span style="color: #000000;">)</span> <span style="color: #000000;">)</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br />oItem1:<span style="color: #000000;">SetCheck</span><span style="color: #000000;">(</span>lTipo1<span style="color: #000000;">)</span><br /><span style="color: #0000ff;">ENDMENU</span><br /><span style="color: #00C800;">return</span> oMenu<br /><span style="color: #B900B9;">//---------------------------------------------------------------------//</span><br /><br /><br /><span style="color: #00C800;">Function</span> MakeGroup<span style="color: #000000;">(</span>oBrw,oGet,oDlg<span style="color: #000000;">)</span> <span style="color: #B900B9;">// simulation</span><br /> <span style="color: #00C800;">local</span> aDatatree:=<span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /> <span style="color: #00C800;">local</span> aState:=<span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /> <span style="color: #00C800;">local</span> cState :=<span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">local</span> n:= <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">local</span> k<br /> <span style="color: #00C800;">local</span> aHeaders:= <span style="color: #000000;">{</span> <span style="color: #ff0000;">"First"</span>,<span style="color: #ff0000;">"Last"</span>,<span style="color: #ff0000;">"City"</span>,<span style="color: #ff0000;">"State"</span><span style="color: #000000;">}</span><br /> <span style="color: #00C800;">local</span> oCol<br /> <span style="color: #00C800;">local</span> oDbf<br /><br /> oDbf:=Tdatabase<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span>,<span style="color: #ff0000;">"customer"</span> ,<span style="color: #ff0000;">"DBFCDX"</span>, .t.<span style="color: #000000;">)</span><br /> oDbf:<span style="color: #000000;">setorder</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"state"</span><span style="color: #000000;">)</span><br /> oDbf:<span style="color: #000000;">gotop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #B900B9;">//load State</span><br /> <span style="color: #00C800;">Do</span> <span style="color: #00C800;">while</span> .not. oDbf:<span style="color: #000000;">eof</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> !Empty<span style="color: #000000;">(</span>oDbf:<span style="color: #000000;">state</span><span style="color: #000000;">)</span> .and. oDbf:<span style="color: #000000;">State</span>!=cState<br /> aadd<span style="color: #000000;">(</span>aState,oDbf:<span style="color: #000000;">State</span><span style="color: #000000;">)</span><br /> n++<br /> <span style="color: #00C800;">Endif</span><br /> cState:= oDbf:<span style="color: #000000;">State</span><br /> oDbf:<span style="color: #000000;">skip</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Enddo</span><br /> oDbf:<span style="color: #000000;">gotop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /><br /> <span style="color: #B900B9;">// see on dbf for state</span><br /> k:= <span style="color: #000000;">0</span><br /> <span style="color: #00C800;">For</span> n= <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> len<span style="color: #000000;">(</span> astate<span style="color: #000000;">)</span><br /> k:=k<span style="color: #000000;">+1</span><br /> aadd<span style="color: #000000;">(</span>aDatatree,<span style="color: #000000;">{</span><span style="color: #ff0000;">"State"</span>+chr<span style="color: #000000;">(</span><span style="color: #000000;">187</span><span style="color: #000000;">)</span>+aState<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span> ,<span style="color: #ff0000;">""</span>,<span style="color: #ff0000;">""</span>,<span style="color: #ff0000;">""</span>,k <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> oDbf:<span style="color: #000000;">Seek</span><span style="color: #000000;">(</span>aState<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Do</span> <span style="color: #00C800;">while</span> !oDbf:<span style="color: #000000;">Eof</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> alltrim<span style="color: #000000;">(</span>oDbf:<span style="color: #000000;">state</span><span style="color: #000000;">)</span> == alltrim<span style="color: #000000;">(</span>astate<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">)</span><br /> k:=k<span style="color: #000000;">+1</span><br /> aadd<span style="color: #000000;">(</span>aDatatree,<span style="color: #000000;">{</span>space<span style="color: #000000;">(</span><span style="color: #000000;">20</span><span style="color: #000000;">)</span>+alltrim<span style="color: #000000;">(</span>oDbf:<span style="color: #000000;">First</span><span style="color: #000000;">)</span>,oDbf:<span style="color: #000000;">Last</span>,oDbf:<span style="color: #000000;">city</span>,oDbf:<span style="color: #000000;">state</span>,k <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> exit<br /> <span style="color: #00C800;">Endif</span><br /> oDbf:<span style="color: #000000;">skip</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">enddo</span><br /> oDbf:<span style="color: #000000;">gotop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Next</span><br /> oDbf:<span style="color: #000000;">close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">// make a sort</span><br /> aDatatree := aSort<span style="color: #000000;">(</span> aDatatree,,,<span style="color: #000000;">{</span>|x,y| <span style="color: #000000;">(</span>x<span style="color: #000000;">[</span><span style="color: #000000;">5</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span> < <span style="color: #000000;">(</span>y<span style="color: #000000;">[</span><span style="color: #000000;">5</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">// insert on xbrowse</span><br /> oBrw:<span style="color: #000000;">ResetData</span><span style="color: #000000;">(</span> <span style="color: #00C800;">nil</span>,<span style="color: #000000;">{</span><span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">lAutoSort</span> := .t.<br /><br /><br /> oBrw:<span style="color: #000000;">setarray</span><span style="color: #000000;">(</span>aDatatree<span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">// set the titles</span><br /><br /> oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">cHeader</span> := <span style="color: #ff0000;">"State"</span><br /> oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">2</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">cHeader</span> := <span style="color: #ff0000;">"First"</span><br /> oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">3</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">cHeader</span> := <span style="color: #ff0000;">"Last"</span><br /> oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">4</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">cHeader</span> := <span style="color: #ff0000;">"Last"</span><br /> oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">5</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">cHeader</span> := <span style="color: #ff0000;">"State"</span><br /><br /> <span style="color: #B900B9;">// hide :aCols[5] the number I used</span><br /> oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span><span style="color: #000000;">5</span><span style="color: #000000;">]</span>:<span style="color: #000000;">Hide</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #B900B9;">//these not run</span><br /> oBrw:<span style="color: #000000;">lIncrFilter</span> := .t.<br /> oBrw:<span style="color: #000000;">lSeekWild</span> := .t.<br /> oBrw:<span style="color: #000000;">bOnSort</span> := <span style="color: #000000;">{</span> |b,oCol| oBrw:<span style="color: #000000;">Seek</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span>, ;<br /> oBrw:<span style="color: #000000;">cFilterFld</span> := oCol:<span style="color: #000000;">cExpr</span>, ;<br /> oBrw:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> oBrw:<span style="color: #000000;">oSeek</span> := oGet<br /><br /><br /> <span style="color: #B900B9;">// refresh()</span><br /> oBrw:<span style="color: #0000ff;">refresh</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 /><span style="color: #B900B9;">//-------------------------------------------------------------------------------------------------------------//</span><br /><br /><br /> </div>[/code:2nm64efh] |
xbrowse <-> Tree and viceversa | Hello Silvio,
I get an anwer but I have an older version installed where things are missing.
Which version of FW do you use.
Best regards,
Otto
ChatGPT says:
[quote:1cfmg9m3]
The bOnSort property is defined as a code block, but its implementation is missing in the provided code. You need to define the sorting logic inside this code block to make the sorting functionality work.
In the MakeGroup function, there is a line oDbf:close(), which is closing the database file before performing operations on it. Remove this line to ensure the database file remains open for further operations.
[/quote:1cfmg9m3] |
xbrowse <-> Tree and viceversa | [quote="Otto":iv6h4wca]Hello Silvio,
I get an anwer but I have an older version installed where things are missing.
Which version of FW do you use.
Best regards,
Otto
ChatGPT says:
[quote:iv6h4wca]
The bOnSort property is defined as a code block, but its implementation is missing in the provided code. You need to define the sorting logic inside this code block to make the sorting functionality work.
In the MakeGroup function, there is a line oDbf:close(), which is closing the database file before performing operations on it. Remove this line to ensure the database file remains open for further operations.
[/quote:iv6h4wca][/quote:iv6h4wca]
fwh release December 2021 to March 2022
I must close the oDbf with oDbf:close() I create an array aDatatree for xbrowse tree , why I need oDbf ?
I regularly use this scheme to do database lookups in all my dialogs
[code=fw:iv6h4wca]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /> @ <span style="color: #000000;">10</span>, <span style="color: #000000;">165</span> <span style="color: #0000ff;">GET</span> oGet <span style="color: #0000ff;">VAR</span> cSeek <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">200</span>,<span style="color: #000000;">19</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"@!"</span><br /> <br />@ <span style="color: #000000;">110</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">XBROWSE</span> oBrw....<br /><br /> WITH OBJECT oBrw<br /> :<span style="color: #000000;">lHScroll</span> := .f.<br /> :<span style="color: #000000;">lIncrFilter</span> := .t.<br /> :<span style="color: #000000;">bOnSort</span> := <span style="color: #000000;">{</span> |b,oCol| oBrw:<span style="color: #000000;">Seek</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span>, ;<br /> oBrw:<span style="color: #000000;">cFilterFld</span> := oCol:<span style="color: #000000;">cExpr</span>, ;<br /> oBrw:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">oSeek</span> := oGet<br /> :<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> END<br /><br /> @ <span style="color: #000000;">10</span>, <span style="color: #000000;">550</span> <span style="color: #0000ff;">COMBOBOX</span> oBrw:<span style="color: #000000;">oSortCbx</span> <span style="color: #0000ff;">VAR</span> oBrw:<span style="color: #000000;">cSortOrder</span>;<br /> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">200</span>,<span style="color: #000000;">400</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg<br /><br /> </div>[/code:iv6h4wca] |
xbrowse AYUDA perdida de foco y escape... | hola foro,
aqui probando por 1a vez la xbrowse nativa, y me topo con 2 cosas que no he sabido por donde buscarle...
la uso con array
1. tengo 5 botones y un xbrowse, el browse tengo 3 columnas editables,1 con get y dos con listbox, cuando en los listbox slecciono con ENTER se pirde el foco del xbrowse y me pasa al siguiente control, como hacer para que se quede el foco en el xbrowse? si selecciono del listbox con raton no sucede eso
2. cuando estoy editando la primer columna si presiono ESCAPE no me devuelve al valor anterior, me acepta la captura, de hecho en mi dialogo tuve que poner un VALID porque si presionaba ESCAPE estando editando en el xbrowse me cerraba el dialogo completo.
asi tengo mi columna para el ESCAPE
oBrw:aCols[1]:bOnPostEdit := {|o,xVal,nKey| IF(nKey!=VK_ESCAPE,aDetalle[ oBrw:nArrayAt, 1 ] := xVal,) }
alguna sugerencia?
uso fwh705 y harbour
gracias
paco |
xbrowse Border | [img:2znz4t80]https://i.postimg.cc/ZKh8qcTq/ghg.png[/img:2znz4t80]
how can I have the black border at the right side of the xbrowse after the scrollbar ?
I made
[code=fw:2znz4t80]<div class="fw" id="{CB}" style="font-family: monospace;"> @ <span style="color: #000000;">40</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">300</span>, <span style="color: #000000;">-20</span> <span style="color: #0000ff;">PIXEL</span> ;<br /> <span style="color: #0000ff;">AUTOCOLS</span> DATASOURCE oDbf NOBORDER<br /><br /> WITH OBJECT oBrw<br /> :<span style="color: #000000;">lDrawBorder</span> := .t.<br /> :<span style="color: #000000;">nClrBorder</span> := CLR_BLACK<br /> END</div>[/code:2znz4t80]
but the border is drawed only on left and up and down of the xbrowse
If I make
oBrw:lVScroll := .f.
oBrw:lhScroll := .f.
the border is painted good but I need to use Vscroll
[img:2znz4t80]https://i.postimg.cc/1zwPXZ0g/lll.png[/img:2znz4t80]
I think we need to tell the xbrowse class that when there is vertical scrolling the border must be drawn after the scroll
any solution ? |
xbrowse Border | [b:5xee4cey]For Antonio & NagesWarao [/b:5xee4cey] Lines 2674/2675 of Xbrowse class
I propose this solution for displaying the border in the presence of vertical scrolling
if ::lDrawBorder
// ::Box( 0, 0, ::nHeight - 1, ::nWidth - 1, IfNil( ::nClrBorder, ::hColPen ) )
[b:5xee4cey] ::Box( 0, 0, ::nHeight - 1, ::BrwWidth(), IfNil( ::nClrBorder, ::hColPen ) )[/b:5xee4cey]
endif
[img:5xee4cey]https://i.postimg.cc/vHytyBsS/ok.png[/img:5xee4cey]
the same must be made in the presence of Horizontal scrolling but I not found the part where draw the box when there ::lHscroll is true
better can be
oBrw:lVScroll := .t.
oBrw:lhScroll := .t.
[code=fw:5xee4cey]<div class="fw" id="{CB}" style="font-family: monospace;"> <br /><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">lDrawBorder</span><br /> <span style="color: #00C800;">If</span> ::<span style="color: #000000;">lVScroll</span><br /> ::<span style="color: #000000;">Box</span><span style="color: #000000;">(</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, ::<span style="color: #000000;">nHeight</span> - <span style="color: #000000;">1</span>, ::<span style="color: #000000;">BrwWidth</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, IfNil<span style="color: #000000;">(</span> ::<span style="color: #000000;">nClrBorder</span>, ::<span style="color: #000000;">hColPen</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Endif</span><br /> <span style="color: #00C800;">If</span> ::<span style="color: #000000;">lHScroll</span><br /> ::<span style="color: #000000;">Box</span><span style="color: #000000;">(</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, ::<span style="color: #000000;">BrwHeight</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, ::<span style="color: #000000;">nWidth</span> - <span style="color: #000000;">1</span>, IfNil<span style="color: #000000;">(</span> ::<span style="color: #000000;">nClrBorder</span>, ::<span style="color: #000000;">hColPen</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">If</span> ::<span style="color: #000000;">lVScroll</span> .and. ::<span style="color: #000000;">lHScroll</span><br /> ::<span style="color: #000000;">Box</span><span style="color: #000000;">(</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, ::<span style="color: #000000;">BrwHeight</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, ::<span style="color: #000000;">BrwWidth</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, IfNil<span style="color: #000000;">(</span> ::<span style="color: #000000;">nClrBorder</span>, ::<span style="color: #000000;">hColPen</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /><br /> </div>[/code:5xee4cey]
[img:5xee4cey]https://i.postimg.cc/YSJR5zRJ/ok-2.png[/img:5xee4cey]
it run also with oBrw:lfooter := .t.
[b:5xee4cey]My Advice[/b:5xee4cey]
the best modification is to draw the border after the horizontal and vertical scroll and not before as I have solved, certainly you would know how to do it
i.e. the border should be drawn around the whole control as it was a long time ago (xbrowse Ortiz de Zuniga) |
xbrowse Devolver valor de una celda | Buenas Tardes foro:
Tengo un array multidimensional aProductos [ xn, yn ] en un xbrowse, y necesito conocer el valor de la celda y su posición al momento de hacer un doble click.
¿ Cómo se hace?
Gracias |
xbrowse Devolver valor de una celda | Posición
[code=fw:3og0da9e]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oBrw:<span style="color: #000000;">nArrayAt</span><br /> </div>[/code:3og0da9e]
Valor
[code=fw:3og0da9e]<div class="fw" id="{CB}" style="font-family: monospace;"><br />variable := aMyArray<span style="color: #000000;">[</span>oBrw:<span style="color: #000000;">nArrayAt</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span>nroCol<span style="color: #000000;">]</span><br />ó<br />variable := aMyArray<span style="color: #000000;">[</span>oBrw:<span style="color: #000000;">nArrayAt</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #ff0000;">"nameKey"</span><span style="color: #000000;">]</span> <span style="color: #B900B9;">//hash</span><br /> </div>[/code:3og0da9e] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.