topic
stringlengths
1
63
text
stringlengths
1
577k
xBrowser How to display customers/city a kind of treeview
I tried to display – this is easy and working- but if you skip than this seems to be much work. Is there somewhere a sourcecode example showing how to do such a browse? For example: I would like to show all customers if there are more than one customer in a city the city is only shown once (a kind of treeview) [img:2utern6z]http://www.atzwanger.com/fw/ort.jpg[/img:2utern6z]
xBrowser How to display customers/city a kind of treeview
For arrays I do like this : [code:3ccng8vb] oCol:bStrData := {||iif( oBrw:nArrayAt > 1 .and. aArray[oBrw:nArrayAt][1] == aArray[oBrw:nArrayAt-1][1], space(10),aArray[oBrw:nArrayAt][1] )} [/code:3ccng8vb] I commonly do this for arrays and ado recordsets. We can also do it for DBFs but the code depends on your specifc case. Ideally we would like if no lines are painted within a group. This can be done but needs one more data item in the column object and some change in the browse's paint method
xBrowser How to display customers/city a kind of treeview
Hello NageswaraRao, Thank you for your code. I tested and it works as suspected for arrays. [img:161gi7c4]http://www.atzwanger.com/fw/rao1.jpg[/img:161gi7c4] Am I right that if you use dbf-files aArray can’t be used? Do I have to make an own array parallel to get this functionality? To test I tried with dbf files - I think it is similar to your code but hard coded - I used: STATIC cCity func bStrDataFIELD_CITY() local cTEmpCity := _FIELD->CITY IF cCity = cTEmpCity cTEmpCity := " " else cCity := _FIELD->CITY ENDIF return cCity But if you skip this does not work and I thought to fill an array parallel with the current scope. Could you imagine if this will work. What is the reason why xBrowse distinguish between array and dbf-file. If you look at other languages they make a recordset or a dataadapter and bind the browser to this. Regards, Otto
xBrowser How to display customers/city a kind of treeview
The main requirement is to test whether the current field value = the previous records fieldvalue. You can achieve this in different ways. What you do may just depend on dbf size, index key and so on. If the dbf is not too large, and confident that other users will not change during the session, one way to do this may be like this. Traverse the DBF and store the record numbers of the first occurance of the keyfield in an array. Then bStrData := {|| iif( ascan( recno(), aUniques ) == 0, fieldget(1), space( <len> ) } There are many other ways. Few examples: you can have a udf to look up previous value and return if the current value is a repeat. If you create a compound index in a suitable way you can self relate the dbf so that the child points to prev record in the index. You choose the optimal method depending on each specific case.
xBrowser How to display customers/city a kind of treeview
Sorry, I edited during you answered. Regards, Otto
xBrowser How to display customers/city a kind of treeview
NageswaraRao, Thank you for you answer. I thought to fill a temp-array in this part of xBrowser and then to access this array. METHOD Paint() CLASS TXBrowse do while nRowPos <= nMaxRows // We must also paint some times after the last visible column ---> fill the temp array ... Do you think this could be possible? Regards, Otto
xBrowser How to display customers/city a kind of treeview
My personal advise is not to change FWH xBrowse code. Even if you change please do not change Paint method for handling values. Please try to manage it within our application code. I suggested some ways of doing it for dbf tables.
xBrowser How to display customers/city a kind of treeview
Hello NageswaraRao, I thought doing that you don't lose much speed because the array will only be a few records < 50 ?. Best regards, Otto
xBrowser How to display customers/city a kind of treeview
Otto, Here is an idea. Instead of using the CITY field in the browse use a function. Then use bSkip to pass the city field to the function. Inside the function you need a static var, cLastCity. Using this var return the city name of the current record only when it is not the same as cLastCity, otherwise just return nil or a space. The ideal way to do this is to create a customer class as a subclass from TData, then add a method to handle the above. Otherwise I would suggest using a static function. James
xBrowser How to display customers/city a kind of treeview
Otto, There is a problem with my idea above. I have used this for reports but with browses users can move backwards. This makes it more complicated. For each record movement, you would have to determine if you are at the first occurance of the city or not. So, you would have to skip in the appropriate direction (forward or back) one extra record to determine this, then skip back to the original record. It's more complicated, but I still think it could be done. James
xBrowser How to display customers/city a kind of treeview
Otto, Here is a working example using a customer class as a subclass of TData. I have also shown the city field so you can see it is working. This is not very efficient as it requires three disk reads to display each record. I think it could be done using static vars to eliminate the extra disk reads. [url=http&#58;//www&#46;freeimagehosting&#46;net/:36i8ay14][img:36i8ay14]http&#58;//img2&#46;freeimagehosting&#46;net/uploads/e9bb7036bb&#46;jpg[/img:36i8ay14][/url:36i8ay14] Here is the code: [code:36i8ay14]/* Purpose&#58; Display city name only on first occurance in a browse Date &#58; 12/23/2007 Author &#58; James Bott, jbott@compuserve&#46;com Note &#58; Requires TData class */ #include "fivewin&#46;ch" function main&#40;&#41; local oWnd, oLbx, oCustomer use customer exclusive index on upper&#40;city&#41; to cust2 use oCustomer&#58;= TCustomer&#40;&#41;&#58;new&#40;&#41; //oCustomer&#58;setOrder&#40;2&#41; oCustomer&#58;gotop&#40;&#41; define window oWnd title "Test City Group" @0,0 listbox oLbx fields oCustomer&#58;firstCity&#40;&#41;, oCustomer&#58;city, oCustomer&#58;last, oCustomer&#58;first; headers "City","City","Last","First"; sizes 100,100,100,100; alias oCustomer&#58;cAlias; of oWnd oLbx&#58;bSkip &#58;= &#123;| nRecs | oCustomer&#58;skipper&#40; nRecs &#41; &#125; oWnd&#58;oClient&#58;= oLbx activate window oWnd oCustomer&#58;end&#40;&#41; return nil //---------------------------------------------------------------------------// class TCustomer from TData method new method firstCity endclass //---------------------------------------------------------------------------// method new&#40;&#41; super&#40;&#41;&#58;new&#40;,"customer"&#41; &#58;&#58;use&#40;&#41; //&#58;&#58;addIndex&#40;"cust1"&#41; // primary key &#58;&#58;addIndex&#40;"cust2"&#41; // city &#58;&#58;gotop&#40;&#41; return self //---------------------------------------------------------------------------// method firstCity&#40;&#41; local cPrev,cCurrent cCurrent&#58;= &#58;&#58;city &#58;&#58;skip&#40;-1&#41; cPrev&#58;= &#58;&#58;city &#58;&#58;skip&#40;&#41; return if&#40; cCurrent = cPrev, "", cCurrent&#41; // end[/code:36i8ay14]
xBrowser How to display customers/city a kind of treeview
I have looked at this some more, and now I don't think you can do this without three record reads. You have to know what the city for the previous record is and you can't use static vars to keep track of this since you may be moving forward or backward in the browse. When I refer to the "previous" record I don't mean the last record read, but the record before the current record in the current order. So you have to do a skip(-1) to find this, then skip back to your original location. In a browse the user can skip forward or backward one or more records at a time, so there is no way to keep track of the "previous" record--you just have to read it. This means the browse will require three times the disk traffic as a browse without city groups. Only testing will tell if this is useable. Regards, James
xBrowser How to display customers/city a kind of treeview
Thats the reason I did not propose a similar approach. It it is a small table I would first scan and store recno's of the records to display. If it is large I would create an index like city + str(recno(),10,0) and set relation to the same table with prev rec. Then the condition is if main->city == child-city show blank else show city Or we can use a UDF. Degrades performance. function is something like func isRepeat local thisval := field->city local thisrec :=recno() local lsame := .f. dbskio(-1) lsame := ( !bof() .and. thisval == field->city) dbgoto(thisrec) return lsame
xBrowser How to display customers/city a kind of treeview
Nageswara, > If it is large I would create an index like city + str(recno(),10,0) and set relation to the same table with prev rec. Then the condition is if main->city == child-city show blank else show city. Wouldn't this also require multiple disk reads, one for the main table and one for child table? Perhaps this is only requires two reads instead of three? James
xBrowser How to display customers/city a kind of treeview
Yes, true. But lesser client server traffic. Reading related tables is faster than the program sending requests to read.
xBrowser How to display customers/city a kind of treeview
Finally I would consider this kind of requirements as issues where we need to find optimal solutions case by case. If it is small regular look up table, we better keep it in array than to keep reading everytime all the way from the server. For large tables this kind of display may not be necessary. In any case we should implement the best solution in each case than trying to find a common solution.
xBrowser MDI
Does a xBrowser work in a MDI window. Thanks in advance Otto
xBrowser MDI
Otto, Do you mean in the main MDI window or in the MDICHILD windows ?
xBrowser MDI
Antonio, in the MainMDI. Regards, Otto
xBrowser MDI
Otto, You have to understand how the MDI environment is designed by Microsoft and how it works. It is clearly explained in the FiveWin docs. There is a "invisible" window, child of the main MDI window, that controls the child windows. You can't place a control on top of that "invisible" or it will be managed as a MDI child too (cascaded, tiled, etc.) So the only solution is to resize the "invisible" window and free an area for the browse. This approach is implemented in fwh\samples\Test2003.prg
xBrowser MDI
Antonio, thank you for the explanation. Regards, Otto
xBrowser array add/del elements
Hello Antonio, How to prevent that after add a new element the header disappears. Regrads, Otto [quote:19lpsp05]Otto, Here you have samples\mallorca.prg modified with your requirements. Right click on it to show a popup menu: Code: # INCLUDE "FiveWin.ch" # INCLUDE "XBrowse.ch" //------------- FUNCTION Main() //------------- LOCAL oWnd,aLin:={},i,oBrw FOR i:=1 TO 6 AAdd(aLin,{i,'Descripción '+Str(i)}) NEXT DEFINE WINDOW oWnd //--Definición Objeto TxBrowse oBrw:=TxBrowse():New(oWnd) oBrw:SetArray(aLin) oBrw:nColDividerStyle := LINESTYLE_BLACK oBrw:nRowDividerStyle := LINESTYLE_BLACK oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL oBrw:aCols[1]:cHeader := 'Cod' oBrw:aCols[1]:cEditPicture := '@k 99' oBrw:aCols[1]:bClrEdit := oBrw:bClrStd oBrw:aCols[1]:bOnPostEdit := {|o,x| aLin[ oBrw:nArrayAt,1] := x } oBrw:aCols[1]:nEditType := EDIT_GET oBrw:aCols[1]:bEditValid := {|oGet| Valida( oGet ) } //<======== //-- oBrw:aCols[2]:cHeader := 'Descripción' oBrw:aCols[2]:bClrEdit := oBrw:bClrStd oBrw:aCols[2]:bOnPostEdit := {|o,x| aLin[ oBrw:nArrayAt,2] := x } oBrw:aCols[2]:nEditType := EDIT_GET //-- oBrw:CreateFromCode() oBrw:bRClicked = { | nRow, nCol | ShowPopup( nRow, nCol, oBrw, aLin ) } oWnd:oClient:=oBrw ACTIVATE WINDOW oWnd RETURN NIL //----------------------------------- STATIC FUNCTION Valida( oGet ) //----------------------------------- LOCAL lValRet:=.T. local bValid := oGet:bValid local nVal := oGet:Value() oGet:bValid = nil IF nVal>6 // MsgAlert('No puede ser mayor que 6') lValRet:=.f. ENDIF oGet:bValid = bValid RETURN lValRet function ShowPopup( nRow, nCol, oBrw, aLin ) local oMenu MENU oMenu POPUP MENUITEM "Add" ACTION ( AAdd( aLin, { AllTrim( Str( Len( aLin ) + 1 ) ), "New item" } ), oBrw:SetArray( aLin ), oBrw:Refresh() ) MENUITEM "Del" ACTION ( ADel( aLin, oBrw:nArrayAt ), ASize( aLin, Len( aLin ) - 1 ), oBrw:SetArray( aLin ), oBrw:Refresh() ) MENUITEM "Select" ACTION ( oBrw:GoTop(), oBrw:nArrayAt := 3, oBrw:Refresh() ) ENDMENU ACTIVATE POPUP oMenu WINDOW oBrw AT nRow, nCol return nil _________________ regards, saludos Antonio Linares <!-- w --><a class="postlink" href="http://www.fivetechsoft.com">www.fivetechsoft.com</a><!-- w -->[/quote:19lpsp05]
xBrowser array add/del elements
Mr Otto Do not use oBrw:SetArray after adding or deleting likes. Simply say Refresh
xBrowser array add/del elements
Hello Otto, I used that sample for a normal browse ( no Array ) You can find it at Topic => menu popup at.... [img:3jk3f2hl]http&#58;//www&#46;pflegeplus&#46;com/pictures/xbrowse2&#46;jpg[/img:3jk3f2hl] Regards uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> [/img]
xBrowser array add/del elements
Hello NageswaraRao, thank you very much for you help. All is working as suspected. Regards, Otto
xBrowser click
Hi guys good morning! I would like to know if it is possible to assign an action when clicking just once on a cell in the xBrowser, and another question is about the SetDlgGradient command, when dividing a screen as follows: SetDlgGradient( { { 0.9, CLR_WHITE, CLR_WHITE }, { 0.1 , CLR_BLACK, CLR_BLACK }, .F. } ) , the SAY commands placed on the screen remain the background color defined in SetDlgGradient, my question is, would it be possible to determine the background color of the SAY commands? Thank you in advance for your help. Oliveiros Junior
xBrowser click
Mira: [code=fw:9tpxnn5h]<div class="fw" id="{CB}" style="font-family: monospace;"><br />&nbsp;Pasta de c:\fwh1905\samples<br /><br /><span style="color: #000000;">08</span>/<span style="color: #000000;">03</span>/<span style="color: #000000;">2022</span> &nbsp;<span style="color: #000000;">18</span>:<span style="color: #000000;">53</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">3.830</span> XBROWED.PRG<br />&nbsp;</div>[/code:9tpxnn5h] Eu não entedi a dúvida nos SAYS? Você pode trocar a COR, inclusive em TEMPO REAL. Você tem um pequeno exemplo para testes? Obg. abs. Regards, saludos.
xBrowser click
Oi Karinha, obrigado pela resposta. O caso do SAY é o seguinte: Criei uma dialog e pintei com o comando SetDlgGradient( { { 0.9, CLR_WHITE, CLR_WHITE }, { 0.1 , CLR_BLACK, CLR_BLACK }, .F. } ), que é 9/10 branco e 1/10 negro. Dai coloquei uma imagem e escrevi sobre a imagem, com um SAY. Na parte branca, aparece com o fundo branco, independente da cor que eu coloque, e na parte negra, aparece o fundo negro, independente da cor colocada para o fundo. Att., Junior
xBrowser click
[quote="oliveiros junior":zipioy62]Oi Karinha, obrigado pela resposta. O caso do SAY é o seguinte: Criei uma dialog e pintei com o comando SetDlgGradient( { { 0.9, CLR_WHITE, CLR_WHITE }, { 0.1 , CLR_BLACK, CLR_BLACK }, .F. } ), que é 9/10 branco e 1/10 negro. Dai coloquei uma imagem e escrevi sobre a imagem, com um SAY. Na parte branca, aparece com o fundo branco, independente da cor que eu coloque, e na parte negra, aparece o fundo negro, independente da cor colocada para o fundo. Att., Junior[/quote:zipioy62] Faça um TESTE, retire o SetDlgGradient e use o GRADIENT aGrad direto no DEFINE DIALOG... Diga o que ocorre. Obg. abs. Regards, saludos.
xBrowser click
Oliveiros, Salvo engano, [code=fw:1td0y52c]<div class="fw" id="{CB}" style="font-family: monospace;"><br />SetDlgGradient<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">0.9</span>, CLR_WHITE, CLR_WHITE <span style="color: #000000;">&#125;</span>, <span style="color: #000000;">&#123;</span> <span style="color: #000000;">0.1</span> , CLR_BLACK, CLR_BLACK <span style="color: #000000;">&#125;</span>, .F. <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:1td0y52c] Isto está errado. Regards, saludos.
xBrowser click
Oliveiros, Que tal? [code=fw:19h283pr]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// C:\FWH..\SAMPLES\CAMILO.PRG</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #00D7D7;">#Define</span> CLR_ORANGE &nbsp; &nbsp; nRGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">165</span>, <span style="color: #000000;">000</span> <span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">//-> Orange - Laranja</span><br /><span style="color: #00D7D7;">#Define</span> CLR_SOFTYELLOW nRGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">251</span>, <span style="color: #000000;">225</span> <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> oDlg, oGroup, oSalida, oFont, oSkinB, aGrad<br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> lFivePro &nbsp;:= .T.<br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> lDialog &nbsp; := .T.<br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> lObjects &nbsp;:= .F.<br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> oRadMenu &nbsp;:= <span style="color: #000000;">1</span><br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> cName &nbsp; &nbsp; := SPACE<span style="color: #000000;">&#40;</span> <span style="color: #000000;">10</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> cAddress &nbsp;:= SPACE<span style="color: #000000;">&#40;</span> <span style="color: #000000;">30</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> oBtn, oGet1, oGet2<br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> nColor &nbsp; &nbsp;:= <span style="color: #000000;">1</span><br /><br />&nbsp; &nbsp;oSkinB = TSkinButton<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;oSkinB:<span style="color: #000000;">nClrBorder0_N</span> := RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">249</span>, <span style="color: #000000;">194</span>, <span style="color: #000000;">179</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oSkinB:<span style="color: #000000;">nClrBorder1_N</span> := RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">181</span>, <span style="color: #000000;">61</span>, <span style="color: #000000;">29</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oSkinB:<span style="color: #000000;">aClrNormal</span> &nbsp; &nbsp;:= <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">0.2</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">000</span>, <span style="color: #000000;">128</span>, <span style="color: #000000;">000</span> <span style="color: #000000;">&#41;</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">000</span>, <span style="color: #000000;">128</span>, <span style="color: #000000;">000</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span> <span style="color: #000000;">0.8</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">109</span>, <span style="color: #000000;">135</span>, <span style="color: #000000;">100</span> <span style="color: #000000;">&#41;</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">109</span>, <span style="color: #000000;">135</span>, <span style="color: #000000;">100</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp;SkinButtons<span style="color: #000000;">&#40;</span> oSkinB <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;SetGetColorFocus<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;tGet<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">lDisColors</span> &nbsp;:= .F.<br />&nbsp; &nbsp;tGet<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">nClrTextDis</span> := CLR_HBLUE<br />&nbsp; &nbsp;tGet<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">nClrPaneDis</span> := CLR_WHITE<br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// aGrad := { { 1, CLR_WHITE, CLR_HCYAN &nbsp;} }</span><br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// aGrad := ( { { 0.9, CLR_WHITE, CLR_BLACK }, { 0.1 , CLR_WHITE, CLR_BLACK }, .F. } )</span><br />&nbsp; &nbsp;aGrad := <span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">0.5</span>, CLR_WHITE, CLR_BLACK <span style="color: #000000;">&#125;</span>, <span style="color: #000000;">&#123;</span> <span style="color: #000000;">0.5</span> , CLR_WHITE, CLR_BLACK <span style="color: #000000;">&#125;</span>, .F. <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont &nbsp;<span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"Ms Sans Serif"</span> &nbsp;<span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">00</span>, <span style="color: #000000;">-14</span> BOLD<br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">8</span>, <span style="color: #000000;">2</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">25</span>, <span style="color: #000000;">50</span> <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Group Color by Camilo"</span> &nbsp; &nbsp; &nbsp;;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">FONT</span> oFont GRADIENT aGrad<br /><br />&nbsp; &nbsp;oDlg:<span style="color: #000000;">lHelpIcon</span> := .F.<br /><br />&nbsp; &nbsp;@ <span style="color: #000000;">1</span>, &nbsp;<span style="color: #000000;">1</span> <span style="color: #0000ff;">SAY</span> <span style="color: #ff0000;">"&Name:"</span> <span style="color: #0000ff;">OF</span> oDlg COLORS CLR_CYAN, CLR_WHITE TRANSPARENT <span style="color: #0000ff;">UPDATE</span><br /><br />&nbsp; &nbsp;@ <span style="color: #000000;">1</span>, &nbsp;<span style="color: #000000;">6</span> <span style="color: #0000ff;">GET</span> oGet1 <span style="color: #0000ff;">VAR</span> cName <span style="color: #0000ff;">OF</span> oDlg COLORS CLR_BLACK, CLR_WHITE <span style="color: #0000ff;">UPDATE</span><br /><br />&nbsp; &nbsp;@ <span style="color: #000000;">2</span>, &nbsp;<span style="color: #000000;">1</span> <span style="color: #0000ff;">SAY</span> <span style="color: #ff0000;">"&Address:"</span> <span style="color: #0000ff;">OF</span> oDlg COLORS CLR_CYAN, CLR_WHITE TRANSPARENT &nbsp; &nbsp;;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">UPDATE</span><br /><br />&nbsp; &nbsp;@ <span style="color: #000000;">2</span>, &nbsp;<span style="color: #000000;">6</span> <span style="color: #0000ff;">GET</span> oGet2 <span style="color: #0000ff;">VAR</span> cAddress <span style="color: #0000ff;">OF</span> oDlg COLORS CLR_BLACK, CLR_WHITE <span style="color: #0000ff;">UPDATE</span><br /><br />&nbsp; &nbsp;@ <span style="color: #000000;">3</span>, &nbsp;<span style="color: #000000;">9</span> GROUP oGroup <span style="color: #0000ff;">TO</span> <span style="color: #000000;">7</span>, <span style="color: #000000;">20</span> LABEL <span style="color: #ff0000;">"Group Color"</span> <span style="color: #0000ff;">OF</span> oDlg &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">COLOR</span> CLR_ORANGE, CLR_WHITE TRANSPARENT<br /><br />&nbsp; &nbsp;@ <span style="color: #000000;">4</span>, &nbsp;<span style="color: #000000;">9</span> <span style="color: #0000ff;">RADIO</span> oRadMenu <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"&Novice"</span>, <span style="color: #ff0000;">"A&vanced"</span>, <span style="color: #ff0000;">"&Expert"</span> <span style="color: #0000ff;">OF</span> oDlg<br /><br />&nbsp; &nbsp;@ <span style="color: #000000;">6</span>, &nbsp;<span style="color: #000000;">5</span> <span style="color: #0000ff;">BUTTON</span> oBtn <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"&Color"</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">50</span>, <span style="color: #000000;">12</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ACTION</span> SET_COLOR<span style="color: #000000;">&#40;</span> oGroup, nColor <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;oBtn:<span style="color: #000000;">cToolTip</span> := <span style="color: #ff0000;">"Cambiar Color del Group"</span><br /><br />&nbsp; &nbsp;@ <span style="color: #000000;">6</span>, <span style="color: #000000;">17</span> <span style="color: #0000ff;">BUTTON</span> oSalida <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"&Salida"</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">50</span>, <span style="color: #000000;">12</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ACTION</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> CANCEL<br /><br />&nbsp; &nbsp;oSalida:<span style="color: #000000;">cToolTip</span> := <span style="color: #ff0000;">"salida - Exit - Cancelar"</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span><span style="color: #000000;">&#40;</span> CTRLS_COLORS<span style="color: #000000;">&#40;</span> oDlg <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;oFont:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #00C800;">FUNCTION</span> SET_COLOR<span style="color: #000000;">&#40;</span> oGroup, nColor <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> oIni, oBrush, oBmp<br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> nTipo, cStyle, cFile, cLogo, nRow, nCol, lSelect<br /><br />&nbsp; &nbsp;nColor := ChooseColor<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;oGroup:<span style="color: #000000;">SetColor</span><span style="color: #000000;">&#40;</span> nColor, CLR_WHITE <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oGroup:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">&#40;</span> nColor <span style="color: #000000;">&#41;</span><br /><span style="color: #B900B9;">// By Giovanny Vecchi</span><br /><span style="color: #00C800;">FUNCTION</span> CTRLS_COLORS<span style="color: #000000;">&#40;</span> f_oDlgContainer <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> lc_aCtrls := <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span>, lc_iFor := <span style="color: #000000;">0</span><br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> lc_aItemsRadio := <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp;lc_aCtrls := f_oDlgContainer:<span style="color: #000000;">aControls</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">FOR</span> lc_iFor := <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> Len<span style="color: #000000;">&#40;</span> lc_aCtrls <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">IF</span> ValType<span style="color: #000000;">&#40;</span> lc_aCtrls<span style="color: #000000;">&#91;</span>lc_iFor<span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">"O"</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">IF</span> lc_aCtrls<span style="color: #000000;">&#91;</span>lc_iFor<span style="color: #000000;">&#93;</span>:<span style="color: #000000;">ClassName</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">"TRADIO"</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aEval<span style="color: #000000;">&#40;</span> lc_aCtrls<span style="color: #000000;">&#91;</span>lc_iFor<span style="color: #000000;">&#93;</span>:<span style="color: #000000;">oRadMenu</span>:<span style="color: #000000;">aItems</span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span>|_oRadId|<span style="color: #000000;">&#123;</span> SetWindowTheme<span style="color: #000000;">&#40;</span> _oRadId:<span style="color: #000000;">hWnd</span>, <span style="color: #ff0000;">""</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">&#41;</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;_oRadId:<span style="color: #000000;">SetColor</span><span style="color: #000000;">&#40;</span> CLR_CYAN, CLR_WHITE <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ELSEIF lc_aCtrls<span style="color: #000000;">&#91;</span>lc_iFor<span style="color: #000000;">&#93;</span>:<span style="color: #000000;">ClassName</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">"TCHECKBOX"</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">// SetWindowTheme( lc_aCtrls[lc_iFor]:hWnd, "", "" )</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">// lc_aCtrls[lc_iFor]:SetColor( G_COLOR_SYS( 31 ), G_COLOR_SYS( 1 ) )</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">ENDIF</span><br /><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">ENDIF</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">NEXT</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #B900B9;">// FIN -> <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e --></span><br />&nbsp;</div>[/code:19h283pr] Regards, saludos.
xBrowser click
// .T. TRUE, divide o GRADIENT ao meio, gostei. hahaha. [code=fw:112yspfi]<div class="fw" id="{CB}" style="font-family: monospace;"><br />&nbsp; &nbsp;aGrad := <span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">0.5</span>, CLR_WHITE, CLR_BLACK <span style="color: #000000;">&#125;</span>, <span style="color: #000000;">&#123;</span> <span style="color: #000000;">0.5</span> , CLR_WHITE, CLR_BLACK <span style="color: #000000;">&#125;</span>, .T. <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:112yspfi] Regrads, saludos.
xBrowser click
Oi Karinha, Quanto ao SetDlgGradient( { { 0.9, CLR_WHITE, CLR_WHITE }, { 0.1 , CLR_BLACK, CLR_BLACK }, .F. } ), ele funciona, mister RAO quem orientou. Obrigado quanto a sua proposta. Vou experimentar e retorno. Att., Oliveiros Junior
xBrowser click
[quote:33tn7g2m]I would like to know if it is possible to assign an action when clicking just once on a cell in the xBrowser,[/quote:33tn7g2m] You can assign an action to code-block: [code=fw:33tn7g2m]<div class="fw" id="{CB}" style="font-family: monospace;">oBrw:<span style="color: #000000;">bLClicked</span> := <span style="color: #000000;">&#123;</span> |row,col,flags,brw| youraction<span style="color: #000000;">&#40;</span> ... <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span></div>[/code:33tn7g2m] The default behavior of XBrowse is that single left click on a cell navigates to that cell. We feel assigning a different action to single left click may be inconsistent with normal behaviour and confusing to users. Instead better to use right-click or double-click. Anyway, the decision is yours. [quote:33tn7g2m]another question is about the SetDlgGradient command, when dividing a screen as follows: SetDlgGradient( { { 0.9, CLR_WHITE, CLR_WHITE }, { 0.1 , CLR_BLACK, CLR_BLACK }, .F. } ) , the SAY commands placed on the screen remain the background color defined in SetDlgGradient, my question is, would it be possible to determine the background color of the SAY commands?[/quote:33tn7g2m] Whatever background you have for the dialog, if you define a Say with COLOR clause. eg: [code=fw:33tn7g2m]<div class="fw" id="{CB}" style="font-family: monospace;">@ r,c <span style="color: #0000ff;">SAY</span> .... <span style="color: #0000ff;">COLOR</span> nClrText, nClrBack</div>[/code:33tn7g2m] 1) if the Dialog is not transparent, the say is displayed with its own back color. 2) if the Dialog is transparent, the say is displayed transparently, i.e., back color of the say is not painted.
xBrowser click
Mr Rao, does it only work over the line? Thanks Oliveiros Junior
xBrowser click
[quote:1w91rgzd]Mr Rao, does it only work over the line?[/quote:1w91rgzd] I do not understand your question.
xBrowser click
Oliveiros, seria algo assim? Sempre que possível, post o .PRG, ok? [url:2cb6cddy]https&#58;//forums&#46;fivetechsupport&#46;com/~fivetec1/forums/viewtopic&#46;php?f=3&t=37318&start=0[/url:2cb6cddy] Regards, saludos.
xBrowser click
Olá João, É bem simples, o Senhor Rao respondeu em parte (clique sobre a linha). Porém o que eu necessito é tratar cada célula da xBrowser como se fosse um botão. Dar um simples click sobre ela e ela executar uma ação. Att., Oliveiros Junior
xBrowser click
Mira se ayuda: Veja se ajuda: [url:34taujon]https&#58;//forums&#46;fivetechsupport&#46;com/viewtopic&#46;php?f=6&t=43670&start=0&hilit=oBrw%3AbKeyDown&sid=fd2ef8c5ac4dcb61626a3a35e623d2be[/url:34taujon] Regards, saludos.
xBrowser click
Mr Rao, I need to treat each xBrowser cell as if it were a button. Simply click on it and it will perform an action. The bLClicked command, it seems, treats the entire line. Att., Oliveiros Junior
xBrowser click
[code=fw:34asibrt]<div class="fw" id="{CB}" style="font-family: monospace;"> &nbsp; XBROWSER <span style="color: #ff0000;">"STATES.DBF"</span> SETUP <span style="color: #000000;">&#40;</span> ;<br />&nbsp; &nbsp; &nbsp; oBrw:<span style="color: #000000;">bLClicked</span> := <span style="color: #000000;">&#123;</span> |r,c,f,o| <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> o:<span style="color: #000000;">SelectedCol</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Value</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:34asibrt]
xBrowser click
Thanks Mr Rao. It was just what I needed. Att., Oliveiros Junior
xBrowser height row
Is it posible to have different heights on diverse rows of the xBrowser. [img:dnb0hxuu]http&#58;//www&#46;atzwanger&#46;com/fw/invoice&#46;jpg[/img:dnb0hxuu]
xBrowser height row
Otto, This feature I long time eager ! so to report() This must add a codes to detect max columns text height . Xbrowse now uses DrawTextEx() to paint cell/column text, must input the fixed height and width. Regards! Shuming Wang
xBrowser power
Diffrent fonts per row! [img:3ueg38e8]http&#58;//www&#46;atzwanger&#46;com/fw/xbrwFonts&#46;jpg[/img:3ueg38e8]
xBrowser power
Mr Otto Great Job Do you mind sharing how you have done it ? I am also looking for another feature. Conditionally paint or not to paint row divider lines for a particular column. Have you thought about it ?
xBrowser power
The result is great – the job not so great, because I did some hard coding. NageswaraRao, you have the skill to code this into a codeblock. I send you the chances with email. Best regards, Otto
xBrowser power
ok please send me i am struggling with optional row line painting. it is not working for me
xBrowser power
For "treeview" look it would be very important. Regards, Otto
xBrowser resize
How to resize a xBrowser if I the window is resized I tried: ACTIVATE WINDOW oWnd ON RESIZE ( oBrw:nRight := oWnd:nWidth() - 17,; oBrw:nBottom := oWnd:nHeight()- 100 ) but didn't work. Thanks in advance Otto
xBrowser resize
Try using oBrw:Move() method. EMG
xBrowser resize
Thank you for your help, Enrico. //oBrw:Move( nTop, nLeft, nWidth, nHeight, lRepaint ) works!
xBrowser syntax
Dear Mr. Rao, I would like to use xBrowser like this but I don’t remember where to find the right syntax. XBROWSER cAlias TITLE "RAO-Notes Archiv" ; SETUP ( oBrw:cFields := {'IP','Absender','Status','Text','Termin','Zeit'}) Would you be so kind to helo me. Thanks in advance Otto
xBrowser syntax
You can refer to the command in \fwh\include\xbrowse.ch whenever you are in doubt. I reproduce it here. #xcommand XBROWSER [<uData>] ; [ TITLE <cTitle> ] ; [ <autosort:AUTOSORT> ] ; [ SETUP <fnSetUp> ] ; [ COLUMNS <aCols,...> ] ; [ SELECT <fnSelect> ] ; [ <fastedit: FASTEDIT> ]; [ VALID <uValid> ] ; Most clauses are self explanatrory. I clarify here some clauses: examples: #1 COLUMNS "First", "Last", "Age", "Salary" or COLUMNS { "first", "Age", "Salary" ... } or COLUMNS aColNames #2. SETUP fnMySetUp( oBrw ) // optional within this function you can use oBrw parameter and can set any more actions #3SELECT ( uSelValue := oBrw:aCols[ 1 ]:Value ) If SELECT clause is used, the dialog shows two buttons <select> and <cancel>. If the user presses select button ( or presses enter or double clicks ) the SELECT function is called. #4. FASTEDIT. This sets fastedit mode and enables all cells to be editable. [code=fw:1el8z9ja]<div class="fw" id="{CB}" style="font-family: monospace;">XBROWSER cAlias <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"RAO-Notes Archiv"</span> ;<br />COLUMNS <span style="color: #ff0000;">'IP'</span>,<span style="color: #ff0000;">'Absender'</span>,<span style="color: #ff0000;">'Status'</span>,<span style="color: #ff0000;">'Text'</span>,<span style="color: #ff0000;">'Termin'</span>,<span style="color: #ff0000;">'Zeit'</span></div>[/code:1el8z9ja]
xBrowser y xHarbour
Colegas, si bien ya no uso xHarbour para mis proyectos, actualicé una aplicación que tenía hecho en ese compilador por la versión FWH 20.02, cuando quiero invocar a xBrowser me genera un error, cosa que con Harbour no ocurre. ¿Cuál puede ser la causa de este error?. Desde ya muchas gracias. Saludos
xBrowser y xHarbour
Hice un pequeño programa en xHarbour y xBrowser funciona. En el programa que comenté mas arriba no me reconoce el comando xBrowser. Total desconcierto. Alguna idea? Muchas gracias Saludos
xBrowser y xHarbour
Que error te genera?
xBrowser y xHarbour
Hola, no me reconoce el comando. Estoy usando para las tablas wBrowse. Será alguna incompatibilidad entre estas dos clases? Saludos
xBrowser y xHarbour
Ahh... si, eso puede ser!
xBrowser y xHarbour
There is no incompatibility between XBrowse and WBrowse. In very very old versions of FWH, we need to specifically include "xbrowse.ch" Eg: [code=fw:10ii2so4]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"xbrowse.ch"</span></div>[/code:10ii2so4] XBrowse behaves exactly the same way with both Harbour and xHarbour
xBrowser y xHarbour
Gracias Rao por responder, no funciona la clase xbrowse. He adjuntado la clase al proyecto, he incluido el archivo xbrowse.ch y me da error. No hay manera que funcione. Alguna sugerencia? Saludos
xBrowser y xHarbour
What was the previous version you were using?
xBrowser y xHarbour
La versión anterior es xHB build 0.99.60 (SimpLex) & BCC 5.5.1 & FW 2.7 December 2005.
xBrowser – equivalent for listbox oLbx:GetPos()
Could someone tell me what the equivalent for the listbox syntax oLbx:GetPos() for xBrowser is? Thanks in advance Otto
xBrowser – equivalent for listbox oLbx:GetPos()
Otto, if I'm not wrong: oBrowse:nRowSel ==> current row selected oBrowse:nColSel ==> current col selected Regards, Maurilio
xBrowser – equivalent for listbox oLbx:GetPos()
Thank you. Otto
xBrowser: How to repaint the header
If I change nHeadBmpNo how do I repaint the header? oCol:bLClickHeader := {|r,c,f,o| IIF( oCol:nHeadBmpNo = 2, oCol:nHeadBmpNo := 1 ,oCol:nHeadBmpNo := 2 ) )) } PaintHeader?? Thanks in advance Otto
xBrowser: How to repaint the header
for nFor := 1 TO 4 obrow:aCols[nFor]:AddBmpHandle( obrow:hBmpSortAsc ) obrow:aCols[nFor]:AddBmpHandle( obrow:hBmpSortdes ) obrow:aCols[nFor]:nHeadBmpAlign := AL_RIGHT if nfor>1;obrow:aCols[nFor]:nHeadBmpNo := -1; end obrow:aCols[nFor]:bLClickHeader := {|r,c,f,o| SortSal1( o ) } next FUNCTION SortSal1(oCol) local aCols,cOrder,nFor,nLen aCols := oCol:oBrw:aCols cOrder := oCol:cOrder nAt := oCol:nCreationOrder nLen := LEN(aCols) for nFor := 1 to nLen aCols[ nFor ]:nHeadBmpNo := 0 aCols[ nFor ]:cOrder := "" next if cOrder == "" .or. cOrder == "D" // aData := Asort( aData,,, {|x,y| x[ nAt ] < y[ nAt ] } ) do case case nAt==1 odb1:cQuery:="select * from custm1 "+if(len(ofcomid)>0,"where comid='"+ofcomid+"'","")+" order by custid" odb1:refresh() obrow:bseek:={|v|odb1:SEEK(v,,"odb1:custid")} case nAt==2 odb1:cQuery:="select * from custm1 "+if(len(ofcomid)>0,"where comid='"+ofcomid+"'","")+" order by custm" odb1:refresh() obrow:bseek:={|v|odb1:SEEK(v,,"odb1:custm")} case nAt==3 odb1:cQuery:="select * from custm1 "+if(len(ofcomid)>0,"where comid='"+ofcomid+"'","")+" order by sales" odb1:refresh() obrow:bseek:={|v|odb1:SEEK(v,,"odb1:sales")} case nAt==4 odb1:cQuery:="select * from custm1 "+if(len(ofcomid)>0,"where comid='"+ofcomid+"'","")+" order by addrc" odb1:refresh() obrow:bseek:={|v|odb1:SEEK(v,,"odb1:addrc")} endcase oCol:cOrder := "A" oCol:nHeadBmpNo := 1 else // aData := Asort( aData,,, {|x,y| x[ nAt ] > y[ nAt ] } ) do case case nAt==1 odb1:cQuery:="select * from custm1 "+if(len(ofcomid)>0,"where comid='"+ofcomid+"'","")+" order by custid DESC" odb1:refresh() obrow:bseek:={|v|odb1:SEEK(v,,"odb1:custid")} case nAt==2 odb1:cQuery:="select * from custm1 "+if(len(ofcomid)>0,"where comid='"+ofcomid+"'","")+" order by custm DESC" odb1:refresh() obrow:bseek:={|v|odb1:SEEK(v,,"odb1:custm")} case nAt==3 odb1:cQuery:="select * from custm1 "+if(len(ofcomid)>0,"where comid='"+ofcomid+"'","")+" order by sales DESC" odb1:refresh() obrow:bseek:={|v|odb1:SEEK(v,,"odb1:sales")} case nAt==4 odb1:cQuery:="select * from custm1 "+if(len(ofcomid)>0,"where comid='"+ofcomid+"'","")+" order by addrc DESC" odb1:refresh() obrow:bseek:={|v|odb1:SEEK(v,,"odb1:addrc")} endcase oCol:cOrder := "D" oCol:nHeadBmpNo := 2 endif oCol:oBrw:Refresh() return Regards Shuming Wang
xBrowser: How to repaint the header
Thank you for your help. The line oCol:oxBrw:Refresh() causes an error. I don't find out what is wrong. Regards, Otto Error description: Error BASE/1004 Message not found: TXBRWCOLUMN:OXBRW Args: [ 1] = O Object Stack Calls =========== Called from: => __ERRRT_SBASE(0) Called from: => TXBRWCOLUMN:ERROR(172) Called from: source\rtl\tobject.prg => (b)HBOBJECT(103) Called from: => TXBRWCOLUMN:MSGNOTFOUND(0) Called from: => TXBRWCOLUMN:OXBRW(162)
xBrowser: How to repaint the header
Otto, Try: oCol:oBrw:Refresh()
xBrowser: How to repaint the header
Hello Antonio, thank you. I see the msgInfo correctly but the changes of the bmp are not visible. oCol:AddBmpHandle( FwBmpAsc() ) oCol:AddBmpHandle( FwBmpDes() ) oCol:nHeadBmpNo := 1 oCol:bLClickHeader := {|r,c,f,o| IIF( oCol:nHeadBmpNo = 2, (oCol:nHeadBmpNo := 1 ,msginfo(1)),(oCol:nHeadBmpNo := 2,msginfo(2) )),oCol:oBrw:Refresh(),msginfo("test") } Could you please extend the testxbrw.prg to show how oCol:nHeadBmpNo = should be used. Suggestion: I would comment for the standard sample ADS out - for a beginner the error this causes is no so easy to find out. You should also reindex customer automatically. Otherwise the incremental search gives an error. Regards, Otto
xBrowser: How to repaint the header
Otto, You may use: METHOD PaintHeader( nRow, nCol, nHeight, lInvert, hDC ) CLASS TXBrwColumn
xBrowser: How to repaint the header
METHOD PaintHeader( nRow, nCol, nHeight, lInvert, hDC ) CLASS TXBrwColumn Isn't this called by HeaderLButtonDown? METHOD HeaderLButtonDown( nMRow, nMCol, nFlags ) CLASS TXBrwColumn if ::oBrw:nCaptured == 0 .and. ::oBrw:lAllowColSwapping ::oBrw:oCapCol := Self ::oBrw:nCaptured := 1 ::oBrw:Capture() ::PaintHeader( 2, nil, ::oBrw:nHeaderHeight - 3, .t. ) endif return nil METHOD PaintHeader( nRow, nCol, nHeight, lInvert, hDC ) CLASS TXBrwColumn
xBrowser: How to repaint the header
Otto, > Isn't this called by HeaderLButtonDown? Yes
xBrowser: How to repaint the header
But the header does not change. [img:1mtklpmb]http&#58;//www&#46;atzwanger&#46;com/fw/header1&#46;jpg[/img:1mtklpmb] [img:1mtklpmb]http&#58;//www&#46;atzwanger&#46;com/fw/header2&#46;jpg[/img:1mtklpmb]
xBrowser: How to repaint the header
Otto, In samples\TestXBrw.prg, STATIC FUNCTION Bitmaps( oWnd ): oCol := oBrw:AddCol() oCol:AddResource( "CLIP" ) oCol:AddResource( "star" ) oCol:bLClickHeader = { | nMRow, nMCol, nFlags, Self | If( ::nHeadBmpNo == 2, ::nHeadBmpNo := 1, ::nHeadBmpNo := 2 ), ::oBrw:Refresh() } And add this to TestXBrw.rc: STAR BITMAP "../bitmaps/16x16/favorite.bmp"
xBrowser: How to repaint the header
I did it this way. But the header does not change. Regards, Otto STATIC FUNCTION Bitmaps( oWnd ) local oChild, oBrw, oCol, oFont local nFor DEFINE FONT oFont NAME "Arial" SIZE 0, -8 BOLD DEFINE WINDOW oChild TITLE "Bitmaps on browse and bold font on first column" MDICHILD OF oWnd oBrw := TXBrowse():New( oWnd ) oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL oBrw:nColDividerStyle := LINESTYLE_BLACK oBrw:nRowDividerStyle := LINESTYLE_BLACK oBrw:lColDividerComplete := .t. oCol := oBrw:AddCol() oCol:AddResource( "CLIP" ) oCol:AddResource( "star" ) oCol:bLClickHeader = { | nMRow, nMCol, nFlags, Self | If( ::nHeadBmpNo == 2, ::nHeadBmpNo := 1, ::nHeadBmpNo := 2 ), ::oBrw:Refresh() } oCol := oBrw:AddCol() oCol:AddResource("CLIP") oCol:cHeader := "CLIP" oCol:nHeadBmpNo := 1 oCol:nHeadBmpAlign := AL_RIGHT oCol := oBrw:AddCol() oCol:bStrData := { || _FIELD->First} oCol:cHeader := "First" oCol:oDataFont := oFont oCol := oBrw:AddCol() oCol:bStrData := { || _FIELD->Last} oCol:cHeader := "Last" oCol := oBrw:AddCol() oCol:AddResource("GREEN") oCol:AddResource("RED") oCol:cHeader := "Married" oCol:bBmpData := { || iif( _FIELD->Married, 1, 2) } oCol:bStrData := { || iif( _FIELD->Married, "Yes", "No ")} oCol:bEditValue := { || _FIELD->Married } oCol:nDataStyle := oCol:DefStyle( AL_RIGHT, .T.) oCol:nEditType := EDIT_LISTBOX oCol:aEditListTxt := { "Yes", "No"} oCol:aEditListBound := { .t., .f. } oCol:bOnPostEdit := {|o, v| _FIELD->Married := v } oBrw:SetRDD() oBrw:CreateFromCode() oChild:oClient := oBrw ACTIVATE WINDOW oChild ON INIT oBrw:SetFocus() oFont:End() RETURN NIL
xBrowser: How to repaint the header
Otto, Click on the column to see the bitmap change, and don't forget to modify the RC file [code:pql1ahpo] STATIC FUNCTION Bitmaps&#40; oWnd &#41; local oChild, oBrw, oCol, oFont local nFor DEFINE FONT oFont NAME "Arial" SIZE 0, -8 BOLD DEFINE WINDOW oChild TITLE "Bitmaps on browse and bold font on first column" MDICHILD OF oWnd oBrw &#58;= TXBrowse&#40;&#41;&#58;New&#40; oWnd &#41; oBrw&#58;nMarqueeStyle &#58;= MARQSTYLE_HIGHLCELL oBrw&#58;nColDividerStyle &#58;= LINESTYLE_BLACK oBrw&#58;nRowDividerStyle &#58;= LINESTYLE_BLACK oBrw&#58;lColDividerComplete &#58;= &#46;t&#46; oCol &#58;= oBrw&#58;AddCol&#40;&#41; oCol&#58;AddResource&#40; "CLIP" &#41; oCol&#58;AddResource&#40; "star" &#41; oCol&#58;bLClickHeader = &#123; | nMRow, nMCol, nFlags, Self | If&#40; &#58;&#58;nHeadBmpNo == 2, &#58;&#58;nHeadBmpNo &#58;= 1, &#58;&#58;nHeadBmpNo &#58;= 2 &#41;, &#58;&#58;oBrw&#58;Refresh&#40;&#41; &#125; oCol&#58;cHeader &#58;= "CLIP" oCol&#58;nHeadBmpNo &#58;= 1 oCol&#58;nHeadBmpAlign &#58;= AL_RIGHT oCol &#58;= oBrw&#58;AddCol&#40;&#41; oCol&#58;bStrData &#58;= &#123; || _FIELD->First&#125; oCol&#58;cHeader &#58;= "First" oCol&#58;oDataFont &#58;= oFont oCol &#58;= oBrw&#58;AddCol&#40;&#41; oCol&#58;bStrData &#58;= &#123; || _FIELD->Last&#125; oCol&#58;cHeader &#58;= "Last" oCol &#58;= oBrw&#58;AddCol&#40;&#41; oCol&#58;AddResource&#40;"GREEN"&#41; oCol&#58;AddResource&#40;"RED"&#41; oCol&#58;cHeader &#58;= "Married" oCol&#58;bBmpData &#58;= &#123; || iif&#40; _FIELD->Married, 1, 2&#41; &#125; oCol&#58;bStrData &#58;= &#123; || iif&#40; _FIELD->Married, "Yes", "No "&#41;&#125; oCol&#58;bEditValue &#58;= &#123; || _FIELD->Married &#125; oCol&#58;nDataStyle &#58;= oCol&#58;DefStyle&#40; AL_RIGHT, &#46;T&#46;&#41; oCol&#58;nEditType &#58;= EDIT_LISTBOX oCol&#58;aEditListTxt &#58;= &#123; "Yes", "No"&#125; oCol&#58;aEditListBound &#58;= &#123; &#46;t&#46;, &#46;f&#46; &#125; oCol&#58;bOnPostEdit &#58;= &#123;|o, v| _FIELD->Married &#58;= v &#125; oBrw&#58;SetRDD&#40;&#41; oBrw&#58;CreateFromCode&#40;&#41; oChild&#58;oClient &#58;= oBrw ACTIVATE WINDOW oChild ON INIT oBrw&#58;SetFocus&#40;&#41; oFont&#58;End&#40;&#41; RETURN NIL [/code:pql1ahpo]
xBrowser: How to repaint the header
Antonio, thank you. Now the bmp changes. Best regards, Otto
xBrowser: Is it possible to change alignment on the fly?
nDataStrAlign := AL_RIGHT Is it possible to change alignment on the fly? Thanks in advance Otto
xBrowser: Is it possible to change alignment on the fly?
Otto, Have you tried to change it and refresh the browse ?
xBrowser: Is it possible to change alignment on the fly?
Thank you. Yes I tried with refresh(). Here is my code: func f_DataStrAlign(r,c,f,o) oBrw:nRowDividerStyle := 0 // I put this to proof that refresh is working oBrw:aCols[ o:nPos ]:nDataStrAlign := AL_RIGHT oBrw:refresh() return nil The text does not move. Regards, Otto
xBrowser: Is it possible to change alignment on the fly?
Otto, Try it this way: oCol = oBrw:aCols[ o:nPos ] oCol:nDataStrAlign := AL_RIGHT oCol:nDataStyle := oCol:DefStyle( oCol:nDataStrAlign, ( oCol:oBrw:nDataLines == 1 ) )
xBrowser: Is it possible to change alignment on the fly?
Alignment changes but Al_right is not displayed well. See screen: [img:1t9ig0cv]http&#58;//www&#46;atzwanger&#46;com/fw/align&#46;jpg[/img:1t9ig0cv]
xBrowser: Is it possible to change alignment on the fly?
Try to RTrim() the column data. EMG
xBrowser: Is it possible to change alignment on the fly?
Working perfectly
xBrowser: Is it possible to change alignment on the fly?
[code:19qyst64] METHOD DataAlign&#40; nAlign &#41; CLASS TXBrwColumn if ! &#40; &#58;&#58;nDataStrAlign == nAlign &#41; // tolerate nil param &#58;&#58;nDataStrAlign &#58;= AL_RIGHT &#58;&#58;nDataStyle &#58;= &#58;&#58;DefStyle&#40; &#58;&#58;nDataStrAlign, &#40; &#58;&#58;oBrw&#58;nDataLines == 1 &#41; &#41; endif RETURN &#58;&#58;nDataStrAlign [/code:19qyst64]
xBrowser: Is it possible to change alignment on the fly?
Thank you Enrico. I changed it in METHOD PaintData: if ::bStrData != nil cData := RTRIM( Eval( ::bStrData, Self )) else cData := "" endif [img:379sqhe0]http&#58;//www&#46;atzwanger&#46;com/fw/alignright&#46;jpg[/img:379sqhe0]
xBrowser: Is it possible to change alignment on the fly?
To nageswaragunupudi: If I insert the method DataAlign I get all centered. Regaqrds, Otto
xBrowser: Is it possible to change alignment on the fly?
Mr Otto Obviously the values should be rtimmed for right justification. My proposed method is only for changing justification on the fly. If you change the paint method you may like to cover the cases of left, center and riight justifcations and all other possibilities. For non left justified painting probably alltrim(,,,) may be better, We should also keep in mind multiple line painting. Paint is a very generic method. Should we change this paint method or specify bStrData appropriately?
xBrowser: Is it possible to change alignment on the fly?
It is most common to right justify numbers and left justify text in tables. Numbers need to be right justified to make the decimals aline. I can't think of a good reason to right justify text. James
xBrowser: Is it possible to change alignment on the fly?
Hello James, to learn to use xBrowser I created a little tool xBTool to build a xBrowser visually. There I want to click on the header and select if the column should be right aligned or left. Doing this I saw that text fields do not align accurately. Therefore I pointed this problem out. Regards, Otto
xBrwTree.prg Sample with empty Database
To All From my previous post, I found the sample xBrwTree.prg which works great if you have records in the Customer.Dbf .. unfortunitly, if Customer.dbf is empty, you get the following error .. [code=fw:2uvin13e]<div class="fw" id="{CB}" style="font-family: monospace;"><br />==========<br />&nbsp; &nbsp;Path and <span style="color: #0000ff;">name</span>: <span style="color: #000000;">C</span>:\FWH1203\samples\xbrwtree.exe <span style="color: #000000;">&#40;</span><span style="color: #000000;">32</span> bits<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #0000ff;">Size</span>: <span style="color: #000000;">2</span>,<span style="color: #000000;">139</span>,<span style="color: #000000;">136</span> bytes<br />&nbsp; &nbsp;Compiler version: <span style="color: #000000;">xHarbour</span> build <span style="color: #000000;">1.2</span><span style="color: #000000;">.1</span> Intl. <span style="color: #000000;">&#40;</span>SimpLex<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#40;</span>Rev. <span style="color: #000000;">9444</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;FiveWin &nbsp;Version: <span style="color: #000000;">FWHX</span> <span style="color: #000000;">12.03</span><br />&nbsp; &nbsp;Windows version: <span style="color: #000000;">5.1</span>, Build <span style="color: #000000;">2600</span> Service Pack <span style="color: #000000;">3</span><br /><br />&nbsp; &nbsp;Time <span style="color: #0000ff;">from</span> start: <span style="color: #000000;">0</span> hours <span style="color: #000000;">0</span> mins <span style="color: #000000;">0</span> secs <br />&nbsp; &nbsp;Error occurred <span style="color: #00C800;">at</span>: <span style="color: #000000;">11</span>/<span style="color: #000000;">27</span>/<span style="color: #000000;">13</span>, <span style="color: #000000;">13</span>:<span style="color: #000000;">13</span>:<span style="color: #000000;">33</span><br />&nbsp; &nbsp;Error description: <span style="color: #000000;">Error</span> BASE/<span style="color: #000000;">1004</span> &nbsp;<span style="color: #00C800;">Class</span>: <span style="color: #ff0000;">'NIL'</span> has no exported <span style="color: #00C800;">method</span>: <span style="color: #000000;">CARGO</span><br />&nbsp; &nbsp;Args:<br />&nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#91;</span> &nbsp; <span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span> = U &nbsp; <br /><br />Stack Calls<br />===========<br />&nbsp; &nbsp;Called <span style="color: #0000ff;">from</span>: &nbsp;=> CARGO<span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">xbrwtree</span>.prg => MAIN<span style="color: #000000;">&#40;</span> <span style="color: #000000;">19</span> <span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:2uvin13e] I have the Same problem adapting this code to ADO when there are no records in the recordset. I know there must be a simple answer, here is the Sample xBrwTree.prg code .. to run, you will need to put the Customer.dbf in the same folder. Many Thanks Rick Lipkin [code=fw:2uvin13e]<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: #00C800;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> &nbsp; <br /><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> oWnd, oBrw<br /><br />&nbsp; &nbsp;USE Customer<br />&nbsp; &nbsp;<span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> Field->State <span style="color: #0000ff;">TO</span> State<br />&nbsp; &nbsp;SET ORDER <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"State"</span><br />&nbsp; &nbsp;GO TOP<br />&nbsp; &nbsp;<br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"DBF shown as a tree with XBrowse"</span><br /><br />&nbsp; &nbsp;@ <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">OF</span> oWnd LINES CELL<br /><br />&nbsp; &nbsp;oBrw:<span style="color: #000000;">SetTree</span><span style="color: #000000;">&#40;</span> BuildTree<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, <span style="color: #000000;">&#123;</span> <span style="color: #ff0000;">"open"</span>, <span style="color: #ff0000;">"close"</span>, <span style="color: #ff0000;">"go"</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;ADD <span style="color: #0000ff;">TO</span> oBrw <span style="color: #00C800;">DATA</span> oBrw:<span style="color: #000000;">oTreeItem</span>:<span style="color: #000000;">Cargo</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> HEADER <span style="color: #ff0000;">"Last"</span> &nbsp;<span style="color: #B900B9;">// <-- errors here on empty database</span><br />&nbsp; &nbsp;ADD <span style="color: #0000ff;">TO</span> oBrw <span style="color: #00C800;">DATA</span> oBrw:<span style="color: #000000;">oTreeItem</span>:<span style="color: #000000;">Cargo</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span> HEADER <span style="color: #ff0000;">"First"</span><br /><br />&nbsp;* &nbsp;oBrw:<span style="color: #000000;">nMarqueeStyle</span> &nbsp; := MARQSTYLE_HIGHLROW<br />&nbsp; &nbsp;oBrw:<span style="color: #000000;">Last</span>:<span style="color: #000000;">nEditType</span> &nbsp;:= EDIT_GET_BUTTON<br />&nbsp; &nbsp;oBrw:<span style="color: #000000;">Last</span>:<span style="color: #000000;">bEditBlock</span> := <span style="color: #000000;">&#123;</span>|row, col, oCol| oBrw:<span style="color: #000000;">GoLeftMost</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,<span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Test"</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> &nbsp;<span style="color: #B900B9;">// repair &nbsp; </span><br />&nbsp; &nbsp;<br />&nbsp; &nbsp;<br />&nbsp; &nbsp;<br />&nbsp; &nbsp;oBrw:<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span>:<span style="color: #000000;">cHeader</span> = <span style="color: #ff0000;">"State & City"</span><br /><br />&nbsp; &nbsp;oWnd:<span style="color: #000000;">oClient</span> = oBrw<br />&nbsp; &nbsp;<br />&nbsp; &nbsp;<span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd<br />&nbsp; &nbsp;<br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span> &nbsp; <br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> BuildTree<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> oTree, cState<br /><br />&nbsp; &nbsp;TREE oTree<br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">while</span> ! Eof<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">if</span> Empty<span style="color: #000000;">&#40;</span> cState <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _TreeItem<span style="color: #000000;">&#40;</span> Customer->State <span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Cargo</span> := <span style="color: #000000;">&#123;</span> Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">20</span> <span style="color: #000000;">&#41;</span>, Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">20</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TREE<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cState = Customer->State<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">else</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> cState != Customer->State<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ENDTREE<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cState = Customer->State<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;_TreeItem<span style="color: #000000;">&#40;</span> Customer->State <span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Cargo</span> := <span style="color: #000000;">&#123;</span> Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">20</span> <span style="color: #000000;">&#41;</span>, Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">20</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TREE<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">endif</span> &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">endif</span> &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">if</span> Customer->State == cState<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _TreeItem<span style="color: #000000;">&#40;</span> Customer->City <span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Cargo</span> := <span style="color: #000000;">&#123;</span> Customer->Last, Customer->First <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">endif</span> &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SKIP<br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">enddo</span><br />&nbsp; &nbsp; &nbsp; ENDTREE<br />&nbsp; &nbsp;ENDTREE<br /><br />&nbsp; &nbsp;GO TOP<br /><br /><span style="color: #00C800;">return</span> oTree<br />&nbsp;</div>[/code:2uvin13e]
xBrwTree.prg Sample with empty Database
When there are no records, use a Tree with one blank tree item. eg: TREE oTree TREEITEM Space(20) CARGO { Space(20), Space(20) } ENDTREE
xBrwowse acentos y Ñ/ñ [SOLUCIONADO]
Hola a todos He estado buscando en el foro alguna solución al tema de los acentos y las "Ñ" y "ñ" en Xbrowse pero solo he encontrado una cuestión que se planteó, pero sin respuesta: [url:2ywqxhzl]https&#58;//forums&#46;fivetechsupport&#46;com/viewtopic&#46;php?f=6&t=36819&start=0&hilit=xbrowse+acentos+y+%C3%91&sid=80d63a6e7695b57e10b2dbf8a1abbf5e[/url:2ywqxhzl] Alguien ha podido dar con la solución? Saludos
xBrwowse acentos y Ñ/ñ [SOLUCIONADO]
Intenta asi: [code=fw:3gmfzeua]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// \samples\ACENTUAR.PRG</span><br /><br /><span style="color: #00D7D7;">#Include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br />REQUEST HB_CODEPAGE_PTISO<br />REQUEST HB_CODEPAGE_UTF8EX<br /><br />REQUEST HB_LANG_ES<br />REQUEST HB_CODEPAGE_ESWIN &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">// Para reconocer la EÑE y ACENTOS en los índices</span><br /><br />Procedure Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// texto a converter</span><br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> cStr := hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_memoread<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">'utf8.txt'</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">// Aten‡Æo / Adi‡Æo</span><br /><br />&nbsp; &nbsp;HB_CDPSELECT<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"PTISO"</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;hb_cdpSelect<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"UTF8EX"</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;HB_LANGSELECT <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ES"</span> <span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// Idioma Español</span><br />&nbsp; &nbsp;HB_SetCodePage <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ESWIN"</span> <span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// Para reconocer la EÑE y ACENTOS en los índices</span><br /><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'Directly &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : '</span>, cStr<br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi + UTF8toSTR: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem + UTF8toSTR: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + OemToAnsi: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + AnsiToOem: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;cStr := hb_utf8tostr<span style="color: #000000;">&#40;</span> memoread<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">'utf8.txt'</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'Directly &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : '</span>, cStr<br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi + UTF8toSTR: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem + UTF8toSTR: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + OemToAnsi: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + AnsiToOem: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;cStr := hb_memoread<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">'utf8.txt'</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'Directly &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : '</span>, cStr<br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi + UTF8toSTR: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem + UTF8toSTR: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + OemToAnsi: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + AnsiToOem: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;cStr := memoread<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">'utf8.txt'</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'Directly &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : '</span>, cStr<br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi + UTF8toSTR: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem + UTF8toSTR: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + OemToAnsi: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + AnsiToOem: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">Nil</span><br /><br /><span style="color: #B900B9;">// fin / end</span><br />&nbsp;</div>[/code:3gmfzeua] Regards, saludos.
xBrwowse acentos y Ñ/ñ [SOLUCIONADO]
Muchas gracias, por tu atención. Como siempre en primera línea dispuesto a ayudar. Perdona mi torpeza, pero no acabo de entender tu ejemplo con el utf8.txt. Te mando tu ejemplo modificado cambiando el txt por variables. No sé si está bien planteada la consulta, pero la cuestión es que, según la gramática española, todas las palabras que tengan tildes hay ponerlas, sean en minúsculas o en mayúsculas. Desgraciadamente, aquí en España y con el castellano, se está incurriendo constantemente en el error de no poner tildes en las mayúsculas e incluso en las minúsculas. Por ejemplo: VALÈNCIA ,València, PERÚ, Perú, BOGOTÁ, Bogotá tienen tilde y hay ponerlas, tanto si son en minúsculas como en mayúsculas. Y además se contemplan los tipos de tildes abiertas o cerradas según el dialecto de cada comunidad autónoma (València tiene tilde cerrada, propia del dialecto). Lo curioso es que el problema aparece en Xbrowse, porque cuando editas el registro con un odlg los datos se muestran correctamente. Te mando una captura de pantalla [img:1gj3d9s2]https&#58;//i&#46;postimg&#46;cc/WzhsRDDD/acentos&#46;png[/img:1gj3d9s2] [code=fw:1gj3d9s2]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#Include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br />REQUEST HB_CODEPAGE_PTISO<br />REQUEST HB_CODEPAGE_UTF8EX<br />REQUEST HB_LANG_ES<br />REQUEST HB_CODEPAGE_ESWIN                 <span style="color: #B900B9;">// Para reconocer la EÑE y ACENTOS en los índices</span><br /><br />Procedure Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />   <span style="color: #B900B9;">// texto a converter                                                                                        </span><br /> <br />   <span style="color: #B900B9;">//LOCAL cStr := hb_utf8tostr( hb_memoread( 'utf8.txt' ) ) // Aten‡Æo / Adi‡Æo</span><br />  <br />   <span style="color: #00C800;">Local</span> cStr := <span style="color: #ff0000;">"PEÑÀGUILA, Peñàguila, TURÍS, Turís, CÀLIG, Càlig, XÀTIVA, Xàtiva, AGROCÍTRICOS, Agocítricos, L'ALCÚDIA, L'Alcúdia"</span>+CRLF+;<br />   <span style="color: #ff0000;">"ÁGORA, Ágora, ALMÀSSERA, Almàssera, PERÚ, Perú, BOGOTÁ, Bogotá, VALÈNCIA, València"</span><br /><br />   HB_CDPSELECT<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"PTISO"</span> <span style="color: #000000;">&#41;</span><br />   hb_cdpSelect<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"UTF8EX"</span> <span style="color: #000000;">&#41;</span><br />   HB_LANGSELECT <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ES"</span> <span style="color: #000000;">&#41;</span>                    <span style="color: #B900B9;">// Idioma Español</span><br />   HB_SetCodePage <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ESWIN"</span> <span style="color: #000000;">&#41;</span>                <span style="color: #B900B9;">// Para reconocer la EÑE y ACENTOS en los índices</span><br /><br />   ? <span style="color: #ff0000;">'Directly             : '</span>, cStr<br />   ? <span style="color: #ff0000;">'UTF8toSTR            : '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'OemToAnsi + UTF8toSTR: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'AnsiToOem + UTF8toSTR: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'UTF8toSTR + OemToAnsi: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'UTF8toSTR + AnsiToOem: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'OemToAnsi            : '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'AnsiToOem            : '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br /><br /> <span style="color: #B900B9;">// cStr := hb_utf8tostr( memoread( 'utf8.txt' ) )</span><br /> <br />   ? <span style="color: #ff0000;">'Directly             : '</span>, cStr<br />   ? <span style="color: #ff0000;">'UTF8toSTR            : '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'OemToAnsi + UTF8toSTR: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'AnsiToOem + UTF8toSTR: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'UTF8toSTR + OemToAnsi: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'UTF8toSTR + AnsiToOem: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'OemToAnsi            : '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'AnsiToOem            : '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br /><br />  <span style="color: #B900B9;">// cStr := hb_memoread( 'utf8.txt' )</span><br /><br />   ? <span style="color: #ff0000;">'Directly             : '</span>, cStr<br />   ? <span style="color: #ff0000;">'UTF8toSTR            : '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'OemToAnsi + UTF8toSTR: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'AnsiToOem + UTF8toSTR: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'UTF8toSTR + OemToAnsi: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'UTF8toSTR + AnsiToOem: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'OemToAnsi            : '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'AnsiToOem            : '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #B900B9;">// cStr := memoread( 'utf8.txt' )</span><br /><br />   ? <span style="color: #ff0000;">'Directly             : '</span>, cStr<br />   ? <span style="color: #ff0000;">'UTF8toSTR            : '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'OemToAnsi + UTF8toSTR: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'AnsiToOem + UTF8toSTR: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'UTF8toSTR + OemToAnsi: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'UTF8toSTR + AnsiToOem: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'OemToAnsi            : '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />   ? <span style="color: #ff0000;">'AnsiToOem            : '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">Nil</span></div>[/code:1gj3d9s2] Saludos y gracias
xBrwowse acentos y Ñ/ñ [SOLUCIONADO]
[code=fw:12ahafwv]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// \samples\ACENTUAR.PRG - 2.0</span><br /><br /><span style="color: #00D7D7;">#Include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br />REQUEST HB_CODEPAGE_PTISO<br />REQUEST HB_CODEPAGE_UTF8EX<br /><br />REQUEST HB_LANG_ES<br />REQUEST HB_CODEPAGE_ESWIN &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">// Para reconocer la EÑE y ACENTOS en los índices</span><br /><br />Procedure Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// texto a converter</span><br />&nbsp; &nbsp;<span style="color: #B900B9;">// LOCAL cStr := hb_utf8tostr( hb_memoread( 'utf8.txt' ) ) // Aten‡Æo / Adi‡Æo</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> cStr := &nbsp;<span style="color: #ff0000;">"XÀTIVA"</span><br /><br />&nbsp; &nbsp;HB_CDPSELECT<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"PTISO"</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;hb_cdpSelect<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"UTF8EX"</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;HB_LANGSELECT <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ES"</span> <span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// Idioma Español</span><br />&nbsp; &nbsp;HB_SetCodePage <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ESWIN"</span> <span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// Para reconocer la EÑE y ACENTOS en los índices</span><br /><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'Directly 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : '</span>, cStr<br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi + UTF8toSTR: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem + UTF8toSTR: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + OemToAnsi: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + AnsiToOem: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #B900B9;">// &nbsp; cStr := hb_utf8tostr( memoread( 'utf8.txt' ) )</span><br /><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'Directly 2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : '</span>, cStr<br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi + UTF8toSTR: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem + UTF8toSTR: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + OemToAnsi: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + AnsiToOem: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #B900B9;">// &nbsp; cStr := hb_memoread( 'utf8.txt' )</span><br /><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'Directly 3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : '</span>, cStr<br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi + UTF8toSTR: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem + UTF8toSTR: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + OemToAnsi: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + AnsiToOem: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #B900B9;">// &nbsp; cStr := memoread( 'utf8.txt' )</span><br /><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'Directly 4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : '</span>, cStr<br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi + UTF8toSTR: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem + UTF8toSTR: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + OemToAnsi: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'UTF8toSTR + AnsiToOem: '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'OemToAnsi &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_OemToAnsi<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? <span style="color: #ff0000;">'AnsiToOem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: '</span>,hb_AnsiToOem<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">Nil</span><br />&nbsp;</div>[/code:12ahafwv] Saludos.
xBrwowse acentos y Ñ/ñ [SOLUCIONADO]
Muchas gracias, João He modificado algunas cosas de tu ejemplo y funciona. Contempla las tildes abiertas y cerradas, la diéresis y las "ñ", tanto en mayúsculas como en minúsculas. He cambiado REQUEST HB_CODEPAGE_PTISO por REQUEST HB_CODEPAGE_ES850 ya que el primero corresponde al idioma portugués. Y dentro de la función he cambiado HB_CDPSELECT( "PTISO" ) por HB_SETCODEPAGE( "ES850" ) por la misma razón. El ejemplo completo y simplificado quedaría así, incluyendo palabras con tildes abiertas y cerradas, diéresis y "ñ", tanto en mayúsculas como en minúsculas: [code=fw:2w5j5khi]<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 /><span style="color: #B900B9;">//REQUEST HB_CODEPAGE_PTISO  // Se quita por ser del idioma portugués</span><br />REQUEST HB_CODEPAGE_UTF8EX<br />REQUEST HB_LANG_ES<br />REQUEST HB_CODEPAGE_ESWIN  <span style="color: #B900B9;">// Para reconocer la EÑE y ACENTOS en los índices</span><br />REQUEST HB_CODEPAGE_ES850  <span style="color: #B900B9;">// Se añade el idioma español</span><br /><br />Procedure Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />   <span style="color: #00C800;">LOCAL</span> cStr :=  <span style="color: #ff0000;">"PEÑÀGUILA, Peñàguila, TURÍS, Turís, CÀLIG, Càlig, XÀTIVA, Xàtiva, AGROCÍTRICOS, Agrocítricos, L'ALCÚDIA, L'Alcúdia"</span>+CRLF+;<br />   <span style="color: #ff0000;">"ÁGORA, Ágora, ALMÀSSERA, Almàssera, PERÚ, Perú, BOGOTÁ, Bogotá, VALÈNCIA, València, ZARIGÜEÑA, Zarigüeña"</span><br /> <br />   HB_SETCODEPAGE<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ES850"</span> <span style="color: #000000;">&#41;</span>                <span style="color: #B900B9;">// Se añade el código de página del idioma español</span><br /> <span style="color: #B900B9;">//HB_CDPSELECT( "PTISO" )                  // Se quita por corresponder al idioma portugués</span><br />   hb_cdpSelect<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"UTF8EX"</span> <span style="color: #000000;">&#41;</span><br />   HB_LANGSELECT <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ES"</span> <span style="color: #000000;">&#41;</span>                      <span style="color: #B900B9;">// Idioma Español</span><br />   HB_SetCodePage <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ESWIN"</span> <span style="color: #000000;">&#41;</span>                <span style="color: #B900B9;">// Para reconocer la EÑE y ACENTOS en los índices</span><br /><br /><br /> ? <span style="color: #ff0000;">'UTF8toSTR            : '</span>,hb_utf8tostr<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br /> </div>[/code:2w5j5khi] Y un pequeño detalle muy importante en el que, por pura mecánica, no caemos -o por lo menos no he caido yo- : los PRG se tienen que guardar en forma UTF-8 y no en ANSI como, a veces y por defecto, ocurre. Un saludo y muchas gracias João
xBrwowse acentos y Ñ/ñ [SOLUCIONADO]
Mui bién Ramón. Voy guardar para el futuro. Muchas gracias por el aporte. Regards, saludos.