topic
stringlengths 1
63
| text
stringlengths 1
577k
⌀ |
---|---|
sort Filename (Extension) | hi,
[quote="nageswaragunupudi":3awfaa1p]And wherever possible, it may be easier to leave the sorting business to xbrowse itself and xbrowse does a good job.[/quote:3awfaa1p]
thx for help
i´m sure it work under Fivewin but i use also HMG or Xbase++
so i always search Solution which i can use for all xBase-Dialect |
sort an array on line Resolved!! | can I sort an array is on xbrowse ?
sample :
AaDd(atemp,{strzero(n,4),; //0001
SP->id,; // "O"
SP->DESC,; //"ooooooo"
SP->SETTORE,; //"A"
nGiorni,; //"1"
nPriceTemp,; //"10.00"
lIslock,; /7".t."
nIdListino } ) //"01"
I wish sort on idlistino |
sort an array on line Resolved!! | Create xbrowse with AUTOSORT clause and click on the last header. |
sort an array on line Resolved!! | Sorry but i wish sort on idlistino is not on x browse |
sort an array on line Resolved!! | First sort the array
ASort( aTemp, , , { |x,y| x[ 8 ] < y[ 8 ] } )
Then build the XBrowse and [b:16n2mrw9]do not use AUTOSORT[/b:16n2mrw9]. |
sort an array on line Resolved!! | Sorry i make a mistake i have on array records having idlistino =1 and other =2 and i select with a combobox if 1 or 2 and i wish refrrsh the xbrowes showing only the idlistino =nselect |
sort an array on line Resolved!! | [code=fw:2za9bl0m]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oDlg, oFont, oBrw<br /> <span style="color: #00C800;">local</span> cFilter := <span style="color: #ff0000;">"01"</span><br /> <span style="color: #00C800;">local</span> nFilterCol := <span style="color: #000000;">3</span><br /> <span style="color: #00C800;">local</span> aData := <span style="color: #000000;">{</span> ;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"one"</span>, <span style="color: #ff0000;">"two"</span>, <span style="color: #ff0000;">"01"</span> <span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"three"</span>, <span style="color: #ff0000;">"four"</span>, <span style="color: #ff0000;">"01"</span> <span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"five"</span>, <span style="color: #ff0000;">"six"</span>, <span style="color: #ff0000;">"02"</span> <span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"seven"</span>, <span style="color: #ff0000;">"eight"</span>, <span style="color: #ff0000;">"02"</span> <span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"nine"</span>, <span style="color: #ff0000;">"ten"</span>, <span style="color: #ff0000;">"02"</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span><br /><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"TAHOMA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-14</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">300</span>,<span style="color: #000000;">300</span> <span style="color: #0000ff;">PIXEL</span> TRUEPIXEL <span style="color: #0000ff;">FONT</span> oFont<br /><br /> @ <span style="color: #000000;">70</span>,<span style="color: #000000;">20</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">-20</span>,<span style="color: #000000;">-20</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> DATASOURCE FilterArray<span style="color: #000000;">(</span> aData, nFilterCol, cFilter <span style="color: #000000;">)</span> ;<br /> COLUMNS <span style="color: #000000;">1</span>,<span style="color: #000000;">2</span> ;<br /> CELL LINES NOBORDER<br /><br /> WITH OBJECT oBrw<br /> :<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> END<br /><br /> @ <span style="color: #000000;">20</span>,<span style="color: #000000;">20</span> <span style="color: #0000ff;">COMBOBOX</span> cFilter <span style="color: #0000ff;">ITEMS</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"01"</span>, <span style="color: #ff0000;">"02"</span> <span style="color: #000000;">}</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>,<span style="color: #000000;">400</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CHANGE</span> <span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">aArrayData</span> := FilterArray<span style="color: #000000;">(</span> aData, nFilterCol, cFilter <span style="color: #000000;">)</span>, ;<br /> oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> FilterArray<span style="color: #000000;">(</span> aData, nFilterCol, cFilter <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> aFilter := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> AEval<span style="color: #000000;">(</span> aData, <span style="color: #000000;">{</span> |a| <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> a<span style="color: #000000;">[</span> nFilterCol <span style="color: #000000;">]</span> == cFilter, AAdd<span style="color: #000000;">(</span> aFilter, a <span style="color: #000000;">)</span>, <span style="color: #00C800;">nil</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> aFilter<br /> </div>[/code:2za9bl0m] |
sort an array on line Resolved!! | thanks .it was just what I was trying to do |
sort an array on line Resolved!! | Only I have a listini with two array (name,type)
type "Listino 1" ,"01" |
sort an array on line Resolved!! | [b:3i7tl5lz]I correct with [/b:3i7tl5lz]
@ 36,75 COMBOBOX cFilter ITEMS ArrTranspose( aListini )[ 1] SIZE 100,400 PIXEL OF oDlgTariffe;
ON CHANGE ( oBrwBase:aArrayData := FilterArray( aData, nFilterCol, cFilter ), ;
oBrwBase:GoTop(), oBrwBase:Refresh() )
[img:3i7tl5lz]https://i.postimg.cc/FsfdpK6L/l.png[/img:3i7tl5lz]
but Now i not see any record on when I select one items
[img:3i7tl5lz]https://i.postimg.cc/054rzsN2/ee.png[/img:3i7tl5lz]
the code
[code=fw:3i7tl5lz]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br />REQUEST DBFCDX<br />REQUEST DBFFPT<br />EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO<br /><br /><br /><span style="color: #00C800;">function</span> Tariffe<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oDlg, oFont,oBold<br /> <span style="color: #00C800;">local</span> oBrwBase,oBrwTariffe<br /> <span style="color: #00C800;">local</span> aget<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span><br /> <span style="color: #00C800;">local</span> nFilterCol := <span style="color: #000000;">8</span><br /> <span style="color: #00C800;">local</span> aListini := Crea_Array_listini<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">//creation price_list</span><br /> <span style="color: #00C800;">local</span> aData := Crea_Base<span style="color: #000000;">(</span>aListini<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> cFilter := alistini<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"TAHOMA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-14</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oBold <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"TAHOMA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-14</span> BOLD<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlgTariffe <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">500</span>,<span style="color: #000000;">600</span>;<br /> <span style="color: #0000ff;">PIXEL</span> TRUEPIXEL RESIZABLE <span style="color: #0000ff;">FONT</span> oFont;<br /> <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">" Tariffe"</span><br /><br /> @ <span style="color: #000000;">10</span>, <span style="color: #000000;">40</span> <span style="color: #0000ff;">SAY</span> oSay1 <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Tariffe Base"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">400</span>,<span style="color: #000000;">24</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlgTariffe <span style="color: #0000ff;">CENTER</span> <span style="color: #0000ff;">FONT</span> oBold<br /> @ <span style="color: #000000;">38</span>,<span style="color: #000000;">20</span> <span style="color: #0000ff;">SAY</span> <span style="color: #ff0000;">"Listino :"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">80</span>,<span style="color: #000000;">14</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlgTariffe<br /><br /> @ <span style="color: #000000;">70</span>,<span style="color: #000000;">20</span> <span style="color: #0000ff;">XBROWSE</span> oBrwBase <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">-5</span>,<span style="color: #000000;">200</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlgTariffe ;<br /> HEADERS <span style="color: #ff0000;">"Elemento"</span>,<span style="color: #ff0000;">"Settore"</span>,<span style="color: #ff0000;">"Giorni"</span>,<span style="color: #ff0000;">"Costo"</span>, <span style="color: #ff0000;">"Bloccato"</span>;<br /> DATASOURCE FilterArray<span style="color: #000000;">(</span> aData, nFilterCol, cFilter <span style="color: #000000;">)</span> ;<br /> COLUMNS <span style="color: #000000;">3</span>,<span style="color: #000000;">4</span>,<span style="color: #000000;">5</span>,<span style="color: #000000;">6</span>,<span style="color: #000000;">7</span>;<br /> CELL LINES NOBORDER<br /><br /> WITH OBJECT oBrwBase<br /> :<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> END<br /><br /> @ <span style="color: #000000;">36</span>,<span style="color: #000000;">75</span> <span style="color: #0000ff;">COMBOBOX</span> cFilter <span style="color: #0000ff;">ITEMS</span> ArrTranspose<span style="color: #000000;">(</span> aListini <span style="color: #000000;">)</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>,<span style="color: #000000;">400</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlgTariffe;<br /> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CHANGE</span> <span style="color: #000000;">(</span> oBrwBase:<span style="color: #000000;">aArrayData</span> := FilterArray<span style="color: #000000;">(</span> aData, nFilterCol, cFilter <span style="color: #000000;">)</span>, ;<br /> oBrwBase:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oBrwBase:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><br /><br /><br /> @ <span style="color: #000000;">550</span>,<span style="color: #000000;">260</span> <span style="color: #0000ff;">BUTTON</span> oBtnClose <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Conferma"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">80</span>,<span style="color: #000000;">30</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlgTariffe;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #00C800;">NIL</span><br /><br /> @ <span style="color: #000000;">550</span>,<span style="color: #000000;">360</span> <span style="color: #0000ff;">BUTTON</span> oBtnOK <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Annulla"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">80</span>,<span style="color: #000000;">30</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlgTariffe;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #00C800;">NIL</span><br /><br /><br /><br /> oDlgTariffe:<span style="color: #000000;">bResized</span> := <||<br /> <span style="color: #00C800;">local</span> oRect := oDlgTariffe:<span style="color: #000000;">GetCliRect</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> oBtnClose:<span style="color: #000000;">nLeft</span> := oRect:<span style="color: #000000;">nRight</span> - <span style="color: #000000;">220</span><br /> oBtnClose:<span style="color: #000000;">nTop</span> := oRect:<span style="color: #000000;">nBottom</span> - <span style="color: #000000;">50</span><br /><br /> oBtnOK:<span style="color: #000000;">nLeft</span> := oRect:<span style="color: #000000;">nRight</span> - <span style="color: #000000;">120</span><br /> oBtnOK:<span style="color: #000000;">nTop</span> := oRect:<span style="color: #000000;">nBottom</span> - <span style="color: #000000;">50</span><br /><br /> oBrwBase:<span style="color: #0000ff;">refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> * oBrwTariffe:<span style="color: #0000ff;">refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">nil</span><br /> ><br /><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlgTariffe <span style="color: #0000ff;">CENTERED</span><br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFont, oBold<br /> <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">nil</span><br /><span style="color: #B900B9;">//----------------------------------------------------------------//</span><br /><br /><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> FilterArray<span style="color: #000000;">(</span> aData, nFilterCol, cFilter <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> aFilter := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> AEval<span style="color: #000000;">(</span> aData, <span style="color: #000000;">{</span> |a| <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> a<span style="color: #000000;">[</span> nFilterCol <span style="color: #000000;">]</span> == cFilter, AAdd<span style="color: #000000;">(</span> aFilter, a <span style="color: #000000;">)</span>, <span style="color: #00C800;">nil</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> aFilter<br /><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">Function</span> Crea_Array_listini<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Local</span> alist_temp:=<span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> USE LISTINI <span style="color: #0000ff;">ALIAS</span> LI SHARE <span style="color: #00C800;">NEW</span> VIA <span style="color: #ff0000;">"DBFCDX"</span><br /> <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">NAME</span> TAG <span style="color: #ff0000;">"IDXLISTINI"</span><br /> LI-><span style="color: #000000;">(</span>dbgotop<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">While</span> !LI-><span style="color: #000000;">(</span>eof<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> AaDd<span style="color: #000000;">(</span>alist_temp,<span style="color: #000000;">{</span> LI->NAME,LI->ID <span style="color: #000000;">}</span><span style="color: #000000;">)</span><br /> LI-><span style="color: #000000;">(</span>dbskip<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDDO</span><br /><br /> <span style="color: #00C800;">return</span> alist_temp<br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">Static</span> <span style="color: #00C800;">Function</span> Crea_Base<span style="color: #000000;">(</span>aListini<span style="color: #000000;">)</span><br /><span style="color: #00C800;">Local</span> atemp:=<span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><span style="color: #00C800;">Local</span> n := <span style="color: #000000;">1</span><br /><span style="color: #00C800;">Local</span> nGiorni := <span style="color: #000000;">1</span><br /><span style="color: #00C800;">Local</span> nPriceTemp:= <span style="color: #000000;">10</span><br /><span style="color: #00C800;">Local</span> lIsLock := .t.<br /><span style="color: #00C800;">Local</span> cId :=<span style="color: #ff0000;">" "</span><br /><span style="color: #00C800;">Local</span> cSector :=<span style="color: #ff0000;">" "</span><br /><br /> USE SPIAGGIA <span style="color: #0000ff;">ALIAS</span> SP SHARE <span style="color: #00C800;">NEW</span> VIA <span style="color: #ff0000;">"DBFCDX"</span><br /><br /> <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">id</span>+settore TAG <span style="color: #ff0000;">"IDXSETTORE"</span><br /><br /> SP-><span style="color: #000000;">(</span>ordSetFocus<span style="color: #000000;">(</span><span style="color: #ff0000;">"IDXSETTORE"</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">//indicizzo su settori</span><br /> SP-><span style="color: #000000;">(</span>dbgotop<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /><br /><span style="color: #B900B9;">//Creo tariffe base secondo gli elementi che sono in archivio e per listino</span><br /><br /> <span style="color: #00C800;">Do</span> <span style="color: #00C800;">while</span> .not. SP-><span style="color: #000000;">(</span>eof<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> !Empty<span style="color: #000000;">(</span>SP->SETTORE<span style="color: #000000;">)</span> .and. <span style="color: #000000;">(</span>sp->SETTORE!=cSector .or. sp->Id!=cId<span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">For</span> k=<span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> Len<span style="color: #000000;">(</span>aListini<span style="color: #000000;">)</span><br /><br /> AaDd<span style="color: #000000;">(</span>atemp,<span style="color: #000000;">{</span>strzero<span style="color: #000000;">(</span>n,<span style="color: #000000;">4</span><span style="color: #000000;">)</span>,;<br /> SP->id,;<br /> SP->DESC,;<br /> SP->SETTORE,;<br /> nGiorni,;<br /> nPriceTemp,;<br /> lIslock,;<br /> aListini<span style="color: #000000;">[</span>k<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /> n++<br /><br /> <span style="color: #00C800;">next</span><br /><br /> <span style="color: #00C800;">Endif</span><br /><br /> cSector := sp->SETTORE<br /> cId := sp->Id<br /> SP-><span style="color: #000000;">(</span>dbskip<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Enddo</span><br /><br /><br /> <span style="color: #00C800;">return</span> aTemp<br /><br /><br /><br /><br /><br /><br /><br /> </div>[/code:3i7tl5lz] |
sort an array on line Resolved!! | If I made (idea)
[code=fw:3idf7xmp]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> FilterArray<span style="color: #000000;">(</span> aData, nFilterCol, cFilter, alistini <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> aFilter := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> AEval<span style="color: #000000;">(</span> aData, <span style="color: #000000;">{</span> |a| <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> a<span style="color: #000000;">[</span> nFilterCol <span style="color: #000000;">]</span> == Search_cod<span style="color: #000000;">(</span>cFilter,alistini<span style="color: #000000;">)</span> , AAdd<span style="color: #000000;">(</span> aFilter, a <span style="color: #000000;">)</span>, <span style="color: #00C800;">nil</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">return</span> aFilter<br /><br /><br /><span style="color: #00C800;">Function</span> search_cod<span style="color: #000000;">(</span>cFilter,alistini<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Local</span> nAt := AScan<span style="color: #000000;">(</span> alistini, <span style="color: #000000;">{</span> |a| a<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> == cFilter <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Local</span> cCode:=<span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">If</span> nAt><span style="color: #000000;">0</span><br /> cCode:= alistini<span style="color: #000000;">[</span>nAt<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><br /> <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #00C800;">return</span> cCode</div>[/code:3idf7xmp]
it run but on init I see the xbrowse empty ,,,any solution ? |
sort up/down xbrowse error function sort | on first column of xbrowse I have an black arrow to sort the dbf
[img:tp16gtev]https://i.postimg.cc/28W1PtJb/j.png[/img:tp16gtev]
[b:tp16gtev]initial run ok , them when I click on header it refresh the oBrw but not the nHeadBmpNo why ?[/b:tp16gtev]
[b:tp16gtev]look this sample [/b:tp16gtev]
[code=fw:tp16gtev]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><br />REQUEST DBFCDX<br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oDlg, oBrw<br /> <span style="color: #00C800;">local</span> oDbf<br /> <span style="color: #00C800;">local</span> nOrder:= <span style="color: #000000;">1</span><br /><br /> oDbf :=TDatabase<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> , <span style="color: #ff0000;">"Customer"</span>, <span style="color: #ff0000;">"DBFCDX"</span>, .T. <span style="color: #000000;">)</span><br /> oDbf:<span style="color: #000000;">setorder</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">400</span>,<span style="color: #000000;">400</span> <span style="color: #0000ff;">PIXEL</span> TRUEPIXEL<br /><br /> @ <span style="color: #000000;">20</span>,<span style="color: #000000;">20</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">-20</span>,<span style="color: #000000;">-20</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> DATASOURCE oDbf <span style="color: #0000ff;">AUTOCOLS</span> AUTOSORT CELL LINES NOBORDER<br /><br /> WITH OBJECT oBrw<br /> *:<span style="color: #000000;">AddBitmap</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"sort_up.bmp"</span>,<span style="color: #ff0000;">"sort_down.bmp"</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> :<span style="color: #000000;">AddBitmap</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> , <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /> WITH OBJECT oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span><br /> :<span style="color: #000000;">AddBitmap</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"sort_up.bmp"</span>,<span style="color: #ff0000;">"sort_down.bmp"</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> :<span style="color: #000000;">nHeadBmpNo</span> := iif<span style="color: #000000;">(</span> nOrder == <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span>, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span><br /> :<span style="color: #000000;">bLClickHeader</span> :=<span style="color: #000000;">{</span> || SortDbf<span style="color: #000000;">(</span><span style="color: #000000;">2</span>,oBrw,oDbf <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> END<br /> :<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> END<br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span> ;<br /> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> <span style="color: #000000;">(</span> DeleteObject<span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">aSortBmp</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> <span style="color: #000000;">)</span>, ;<br /> DeleteObject<span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">aSortBmp</span><span style="color: #000000;">[</span> <span style="color: #000000;">2</span>, <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> <span style="color: #000000;">)</span>, ;<br /> oBrw:<span style="color: #000000;">aSortBmp</span> := oBrw:<span style="color: #000000;">aBitmaps</span>, ;<br /> oBrw:<span style="color: #000000;">aBitmaps</span> := <span style="color: #000000;">{</span><span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /> <span style="color: #00C800;">FUNCTION</span> SortDbf<span style="color: #000000;">(</span>nOrden, oBrw, oDbf <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> nRecno := oDbf:<span style="color: #000000;">RecNo</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> nLen := Len<span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">aCols</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> n<br /> <span style="color: #00C800;">local</span> nBmp<br /><br /> <span style="color: #00C800;">FOR</span> n := <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> nLen<br /> * <span style="color: #00C800;">IF</span> oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> n <span style="color: #000000;">]</span>:<span style="color: #000000;">nHeadBmpNo</span> != <span style="color: #00C800;">NIL</span> .AND. oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> n <span style="color: #000000;">]</span>:<span style="color: #000000;">nHeadBmpNo</span> > <span style="color: #000000;">0</span><br /> <span style="color: #00C800;">IF</span> oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> n <span style="color: #000000;">]</span>:<span style="color: #000000;">Cargo</span> == nOrden<br /> oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> n <span style="color: #000000;">]</span>:<span style="color: #000000;">nHeadBmpNo</span> := <span style="color: #000000;">1</span><br /> nBmp:= <span style="color: #000000;">1</span><br /> oDbf:<span style="color: #000000;">Gotop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ELSE</span><br /> oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> n <span style="color: #000000;">]</span>:<span style="color: #000000;">nHeadBmpNo</span> := <span style="color: #000000;">2</span><br /> nBmp:= <span style="color: #000000;">2</span><br /> oDbf:<span style="color: #000000;">GoBottom</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> * <span style="color: #00C800;">ENDIF</span><br /> * oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span>:<span style="color: #000000;">bOnChange</span> := <span style="color: #000000;">{</span>|o|o:<span style="color: #000000;">oBrw</span>:<span style="color: #000000;">RefreshHeaders</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><br /> <span style="color: #00C800;">NEXT</span><br /> oBrw:<span style="color: #000000;">RefreshHeaders</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">// oBrw:SetSortBmp( ".\bitmaps\sort_up.bmp",".\bitmaps\sort_down.bmp" )</span><br /><br /> oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span> .T. <span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span> .T. <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">RETURN</span> nBmp<br /><br /> </div>[/code:tp16gtev]
give me error
Error description: Error BASE/1075 Argument error: >
Args:
[ 1] = B {|| ... }
[ 2] = N 0 |
sound on key press | How I can insert a sound when I press a key and I use a Tget control ? |
sound on key press | #include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
LOCAL oGet1, cVar1 := SPACE( 10 )
REQUEST HB_GT_GUI_DEFAULT // for tone usage
DEFINE DIALOG oDlg
@ 1 , 1 GET oGet1 VAR cVar1 OF oDlg
// oGet1:bKeyChar = { || tone(100,.1) }
oGet1:bKeyChar = { || messagebeep() }
ACTIVATE DIALOG oDlg CENTER
RETURN NIL |
sound on key press | Mr Marco,
REDEFINE GET oMss VAR cMss ID 130 MEMO OF oDlm
oMss:bKeyChar = { || messagebeep() }
[b:16xwwnvw]NOT RUN ![/b:16xwwnvw] |
sound on key press | Did you try ?
oMss:bKeyDown = { || messagebeep() } |
sound when click in button | HI.
I need insert one sound when user has clicked in button. like i do it?
thank´s |
sound when click in button | Hello,
Include [color=#FF0000:2mvcfyrz]SndPlaySound[/color:2mvcfyrz] in Your Button-Action.
@ 4, 2 BUTTON "Date-Test" size 50, 25 OF oDlg ;
ACTION ( SndPlaySound( "chord.wav", 0 ), ;
more actions ... )
But I noticed, even on a fast computer it takes some times, the wave-sound is played.
The sound is not played the same time with button-click. There is also a speaker-sound but I didn't test it.
Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
sound when click in button | <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
Thank´s |
sound when click in button | What about using TONE(<nFrequency>, <nDuration>) instead of SndPlaySound(). It´s really faster, because no soundfile has to be loaded. |
source codes available ( pFTP ) | Hi all:
Sources are now available FTP program for a small fee.
Download here: [url] <!-- m --><a class="postlink" href="http://javierlloris.blogspot.com.es/p/programas-y-herramientas.html">http://javierlloris.blogspot.com.es/p/p ... entas.html</a><!-- m --> [/ url]
a greeting
JLL |
space and diskinfo | How cal this function ?
HB_FUNC (MEMINFO)
{
MEMORYSTATUS st;
GlobalMemoryStatus (&st);
hb_reta (4);
hb_stornl ((ULONG) st.dwMemoryLoad, -1, 1);
hb_stornl ((ULONG) st.dwTotalPhys, -1, 2);
hb_stornl ((ULONG) st.dwTotalVirtual, -1, 3);
hb_stornl ((ULONG) st.dwAvailVirtual, -1, 4);
}
HB_FUNC (DISKINFO)
{
BOOL iRet;
unsigned __int64 iFreeBytesToCaller, iTotalBytes, iFreeBytes;
iRet = GetDiskFreeSpaceEx(NULL,
(PULARGE_INTEGER) &iFreeBytesToCaller,
(PULARGE_INTEGER) &iTotalBytes,
(PULARGE_INTEGER) &iFreeBytes);
hb_reta (2);
hb_stornl ((ULONG) iTotalBytes, -1, 1);
hb_stornl ((ULONG) iFreeBytes, -1, 2);
} |
space and diskinfo | Silvio,
Those functions return arrays.
The first one returns a 4 elements array, and the second one a two elements array. |
space and diskinfo | How I can show all the informations ? |
space and diskinfo | Silvio,
AEval( MemInfo(), { | n | MsgInfo( n ) } ) |
special Codeblock Syntax under Fivewin | hi,
i saw in some Code Syntax like this
[code=fw:2flscn25]<div class="fw" id="{CB}" style="font-family: monospace;"> <||<br /> <span style="color: #00C800;">local</span> oRect := oDlg: GetCliRect <span style="color: #000000;">(</span> <span style="color: #000000;">)</span><br /> oBar: nWidth := oRect: nWidth<br /> oLbx: nWidth := oRect: nWidth - <span style="color: #000000;">210</span><br /> <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> ></div>[/code:2flscn25]
where can i read "more" about this Syntax
in above Sample you need to pass oLbx as Parameter but how using that Syntax <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
---
here a Sample how i pass Parameter to Codeblock
[code=fw:2flscn25]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br />PROCEDURE MAIN<br /><span style="color: #00C800;">LOCAL</span> a := <span style="color: #000000;">1</span><br /><span style="color: #00C800;">LOCAL</span> b := <span style="color: #ff0000;">"a"</span><br /><span style="color: #00C800;">LOCAL</span> cBlock, bBlock<br /> <span style="color: #B900B9;">// you can per-build Codeblock as String</span><br /> cBlock := <span style="color: #ff0000;">"{|a,b| DoTest(a,b)}"</span><br /><br /> bBlock := &<span style="color: #000000;">(</span>cBlock<span style="color: #000000;">)</span><br /> Eval<span style="color: #000000;">(</span>bBlock,a,b<span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span></div>[/code:2flscn25]
[code=fw:2flscn25]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">FUNCTION</span> DoTest<span style="color: #000000;">(</span>a,b<span style="color: #000000;">)</span><br />? a, VALTYPE<span style="color: #000000;">(</span>a<span style="color: #000000;">)</span><br />? b, VALTYPE<span style="color: #000000;">(</span>b<span style="color: #000000;">)</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #000000;">0</span><br /> </div>[/code:2flscn25]
as you can see i include Parameter between "|" (Pipe) Sign of Codeblock and pass them at EVAL() |
special Codeblock Syntax under Fivewin | Hi Mr. Jimmy,
They are named extended codeblocks
<!-- m --><a class="postlink" href="https://vivaclipper.wordpress.com/tag/codeblock/">https://vivaclipper.wordpress.com/tag/codeblock/</a><!-- m -->
This (extra) syntax too is correct for harbour:
[code=fw:37f3wr0g]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #000000;">{</span>|| <br /> a:= <span style="color: #000000;">1</span><br /> b:= <span style="color: #000000;">2</span><br /> c:= <span style="color: #000000;">3</span> <br /> <span style="color: #000000;">}</span></div>[/code:37f3wr0g]
Regards |
special Codeblock Syntax under Fivewin | This is xHarbour style of extended codeblock
[code=fw:3q23vfmv]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><|oLbx|<br /> <span style="color: #00C800;">local</span> oRect := oDlg: GetCliRect <span style="color: #000000;">(</span> <span style="color: #000000;">)</span><br /> oBar: nWidth := oRect: nWidth<br /> oLbx: nWidth := oRect: nWidth - <span style="color: #000000;">210</span><br /> <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> ><br /> </div>[/code:3q23vfmv]
Harbour style
[code=fw:3q23vfmv]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #000000;">{</span>|oLbx|<br /> <span style="color: #00C800;">local</span> oRect := oDlg: GetCliRect <span style="color: #000000;">(</span> <span style="color: #000000;">)</span><br /> oBar: nWidth := oRect: nWidth<br /> oLbx: nWidth := oRect: nWidth - <span style="color: #000000;">210</span><br /> <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> <span style="color: #000000;">}</span><br /> </div>[/code:3q23vfmv]
Just remember that extended codeblock must have RETURN
<!-- m --><a class="postlink" href="http://harbouradvisor.blogspot.com/2011/09/extended-codeblocks.html">http://harbouradvisor.blogspot.com/2011 ... locks.html</a><!-- m --> |
special Codeblock Syntax under Fivewin | Hi Hua,
[quote:1c1k96mb]Just remember that extended codeblock must have RETURN[/quote:1c1k96mb]
It's not required return clause. Return clause it's neccessary only for return value
[code=fw:1c1k96mb]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">// Not neccessary return value. Only code. Implicity return value is NIL</span><br />x:= <span style="color: #000000;">{</span>||<br /> a:= <span style="color: #000000;">1</span><br /> b:= <span style="color: #000000;">2</span><br /> c:= <span style="color: #000000;">3</span> <br /> <span style="color: #000000;">}</span><br /><br /><span style="color: #B900B9;">// Return value</span><br />y:= <span style="color: #000000;">{</span>||<br /> a:= <span style="color: #000000;">1</span><br /> b:= <span style="color: #000000;">2</span><br /> c:= <span style="color: #000000;">3</span> <br /> <span style="color: #00C800;">return</span> b <br /> <span style="color: #000000;">}</span></div>[/code:1c1k96mb]
Regards |
special Codeblock Syntax under Fivewin | hi,
thx all for Answer
[quote="hmpaquito":9zzc26uj]It's not required return clause. Return clause it's neccessary only for return value[/quote:9zzc26uj]
ah, that was what have confuse me |
special Codeblock Syntax under Fivewin | Dear Jimmy
This syntax for codeblock, RETURN is required
[code=fw:2dbgq4k6]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /> <span style="color: #00C800;">local</span> bBlock<br /> bBlock := <|| <br /> <span style="color: #00C800;">local</span> a := <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">local</span> b := <span style="color: #000000;">2</span><br /> <span style="color: #00C800;">local</span> c := <span style="color: #000000;">3</span><br /> <span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br /> ><br /><br /> </div>[/code:2dbgq4k6] |
special Codeblock Syntax under Fivewin | Estimado Cristóbal,
La siguiente, sin return, es una sintaxis válida, que dará NIL como resultado de la operación Eval( bBlock )
[code=fw:j606xbn8]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">local</span> bBlock<br /> bBlock := <||<br /> <span style="color: #00C800;">local</span> a := <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">local</span> b := <span style="color: #000000;">2</span><br /> <span style="color: #00C800;">local</span> c := <span style="color: #000000;">3</span><br /> ><br /> </div>[/code:j606xbn8]
Atte. |
special Codeblock Syntax under Fivewin | Estimadísimo Paquito
Yo es que soy un poco perfeccionista y como al no tener RETURN me da el siguiente mensaje ( tengo los warnings activados ) y como sabemos un codeblock es tratado internamente como si fuese una FUNCTION [b:lkuvdhwk]Anonymous[/b:lkuvdhwk]
[quote:lkuvdhwk]
D:\FWH\FWHTEAM\SAMPLES\testtoast.prg(17) [b:lkuvdhwk]Warning W0007[/b:lkuvdhwk] Function '{||...}' does not end with RETURN statement
Compilation Errors
Link Error
[/quote:lkuvdhwk] |
special Codeblock Syntax under Fivewin | Hola Cristóbal,
Pues sí. Debe ser como tu dices: Los warning mandan y definen la sintaxis correcta.
Así en "stricto sensu" hay que poner un return en los extended codeblocks
Gracias por la aclaración |
special Codeblock Syntax under Fivewin | [quote:28h1r87s]It's not required return clause. Return clause it's neccessary only for return value
[/quote:28h1r87s]
"Return" is not required with xHarbour.
"Return" is required with Harbour.
So it is always safe to use return <someval> or return nil.
Our program should with both with Harbour and xHarbour.
It is always a good idea to keep our programs compatible with both Harbour and xHarbour and this is a must for us the FWteam.
It is safe to use this template:
[code=fw:28h1r87s]<div class="fw" id="{CB}" style="font-family: monospace;"><br />< |params,..|<br /> <span style="color: #B900B9;">// code</span><br /> <span style="color: #00C800;">return</span> any<br />><br /> </div>[/code:28h1r87s]
xHarbour:
Angular brackets is the right syntax for xHarbour and the return statement does not hurt xHarbour
Harbour:
Fivewin.ch translates the angular brackets ( < .. > ) to curly braces ( {..} ) when using Harbour and we also comply with the requirement of return statement.
Adantage of the extended codeblock syntax is that, we can use local variables and use commands like a normal program. |
special Codeblock Syntax under Fivewin | Thank you very much Mr. Rao for your extense y comprensive explication |
special characters in get box | Hello,
When I want to show a special character in a get, this does not show the right character. See example[code=fw:2uoopwli]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveMac.ch"</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oDlg <br /> <span style="color: #00C800;">local</span> cText1 := <span style="color: #ff0000;">"Abelia ×grandiflora"</span>, cText2 := <span style="color: #ff0000;">"Abelia schumannii 'Bumblebee'"</span>, cText3 := <span style="color: #ff0000;">"Ceanothus ×delilianus 'Henri Défossé' "</span><br /> <br /> SET DATE FRENCH<br /> <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"TestGet"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">400</span>, <span style="color: #000000;">200</span> FLIPPED<br /> <br /> @ <span style="color: #000000;">15</span>, <span style="color: #000000;">30</span> <span style="color: #0000ff;">SAY</span> <span style="color: #ff0000;">"Text1:"</span> <span style="color: #0000ff;">OF</span> oDlg<br /> <br /> @ <span style="color: #000000;">15</span>, <span style="color: #000000;">90</span> <span style="color: #0000ff;">GET</span> cText1 <span style="color: #0000ff;">OF</span> oDlg TOOLTIP <span style="color: #ff0000;">"a string with cross"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">350</span>, <span style="color: #000000;">25</span><br /><br /> @ <span style="color: #000000;">45</span>, <span style="color: #000000;">30</span> <span style="color: #0000ff;">SAY</span> <span style="color: #ff0000;">"Text2:"</span> <span style="color: #0000ff;">OF</span> oDlg<br /><br /> @ <span style="color: #000000;">45</span>, <span style="color: #000000;">90</span> <span style="color: #0000ff;">GET</span> cText2 <span style="color: #0000ff;">OF</span> oDlg TOOLTIP <span style="color: #ff0000;">"a string with apo"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">350</span>, <span style="color: #000000;">25</span><br /><br /> @ <span style="color: #000000;">75</span>, <span style="color: #000000;">30</span> <span style="color: #0000ff;">SAY</span> <span style="color: #ff0000;">"Text3:"</span> <span style="color: #0000ff;">OF</span> oDlg<br /><br /> @ <span style="color: #000000;">75</span>, <span style="color: #000000;">90</span> <span style="color: #0000ff;">GET</span> cText3 <span style="color: #0000ff;">OF</span> oDlg TOOLTIP <span style="color: #ff0000;">"a normal string"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">350</span>, <span style="color: #000000;">25</span><br /> <br /> @ <span style="color: #000000;">140</span>, <span style="color: #000000;">150</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Ok"</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> cText1 <span style="color: #000000;">)</span>, <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> cText2 <span style="color: #000000;">)</span>, <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> cText3 <span style="color: #000000;">)</span><br /> <br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /> <br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /> </div>[/code:2uoopwli]
But when I get the string from a database, the string is shown good, but I can't get the changed text in a msgbox
Rene |
special characters in get box | Rene,
The GETs look fine here:
[img:1532it13]https://bitbucket.org/fivetech/screenshots/downloads/Screen%20Shot%202016-09-07%20at%2009.35.15.png[/img:1532it13] |
special characters in get box | Rene,
Currently we are using the encoding NSUTF8StringEncoding to retrieve the string parameter:
NSString * hb_NSSTRING_par( int iParam )
{
return [ [ [ NSString alloc ] initWithCString: HB_ISCHAR( iParam ) ? hb_parc( iParam ) : "" encoding: NSUTF8StringEncoding ] autorelease ];
}
These are the possible encoding values:
[quote:snt1bex4]enum {
NSASCIIStringEncoding = 1,
NSNEXTSTEPStringEncoding = 2,
NSJapaneseEUCStringEncoding = 3,
NSUTF8StringEncoding = 4,
NSISOLatin1StringEncoding = 5,
NSSymbolStringEncoding = 6,
NSNonLossyASCIIStringEncoding = 7,
NSShiftJISStringEncoding = 8,
NSISOLatin2StringEncoding = 9,
NSUnicodeStringEncoding = 10,
NSWindowsCP1251StringEncoding = 11,
NSWindowsCP1252StringEncoding = 12,
NSWindowsCP1253StringEncoding = 13,
NSWindowsCP1254StringEncoding = 14,
NSWindowsCP1250StringEncoding = 15,
NSISO2022JPStringEncoding = 21,
NSMacOSRomanStringEncoding = 30,
NSUTF16StringEncoding = NSUnicodeStringEncoding,
NSUTF16BigEndianStringEncoding = 0x90000100,
NSUTF16LittleEndianStringEncoding = 0x94000100,
NSUTF32StringEncoding = 0x8c000100,
NSUTF32BigEndianStringEncoding = 0x98000100,
NSUTF32LittleEndianStringEncoding = 0x9c000100,
NSProprietaryStringEncoding = 65536
};
typedef NSUInteger NSStringEncoding;[/quote:snt1bex4] |
special characters in get box | This is the MsgInfo() source code:
HB_FUNC( MSGINFO )
{
NSString * msg, * title;
CocoaInit();
ValToChar( hb_param( 1, HB_IT_ANY ) );
msg = hb_NSSTRING_par( -1 );
if( [ msg length ] == 0 )
msg = @" " ;
if( hb_pcount() > 1 )
{
ValToChar( hb_param( 2, HB_IT_ANY ) );
title = hb_NSSTRING_par( -1 );
if( [ title length ] == 0 )
title = @"Attention" ;
}
else
title = @"Attention";
NSAlert * alert = [ [ NSAlert alloc ] init ];
alert.alertStyle = NSInformationalAlertStyle ;
alert.informativeText = msg ;
alert.messageText = title ;
[ alert addButtonWithTitle:@"OK"];
[ alert runModal ];
[ alert release ];
hb_ret();
}
If we change the enconding used in hb_NSSTRING_par(), then the MsgInfo() may look fine |
special characters in get box | Hello Antonio,
Thanks for the reply, but I get to see this on my screen:
[img:25lwal08]http://www.plantenkennis.com/downloads/Screenshot.png[/img:25lwal08]
Can/must I change the encoding somewhere?
Rene |
specific structure | how set a specific structure and call it into a function or
I must set this structure
typedef struct _gettextlengthex {;
DWORD flags;
UINT codepage;
} GETTEXTLENGTHEX |
specific structure | Is it to process a EM_GETTEXTLENGTHEX message ? |
specific structure | Silvio,
Try this:
MsgInfo( RELEN5( hWndRichEdit ) ) |
speed of browse | Hello,
I have browse where I show a table and some values of other tables. The main table is 8000 rec. When I click on a record I get a new window that shows the details of the record. When I scroll down the table and click on a record, the detail window takes a few seconds to open. When I close this window this also takes a few seconds. Is there a way to speed up things
[code=fw:jp299mbi]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">PUBLIC</span> oWnd, oBrw && the <span style="color: #0000ff;">window</span> and browse<br /> <span style="color: #00C800;">PUBLIC</span> aDatabases<span style="color: #000000;">[</span><span style="color: #000000;">0</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">8</span><span style="color: #000000;">]</span> && hold all databases<br /> <span style="color: #00C800;">PUBLIC</span> aIndexFiles<span style="color: #000000;">[</span><span style="color: #000000;">0</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> && holds alle indexfiles and indexkeys<br /> <span style="color: #00C800;">PUBLIC</span> aPlanttype<span style="color: #000000;">[</span><span style="color: #000000;">0</span><span style="color: #000000;">]</span> && alle planttypes<br /> <span style="color: #00C800;">PUBLIC</span> aFamilie<span style="color: #000000;">[</span><span style="color: #000000;">0</span><span style="color: #000000;">]</span> && alle families<br /> <span style="color: #00C800;">PUBLIC</span> aWinter<span style="color: #000000;">[</span><span style="color: #000000;">21</span><span style="color: #000000;">]</span><br /> <span style="color: #00C800;">PUBLIC</span> aWinterKort<span style="color: #000000;">[</span><span style="color: #000000;">21</span><span style="color: #000000;">]</span><br /> <span style="color: #00C800;">PUBLIC</span> aNachtvorst<span style="color: #000000;">[</span><span style="color: #000000;">13</span><span style="color: #000000;">]</span><br /> <span style="color: #00C800;">PUBLIC</span> aGegevenSoort<span style="color: #000000;">[</span><span style="color: #000000;">0</span><span style="color: #000000;">]</span><br /> <br /> <span style="color: #00C800;">PUBLIC</span> cPath := Path<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">PUBLIC</span> leigen := .T.<br /> <span style="color: #00C800;">PUBLIC</span> lPro := .T.<br /> <span style="color: #00C800;">PUBLIC</span> lEtiket := .F.<br /> <span style="color: #00C800;">PUBLIC</span> cDataBasePad := cPath + <span style="color: #ff0000;">"/databases/"</span><br /> <span style="color: #00C800;">PUBLIC</span> cIconsPad := cPath + <span style="color: #ff0000;">"/iconen/"</span><br /> <span style="color: #00C800;">PUBLIC</span> oBrw<br /> <br /> SET DELETED <span style="color: #0000ff;">ON</span><br />* SET LANGUAGE <span style="color: #0000ff;">TO</span> DUTCH<br /><br /> RK_FillArrays<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> RK_BestandsControle<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> RK_OpenTables<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #0000ff;">SELECT</span> Latnaam<br />SET ORDER <span style="color: #0000ff;">TO</span> <span style="color: #000000;">2</span><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Plantenkennis, het meest uitgebreide planteninformatie programma"</span> ;<br /> <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #0000ff;">TO</span> ScreenHeight<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, <span style="color: #000000;">1000</span><br /><br /> RK_BuildMenu<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> RK_BuildBar<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> RK_BuildBrowse<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #0000ff;">DEFINE</span> MSGBAR <span style="color: #0000ff;">OF</span> oWnd<br /><br /> @ <span style="color: #000000;">0</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">SAY</span> <span style="color: #ff0000;">"A FiveMac MsgBar"</span> <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">150</span>, <span style="color: #000000;">20</span> RAISED<br /> <br /><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd ;<br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br />*************************************************<br /><br /><span style="color: #00C800;">FUNCTION</span> RK_BuildMenu<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oMenu<br /> <br /> <span style="color: #0000ff;">MENU</span> oMenu<br /> <span style="color: #0000ff;">MENUITEM</span> <span style="color: #ff0000;">"Bestand"</span><br /> <span style="color: #0000ff;">MENU</span><br /> <span style="color: #0000ff;">MENUITEM</span> <span style="color: #ff0000;">"Over Plantenkennis"</span> <span style="color: #0000ff;">ACTION</span> RK_<br /> <span style="color: #0000ff;">MENUITEM</span> <span style="color: #ff0000;">"Item 2"</span><br /> <span style="color: #0000ff;">SEPARATOR</span><br /> <span style="color: #0000ff;">MENUITEM</span> <span style="color: #ff0000;">"Afsluiten"</span> <span style="color: #0000ff;">ACTION</span> oWnd:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">ENDMENU</span><br /> <span style="color: #0000ff;">MENUITEM</span> <span style="color: #ff0000;">"zoeken"</span><br /> <span style="color: #0000ff;">MENU</span><br /> <span style="color: #0000ff;">MENUITEM</span> <span style="color: #ff0000;">"zoeken op plantkode"</span><br /> <span style="color: #0000ff;">ENDMENU</span><br /> <br /> <span style="color: #0000ff;">ENDMENU</span><br /> <br /><span style="color: #00C800;">RETURN</span> oMenu<br /><br />*************************************************<br /><br /><span style="color: #00C800;">FUNCTION</span> RK_BuildBar<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">LOCAL</span> nZoeken := <span style="color: #ff0000;">" "</span><br /><span style="color: #00C800;">LOCAL</span> nRow := <span style="color: #000000;">250</span><br /><span style="color: #00C800;">LOCAL</span> nShift := <span style="color: #000000;">28</span><br /><span style="color: #00C800;">LOCAL</span> oBtn3, oBtn4, oBtn5, oBtn6<br /><br />@ Screenheight<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">-130</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">SAY</span> <span style="color: #ff0000;">"Snelzoeken:"</span> <span style="color: #0000ff;">OF</span> oWnd<br />@ Screenheight<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">-125</span>, <span style="color: #000000;">100</span> <span style="color: #0000ff;">GET</span> nZoeken <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"@!"</span> <span style="color: #0000ff;">OF</span> oWnd TOOLTIP <span style="color: #ff0000;">"snel zoeken"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">150</span>, <span style="color: #000000;">25</span><br /><br />@ Screenheight<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">-130</span>, nRow <span style="color: #0000ff;">BUTTON</span> oBtn3 <span style="color: #0000ff;">OF</span> oWnd FILENAME <span style="color: #ff0000;">"foto.bmp"</span> ; <br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"hallo"</span><span style="color: #000000;">)</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">30</span>, <span style="color: #000000;">30</span> <span style="color: #0000ff;">STYLE</span> <span style="color: #000000;">4</span><br /> nRow := nRow + nShift<br />@ Screenheight<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">-130</span>, nRow <span style="color: #0000ff;">BUTTON</span> oBtn4 <span style="color: #0000ff;">OF</span> oWnd FILENAME <span style="color: #ff0000;">"foto.bmp"</span> ; <br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"hallo"</span><span style="color: #000000;">)</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">30</span>, <span style="color: #000000;">30</span> <span style="color: #0000ff;">STYLE</span> <span style="color: #000000;">2</span><br /> nRow := nRow + nShift<br />@ Screenheight<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">-130</span>, nRow <span style="color: #0000ff;">BUTTON</span> oBtn5 <span style="color: #0000ff;">OF</span> oWnd FILENAME <span style="color: #ff0000;">"foto.bmp"</span> ; <br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"hallo"</span><span style="color: #000000;">)</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">30</span>, <span style="color: #000000;">30</span> <span style="color: #0000ff;">STYLE</span> <span style="color: #000000;">3</span><br /> nRow := nRow + nShift<br />@ Screenheight<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">-130</span>, nRow <span style="color: #0000ff;">BUTTON</span> oBtn6 <span style="color: #0000ff;">OF</span> oWnd FILENAME <span style="color: #ff0000;">"foto.bmp"</span> ; <br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"hallo"</span><span style="color: #000000;">)</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">30</span>, <span style="color: #000000;">30</span> <span style="color: #0000ff;">STYLE</span> <span style="color: #000000;">4</span><br /><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br />*************************************************<br /><br /><span style="color: #00C800;">FUNCTION</span> RK_BuildBrowse<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br />@ <span style="color: #000000;">20</span>, <span style="color: #000000;">10</span> BROWSE oBrw ;<br /> FIELDS RK_GetFoto<span style="color: #000000;">(</span>plantnum<span style="color: #000000;">)</span>, Latnaam->Plantkode, Latnaam->Naam, RK_GetNederNaam<span style="color: #000000;">(</span>plantnum<span style="color: #000000;">)</span>, RK_GetPlanttype<span style="color: #000000;">(</span>plantnum<span style="color: #000000;">)</span>;<br /> HEADERS <span style="color: #ff0000;">""</span>, <span style="color: #ff0000;">"Plantkode"</span>, <span style="color: #ff0000;">"Latijnse naam"</span>, <span style="color: #ff0000;">"Nederlandse naam"</span>, <span style="color: #ff0000;">"Planttype"</span> ;<br /> <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">950</span>, ScreenHeight<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">-150</span> <span style="color: #0000ff;">ALIAS</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br />oBrw:<span style="color: #000000;">SetColBmp</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br />oBrw:<span style="color: #000000;">SetColWidth</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span><br />oBrw:<span style="color: #000000;">SetColWidth</span><span style="color: #000000;">(</span> <span style="color: #000000;">2</span>, <span style="color: #000000;">100</span> <span style="color: #000000;">)</span><br />oBrw:<span style="color: #000000;">SetColWidth</span><span style="color: #000000;">(</span> <span style="color: #000000;">3</span>, <span style="color: #000000;">350</span> <span style="color: #000000;">)</span><br />oBrw:<span style="color: #000000;">SetColWidth</span><span style="color: #000000;">(</span> <span style="color: #000000;">4</span>, <span style="color: #000000;">250</span> <span style="color: #000000;">)</span><br />oBrw:<span style="color: #000000;">SetColWidth</span><span style="color: #000000;">(</span> <span style="color: #000000;">5</span>, <span style="color: #000000;">150</span> <span style="color: #000000;">)</span><br />oBrw:<span style="color: #000000;">SetColEditable</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span>, .F. <span style="color: #000000;">)</span><br />oBrw:<span style="color: #000000;">SetColEditable</span><span style="color: #000000;">(</span> <span style="color: #000000;">2</span>, .F. <span style="color: #000000;">)</span><br />oBrw:<span style="color: #000000;">SetColEditable</span><span style="color: #000000;">(</span> <span style="color: #000000;">3</span>, .F. <span style="color: #000000;">)</span><br />oBrw:<span style="color: #000000;">SetColEditable</span><span style="color: #000000;">(</span> <span style="color: #000000;">4</span>, .F. <span style="color: #000000;">)</span><br />oBrw:<span style="color: #000000;">SetColEditable</span><span style="color: #000000;">(</span> <span style="color: #000000;">5</span>, .F. <span style="color: #000000;">)</span><br />oBrw:<span style="color: #000000;">SetColor</span><span style="color: #000000;">(</span> OwnClrGreen, OwnClrYellow <span style="color: #000000;">)</span><br />oBrw:<span style="color: #000000;">SetRowHeight</span><span style="color: #000000;">(</span> <span style="color: #000000;">20</span> <span style="color: #000000;">)</span><br />oBrw:<span style="color: #000000;">SetFont</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Geneva"</span>, <span style="color: #000000;">14</span> <span style="color: #000000;">)</span><br /><br />oBrw:<span style="color: #000000;">bClrText</span> = <span style="color: #000000;">{</span> | pColumn, nRowIndex | ColorFromNRGB<span style="color: #000000;">(</span> <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> <span style="color: #0000ff;">SUBSTR</span><span style="color: #000000;">(</span>STR<span style="color: #000000;">(</span>plantnum<span style="color: #000000;">)</span>,<span style="color: #000000;">-1</span>,<span style="color: #000000;">1</span><span style="color: #000000;">)</span> == <span style="color: #ff0000;">'1'</span>, OwnClrLightGreen , OwnClrGreen <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br />*oBrw:<span style="color: #000000;">bAction</span> = <span style="color: #000000;">{</span> || RK_ShowDetail<span style="color: #000000;">(</span>plantnum<span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <br /> oBrw:<span style="color: #000000;">bAction</span> := <span style="color: #000000;">{</span> | obj , nindex| RK_ShowDetail<span style="color: #000000;">(</span>plantnum<span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <br />oBrw:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br />*************************************************<br /><br /><span style="color: #00C800;">FUNCTION</span> RK_ShowDetail<span style="color: #000000;">(</span>nPlantnum<span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">LOCAL</span> oDlg<br /><span style="color: #00C800;">LOCAL</span> oFld, oBrw1, oBrw2<br /><span style="color: #00C800;">LOCAL</span> oGetNaam, oGetAanteken<br /><span style="color: #00C800;">LOCAL</span> oImg<br /><span style="color: #00C800;">LOCAL</span> cLatijnNaam := RK_GetLatijnseNaam<span style="color: #000000;">(</span>nPlantnum<span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> aGegevens := RK_CollectGegevens<span style="color: #000000;">(</span>nPlantnum<span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> aKenmerken := RK_CollectKenmerken<span style="color: #000000;">(</span>nPlantnum<span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> cText := <span style="color: #ff0000;">''</span><br /><span style="color: #00C800;">LOCAL</span> cSnoei := RK_GetSnoei<span style="color: #000000;">(</span>nPlantnum<span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> aFotoNaam := RK_CollectFoto<span style="color: #000000;">(</span>nPlantnum<span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> nRow := <span style="color: #000000;">260</span><br /><span style="color: #00C800;">LOCAL</span> nKolom := <span style="color: #000000;">10</span><br /><span style="color: #00C800;">LOCAL</span> nFoto := <span style="color: #000000;">1</span><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Detailscherm"</span> ;<br /> <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">500</span>, <span style="color: #000000;">720</span><br /><br /> @ <span style="color: #000000;">450</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">GET</span> oGetNaam <span style="color: #0000ff;">VAR</span> cLatijnNaam <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">700</span>, <span style="color: #000000;">40</span><br /> <br /> oGetNaam:<span style="color: #000000;">SetFont</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Geneva"</span>, <span style="color: #000000;">28</span> <span style="color: #000000;">)</span><br /> oGetNaam:<span style="color: #000000;">SetColor</span><span style="color: #000000;">(</span> OwnClrGreen, OwnClrYellow <span style="color: #000000;">)</span><br /> <br /> @ <span style="color: #000000;">40</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">FOLDER</span> oFld <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">700</span>, <span style="color: #000000;">400</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> PAGES <span style="color: #ff0000;">"Gegevens"</span>, <span style="color: #ff0000;">"Kenmerken"</span>, <span style="color: #ff0000;">"Aantekeningen"</span>, <span style="color: #ff0000;">"Fotos"</span>, <span style="color: #ff0000;">"Snoei"</span><br /><span style="color: #B900B9;">/* <br />*eerste tabblad, gegevens<br /> @ 0, 0 BROWSE oBrw1 FIELDS "", "" ;<br /> HEADERS "", "" ;<br /> OF oFld:aDialogs[ 1 ] SIZE 680, 350<br /><br /> oBrw1:SetArray( aGegevens )<br /> oBrw1:bLine = { | nRow | IF( nRow <= Len( aGegevens ), aGegevens[ nRow ], { "", "" } ) }<br /> oBrw1:SetColWidth( 1, 150 )<br /> oBrw1:SetColWidth( 2, 500 )<br /> oBrw1:SetColor( OwnClrGreen, OwnClrYellow )<br /> oBrw1:SetFocus()<br /> <br />*tweede tabblad, kenmerken<br /> @ 0, 0 BROWSE oBrw2 FIELDS "", "" ;<br /> HEADERS "", "" ;<br /> OF oFld:aDialogs[ 2 ] SIZE 680, 350<br /><br /> oBrw2:SetArray( aKenmerken )<br /> oBrw2:bLine = { | nRow | If( nRow <= Len( aKenmerken ), aKenmerken[ nRow ], { "", "" } ) }<br /> oBrw2:SetColWidth( 1, 150 )<br /> oBrw2:SetColWidth( 2, 500 )<br /> oBrw2:SetColor( OwnClrGreen, OwnClrYellow )<br /> oBrw2:SetFocus()<br /><br />*derde tabblad, aantekeningen <br /> @ 0, 0 GET oGetAanteken VAR cText MEMO OF oFld:aDialogs[ 3 ] SIZE 680, 400<br /> <br /> oGetAanteken:SetRichText(.T.)<br /> oGetAanteken:SetImportGraf(.T.)<br />* oGetAanteken:AddHRuler()<br /> oGetAanteken:SetUndo(.T.)<br /> oGetAanteken:SetFocus()<br /> oGetAanteken:SetEditable(.F.)<br /> cText := RK_GetAanteken(nPlantnum)<br /> oGetAanteken:SetAttributedString(cText)<br /> oGetAanteken:GoTop()<br /><br />*vierde tabblad, foto's<br /> FOR r = 1 TO 3<br /> FOR k = 1 TO 5<br /> @ nRow, nKolom IMAGE oImg OF oFld:aDialogs[ 4 ] SIZE 110, 110 FILENAME aFotoNaam[nFoto]<br /> nKolom := nKolom + 120<br /> nFoto++<br /> NEXT<br /> nKolom := 10<br /> nRow := nRow - 120<br /> NEXT<br /> * oImg:Click()<br /><br />*vijfde tabblad, snoei<br /> @ 0, 0 GET oGetSnoei VAR cSnoei MEMO OF oFld:aDialogs[ 5 ] SIZE 680, 400<br /> <br />* oGetSnoei:SetRichText(.T.)<br />* oGetSnoei:SetImportGraf(.T.)<br />* oGetSnoei:AddHRuler()<br />* oGetSnoei:SetUndo(.T.)<br /> oGetSnoei:SetFocus()<br />* cSnoei := RK_GetSnoei(nPlantnum)<br />* oGetSnoei:SetAttributedString(cSnoei)<br />* oGetSnoei:GoTop()<br />*/</span> <br /> @ <span style="color: #000000;">10</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"OK"</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br />oBrw:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:jp299mbi]
Rene |
speed of browse | Rene,
Please email me your PRGs so I can run your app here, thanks |
speek class | Sto provando la classe speeck di Cesar
se non l'avete posso postarla
io voorei modificarla in modo da poter * leggere* qualsiasi scritta
cioè se io clicco su un menu mi deve leggere il prompt di quel menu
come posso fare ? |
spell check with word activex | HI, someone already try use an way to use spell check with ms word, maybe using activex?
i need make spell check in memo , in portuguese-br , someone try this?
thanks |
spell check with word activex | I have not used it, but others here are using this spell checker with FWH.
<!-- m --><a class="postlink" href="http://www.wintertree-software.com/dev/ssce/windows/index.html#Catalog">http://www.wintertree-software.com/dev/ ... ml#Catalog</a><!-- m -->
It is US$399 and you can get a Brazilian dictionary.
James |
spell check with word activex | Friends:
Yes, I have a little function to use the ms-word spell checker, if it can help
I can post it.
Regards |
spell check with word activex | Armando, please... |
spell check with word activex | Friends:
Here is
This is the way to call the SpellCheck function
[code=fw:2ehjs8d5]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oPro:<span style="color: #000000;">DES</span> := SpellCheck<span style="color: #000000;">(</span>oPro:<span style="color: #000000;">DES</span><span style="color: #000000;">)</span><br /> </div>[/code:2ehjs8d5]
And here is the SpellCheck function
[code=fw:2ehjs8d5]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> SpellCheck<span style="color: #000000;">(</span>Texto<span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> oWord,oDoc,oTexto<br /><span style="color: #00C800;">LOCAL</span> cText:=Texto<br /><br />oWord:=TOleAuto<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Word.Application"</span> <span style="color: #000000;">)</span><br />oWord:<span style="color: #000000;">Visible</span> := .F.<br />oWord:<span style="color: #000000;">Documents</span>:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oDoc := oWord:<span style="color: #0000ff;">Get</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"ActiveDocument"</span><span style="color: #000000;">)</span><br /><br />oTexto := oWord:<span style="color: #000000;">Selection</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oTexto:<span style="color: #0000ff;">Text</span> := Texto<br /><br />oDoc:<span style="color: #000000;">CheckSpelling</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br />cText := oTexto:<span style="color: #0000ff;">Text</span><br /><br />oDoc:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span><br />oWord:<span style="color: #000000;">Quit</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oTexto:=<span style="color: #00C800;">NIL</span><br />oDoc:=<span style="color: #00C800;">NIL</span><br />oWord:=<span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">IF</span> ! EMPTY<span style="color: #000000;">(</span>cText<span style="color: #000000;">)</span> <span style="color: #B900B9;">// If ctext is empty that means that the process was canceled</span><br /> Texto := cText<br /><span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span>Texto<span style="color: #000000;">)</span><br /> </div>[/code:2ehjs8d5]
With best regards |
spell check with word activex | HI Armando, very thanks, works very fine... <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> let me ask : if i want know if word is present in computer? maybe an function <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: --> |
spell check with word activex | Norberto:
Oppps, I don't know <!-- s:oops: --><img src="{SMILIES_PATH}/icon_redface.gif" alt=":oops:" title="Embarassed" /><!-- s:oops: --> , perhaps somebody can help us, or Test and error .
Sorry |
spell check with word activex | [quote="norberto":1ejgwply]HI Armando, very thanks, works very fine... <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> let me ask : if i want know if word is present in computer? maybe an function <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->[/quote:1ejgwply]
You could look in the register, I suggest you to install 98, 2003, 2007 and 2010 in your computer to look what register is created |
spell check with word activex | you can test like this
[code=fw:3dzcmcs9]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /> <span style="color: #00C800;">TRY</span><br /> oWORD := CREATEOBJECT<span style="color: #000000;">(</span> <span style="color: #ff0000;">"word.Application"</span> <span style="color: #000000;">)</span><br /> CATCH<br /> <span style="color: #00C800;">TRY</span><br /> oWORD := CREATEOBJECT<span style="color: #000000;">(</span> <span style="color: #ff0000;">"word.Application"</span> <span style="color: #000000;">)</span><br /> CATCH<br /> <span style="color: #B900B9;">// no word is installed</span><br /> <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> END<br /> END<br /><br /><br /> </div>[/code:3dzcmcs9] |
spell check with word activex | Richard,
Please explain why you need two TRY/CATCHes?
Wouldn't something like this work?
James
[code=fw:3syvn32i]<div class="fw" id="{CB}" style="font-family: monospace;">isWord<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> lSuccess:=.F.<br /> <span style="color: #00C800;">local</span> oWord<br /> <span style="color: #00C800;">TRY</span> <br /> oWord:= createObject<span style="color: #000000;">(</span><span style="color: #ff0000;">"word.Application"</span><span style="color: #000000;">)</span><br /> lSuccess:=.T.<br /> CATCH<br /> lSuccess:=.F.<br /> END<br /><span style="color: #00C800;">return</span> lSuccess</div>[/code:3syvn32i] |
spell check with word activex | Hi, i use :
.....
TRY
oWord:=TOleAuto():New( "Word.Application" )
CATCH
Msginfo( "Word não instalado!!" )
Return(Texto)
END
....
and works fine.
why some people use toleauto and another createobject, is the same??
thanks |
spell check with word activex | James
This code has been in my application since quite a while and running ok
From my notes, Ole prompted error many times at first try , this is why i embedded try catch to solve this and it solved it at that time.
Maybe now , only one try/catch is enough ,
My purpose was just to show the way testing ms word's presence
HTH
Richard |
spell check with word activex | Richard,
I wasn't being critical--I figured you had a reason and it seems you did. Even if two aren't needed always it is probably better to use them if there is a possibility of a false error.
Thanks for the sample.
James |
spell check with word activex | Hi,
Once the spell check is completed, I am getting a dialog with following messages:
"This file is in use by another application or user."
(C:\Documents and Settings\..\Normaldot)
and also getting
Save as dialog box.
How to avoid this.
Regards,
- Ramesh Babu P |
spell check with word activex | Hi everyone.
I'm using a dll that you only purchase once and is then distributable with your app. It works well and you don't need to have word installed on the computer. In the long (or even short) run it is less expensive than having Word on the workstation. It has very many functions and it might work just like the word's spell checker where you may even suggest and show errors as the user types. The product is called SSCE and the company is Wintertree. I highly recommend it. Here is some sample code where I'm using it. This will check for errors the text on the hWnd window handle:
[code=fw:cauysz3f]<div class="fw" id="{CB}" style="font-family: monospace;"> SSCE_CheckCtrlBackgroundRecheckAll<span style="color: #000000;">(</span> ::<span style="color: #000000;">oActive</span>:<span style="color: #000000;">hWnd</span>, SSCE_OPTION, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">254</span>, <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, <span style="color: #000000;">)</span>,;<br /> </div>[/code:cauysz3f]
Here as the user presses the space bar I check if the word is misspelled:
[code=fw:cauysz3f]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">CASE</span> nKey == <span style="color: #000000;">32</span> <br /> SSCE_CheckCtrlBackgroundNotify<span style="color: #000000;">(</span> ::<span style="color: #000000;">oActive</span>:<span style="color: #000000;">hWnd</span>, SSCE_OPTION, RGB<span style="color: #000000;">(</span><span style="color: #000000;">254</span>, <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> </div>[/code:cauysz3f]
In both of these samples, if the word is misspelled, it will be shown as RGB( 254, 1, 1 ).
It has worked very good for me. I hope it helps others.
Reinaldo. |
spinner | Antonio
Do you plan to have spinners installed on fw ppc ?
They can be very handy to avoid typing numbers in several cases.
Tia
Richard |
spinner control | I try to use get with spinner but it make error
but
I found on Internet this possibility
HWND hwndList = CreateWindow(_T("listbox"), _T(""), WS_VISIBLE|LBS_NOINTEGRALHEIGHT|WS_CHILD|WS_TABSTOP|LBS_NOTIFY, x, y, width, height, m_hDlg, (HMENU)nControlId, g_hInst, NULL);
HWND hwndUpDown = CreateWindow(UPDOWN_CLASS, NULL, WS_VISIBLE|UDS_HORZ|UDS_ALIGNRIGHT|UDS_ARROWKEYS|UDS_SETBUDDYINT|UDS_WRAP|UDS_EXPANDABLE, 0, 0, 0, 0, m_hDlg, (HMENU)0, g_hInst, 0L);
SendMessage(hwndUpDown, UDM_SETBUDDY, (WPARAM)hwndList, 0);
but I not Know How translate in fwppc |
splitter sample | Antonio,
I tried splitter test sample n. 3
and I have the sample problem
I wish when the use resize the wnd the vertical splitter must be moved
at left if the ownd is rresize on the left
at right if the ownd is resize on the right |
splitter sample | Please post some screenshots, thanks |
splitter sample | testspl3.prg
I resize the window to left
[img:9b8btzvs]http://www.eoeo.it/wp-content/uploads/2016/03/1.jpg[/img:9b8btzvs]
the vertical splitter must be moved to left
[img:9b8btzvs]http://www.eoeo.it/wp-content/uploads/2016/03/2.jpg[/img:9b8btzvs]
the vertical splitter should be moved to the left
Now it is stopped at the same positon so when the user resizes the window no longer sees the grid placed on the right |
splitter sample | Silvio,
add to this sample the following :
( works in both directions )
...
...
ACTIVATE WINDOW oWnd ;
ON RESIZE ( oVSplit:AdjLeft(), oHSplit:AdjRight(), [color=#0000FF:1ytzef0e]ADJUST_POS(oWnd)[/color:1ytzef0e] )
return nil
// --------------------------
// DEFINE WINDOW oWnd FROM 1, 1 TO 400, [color=#FF0000:1ytzef0e]600[/color:1ytzef0e] PIXEL ;
// @ 0,[color=#FF0000:1ytzef0e]200[/color:1ytzef0e] SPLITTER oVSplit ;
[color=#0000FF:1ytzef0e]FUNCTION ADJUST_POS(oWnd)[/color:1ytzef0e]
[color=#0000FF:1ytzef0e]oVSplit:SetPosition([/color:1ytzef0e] [color=#FF0000:1ytzef0e]200[/color:1ytzef0e] [color=#0000FF:1ytzef0e]- ([/color:1ytzef0e] [color=#FF0000:1ytzef0e]600[/color:1ytzef0e] - [color=#0000FF:1ytzef0e]oWnd:nWidth() ) )[/color:1ytzef0e]
[color=#0000FF:1ytzef0e]RETURN NIL [/color:1ytzef0e]
[img:1ytzef0e]http://www.pflegeplus.com/IMAGES/Splitter1.jpg[/img:1ytzef0e]
best regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
splitter sample | thanks Uwe,
it seems tio run ok
On Mt application I must change the position but it run . thanks |
splitter browse y outlook | Hola a todos del foro
Tengo una ventana mdi, y quiero que al lado derecho aparesca el outlook con opciones de gestion que ya lo hice, pongo un splitter a su costado, y al lado derecho quiero el twbrowse, pero no me sale el browse.
Que ma falta para hacer esto...
Salu2
Francis |
splitter browse y outlook | Busca FSDI, hace lo que tu quieres. Cuando lo encuentres le mandas un mensaje a José Luis Sanchez <!-- s;) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";)" title="Wink" /><!-- s;) -->
Saludos
Carlos |
sql 2 dbf | How I can converte a sql database into dbf ? |
sql 2 dbf | Silvio.
1.-create connection with database (mysql/mssql/firebird/postgreesql)
2.-create a structucture of dbf based in the structure of table sql.
3.-read the table sql record by record and insert in table dbf the fields of the recordset.
NOTE: you can use ADO for the read the data in sql.
sorry for my bad english.
salu2
carlos vargas |
sql 2 dbf | sorry but I not Know the structure of sql file
I have only this file xxx.sql and I must converte it on dbf |
sql 2 dbf | usually the sql file have the structure inside.
and have the sql statement insert into for each row in the table.
if you do not know the structura of the table, I doubt that a program can know this unless defined in the same sql.
this is a example for a sql from mysql:
note in file the code for delete the table if this exist.
then create table and insert the row with data.
[code=fw:hl4incnz]<div class="fw" id="{CB}" style="font-family: monospace;"><br />-- Tiempo de generación: <span style="color: #000000;">09</span><span style="color: #000000;">-11</span><span style="color: #000000;">-2009</span> a las <span style="color: #000000;">15</span>:<span style="color: #000000;">54</span>:<span style="color: #000000;">43</span><br />-- Versión del servidor: <span style="color: #000000;">5.0</span><span style="color: #000000;">.51</span><br />-- Versión de PHP: <span style="color: #000000;">4.4</span><span style="color: #000000;">.4</span><br />-- <br />-- Base de datos: `bdc`<br />-- <br /><br />-- --------------------------------------------------------<br /><br />-- <br />-- Estructura de tabla para la tabla `categorias`<br />-- <br /><br />DROP TABLE <span style="color: #00C800;">IF</span> <span style="color: #0000ff;">EXISTS</span> `categorias`;<br />CREATE TABLE <span style="color: #00C800;">IF</span> NOT <span style="color: #0000ff;">EXISTS</span> `categorias` <span style="color: #000000;">(</span><br /> `<span style="color: #0000ff;">id</span>` int<span style="color: #000000;">(</span><span style="color: #000000;">11</span><span style="color: #000000;">)</span> NOT <span style="color: #00C800;">NULL</span> auto_increment,<br /> `idcategoria` varchar<span style="color: #000000;">(</span><span style="color: #000000;">10</span><span style="color: #000000;">)</span> NOT <span style="color: #00C800;">NULL</span> <span style="color: #00C800;">default</span> <span style="color: #ff0000;">'C0'</span>,<br /> `nombrec` varchar<span style="color: #000000;">(</span><span style="color: #000000;">250</span><span style="color: #000000;">)</span> NOT <span style="color: #00C800;">NULL</span> <span style="color: #00C800;">default</span> <span style="color: #ff0000;">''</span>,<br /> `orden` int<span style="color: #000000;">(</span><span style="color: #000000;">10</span><span style="color: #000000;">)</span> NOT <span style="color: #00C800;">NULL</span>,<br /> PRIMARY KEY <span style="color: #000000;">(</span>`<span style="color: #0000ff;">id</span>`<span style="color: #000000;">)</span><br /><span style="color: #000000;">)</span> ENGINE=MyISAM AUTO_INCREMENT=<span style="color: #000000;">16</span> <span style="color: #00C800;">DEFAULT</span> CHARSET=latin1 AUTO_INCREMENT=<span style="color: #000000;">16</span> ;<br /><br />-- <br />-- Volcar la base de datos para la tabla `categorias`<br />-- <br /><br />INSERT INTO `categorias` VALUES <span style="color: #000000;">(</span><span style="color: #000000;">1</span>, <span style="color: #ff0000;">'C01'</span>, <span style="color: #ff0000;">'Cumpleaños'</span>, <span style="color: #000000;">2</span><span style="color: #000000;">)</span>;<br />INSERT INTO `categorias` VALUES <span style="color: #000000;">(</span><span style="color: #000000;">2</span>, <span style="color: #ff0000;">'C02'</span>, <span style="color: #ff0000;">'Aniversario'</span>, <span style="color: #000000;">1</span><span style="color: #000000;">)</span>;<br />INSERT INTO `categorias` VALUES <span style="color: #000000;">(</span><span style="color: #000000;">3</span>, <span style="color: #ff0000;">'C03'</span>, <span style="color: #ff0000;">'DÃa de la Madre'</span>, <span style="color: #000000;">11</span><span style="color: #000000;">)</span>;<br />INSERT INTO `categorias` VALUES <span style="color: #000000;">(</span><span style="color: #000000;">4</span>, <span style="color: #ff0000;">'C04'</span>, <span style="color: #ff0000;">'Felicitaciones'</span>, <span style="color: #000000;">3</span><span style="color: #000000;">)</span>;<br />INSERT INTO `categorias` VALUES <span style="color: #000000;">(</span><span style="color: #000000;">5</span>, <span style="color: #ff0000;">'C05'</span>, <span style="color: #ff0000;">'Corporativo'</span>, <span style="color: #000000;">4</span><span style="color: #000000;">)</span>;<br />INSERT INTO `categorias` VALUES <span style="color: #000000;">(</span><span style="color: #000000;">6</span>, <span style="color: #ff0000;">'C06'</span>, <span style="color: #ff0000;">'Mejorate Pronto'</span>, <span style="color: #000000;">5</span><span style="color: #000000;">)</span>;<br />INSERT INTO `categorias` VALUES <span style="color: #000000;">(</span><span style="color: #000000;">7</span>, <span style="color: #ff0000;">'C07'</span>, <span style="color: #ff0000;">'Buena Suerte'</span>, <span style="color: #000000;">6</span><span style="color: #000000;">)</span>;<br />INSERT INTO `categorias` VALUES <span style="color: #000000;">(</span><span style="color: #000000;">8</span>, <span style="color: #ff0000;">'C08'</span>, <span style="color: #ff0000;">'Nacimientos'</span>, <span style="color: #000000;">7</span><span style="color: #000000;">)</span>;<br />INSERT INTO `categorias` VALUES <span style="color: #000000;">(</span><span style="color: #000000;">9</span>, <span style="color: #ff0000;">'C09'</span>, <span style="color: #ff0000;">'Románticos'</span>, <span style="color: #000000;">8</span><span style="color: #000000;">)</span>;<br />INSERT INTO `categorias` VALUES <span style="color: #000000;">(</span><span style="color: #000000;">10</span>, <span style="color: #ff0000;">'C10'</span>, <span style="color: #ff0000;">'Muchas Gracias'</span>, <span style="color: #000000;">9</span><span style="color: #000000;">)</span>;<br />INSERT INTO `categorias` VALUES <span style="color: #000000;">(</span><span style="color: #000000;">11</span>, <span style="color: #ff0000;">'C11'</span>, <span style="color: #ff0000;">'Pensando en Ti'</span>, <span style="color: #000000;">10</span><span style="color: #000000;">)</span>;<br />INSERT INTO `categorias` VALUES <span style="color: #000000;">(</span><span style="color: #000000;">12</span>, <span style="color: #ff0000;">'C12'</span>, <span style="color: #ff0000;">'DÃa del Padre'</span>, <span style="color: #000000;">12</span><span style="color: #000000;">)</span>;<br />INSERT INTO `categorias` VALUES <span style="color: #000000;">(</span><span style="color: #000000;">14</span>, <span style="color: #ff0000;">'C14'</span>, <span style="color: #ff0000;">'Ocaciones Especiales'</span>, <span style="color: #000000;">14</span><span style="color: #000000;">)</span>;<br />INSERT INTO `categorias` VALUES <span style="color: #000000;">(</span><span style="color: #000000;">13</span>, <span style="color: #ff0000;">'C13'</span>, <span style="color: #ff0000;">'Niños'</span>, <span style="color: #000000;">13</span><span style="color: #000000;">)</span>;<br />INSERT INTO `categorias` VALUES <span style="color: #000000;">(</span><span style="color: #000000;">15</span>, <span style="color: #ff0000;">'C15'</span>, <span style="color: #ff0000;">'Centros para Piñatas'</span>, <span style="color: #000000;">15</span><span style="color: #000000;">)</span>;<br /><br /> </div>[/code:hl4incnz]
salu2
carlos vargas |
sql 2 dbf | Carlos:
I think Silvio is looking for a class/function like DIRECTORY() but for TABLES instead DBFs.
Silvio:
Search for ADOX in saint google.
Regards. |
sql 2 dbf | I CAN SEND YOU MY FILE IF YOU WANT TRY TO CONVERTE IT
i NOT kNOW THE STRUCTURE OF THIS FILE
A SCHOOL GIVE ME A FILE BIBLIO.SQL i MUST CONVERTE IT INTO DBF FILE BECUASE i ALLREADY MADE A BIBLIO APPLICATION ON 2001
IT I FOUND THE SOLUTION TO CONVERTE IT INTO DBF i CAN SAVE ALL RECORDS ON MY DBF FILE AND THIS SCHOOL CAN USE MY APPLICATION |
sql 2 dbf | Silvio, sendme your 'database.sql' backup, i will try it. |
sql 2 dbf | Silvio,
I can try, please end me the file sql. <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
karlos.vargas at gmail.com
salu2
carlos vargas |
sql 2 dbf | Try a software name SQL Converter |
sql 2 dbf | carlos I sent you the file at donbxxxx.... email |
sql 2 dbf | carlos vargas,
According to your information, if i want to online read sql data into my FWH program for further processing, Must I use Advantage Database Server, can I use advantage local server (because it is free) or any other method.
Right now I am using SQL CONVERTER to convert particular table into CSV file and then import to DBF for further processing, but it is batch conversion and not controlled by records
I hope i can retrieve by FWH program because it is more flexible. |
sql 2 dbf | Ready!
the procedure is easy.
1.-install mysql.
2.-SLQYog.
3.-Open SQLYog and open the mysql database.
4.-open you sql file, copy the content. an paste in the rigth windows in SQLYog.
5.-click rigth button mouse in the rigth windows in SQLYog and select run execute all query. (this procedure is similar to restore the dump file)
6.-install the odbc mysql 3.51 and create a connexion in the ODBC Origen Data in control panel. ( i call 'mytes' )
7.-open excel an select the data menu, and get external data option, then select new query database.
8.-select the mytest connexion and select the table biblio, follow the wizard.
9.-then the data is imported to sheet in excel.
10.-save the excel file as dbf file.
11.- you must modify the DBF file according to your needs.
i send the files dbf create in a zip to you email.
sorry for my very bad english.
salu2
carlos vargas |
sql 2 dbf | thanks carlos |
sql 2 dbf | Silvio,
you can do it also from your app.
Hi Silvio,
if you edit your sql-file, you find the structure at the top with the index keys:
[code=fw:3ez05daf]<div class="fw" id="{CB}" style="font-family: monospace;">-- Table structure <span style="color: #00C800;">for</span> table `biblio`<br />-- <br /><br />CREATE TABLE <span style="color: #00C800;">IF</span> NOT <span style="color: #0000ff;">EXISTS</span> `biblio` <span style="color: #000000;">(</span><br /> `NumIns` int<span style="color: #000000;">(</span><span style="color: #000000;">10</span><span style="color: #000000;">)</span> NOT <span style="color: #00C800;">NULL</span> auto_increment,<br /> `INVENTARIO` double<span style="color: #000000;">(</span><span style="color: #000000;">15</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `NUM_ING` double<span style="color: #000000;">(</span><span style="color: #000000;">15</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `DAT_ING` date <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `TITOLO` varchar<span style="color: #000000;">(</span><span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `TIPO` varchar<span style="color: #000000;">(</span><span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `VOLUME` double<span style="color: #000000;">(</span><span style="color: #000000;">15</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `DIQUANTI` double<span style="color: #000000;">(</span><span style="color: #000000;">15</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `AUTORI` varchar<span style="color: #000000;">(</span><span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `NUM_COPY` double<span style="color: #000000;">(</span><span style="color: #000000;">7</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `SITUAZIONE` double<span style="color: #000000;">(</span><span style="color: #000000;">7</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `CONSERVA` varchar<span style="color: #000000;">(</span><span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `SALA` varchar<span style="color: #000000;">(</span><span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `ARMADIO` varchar<span style="color: #000000;">(</span><span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `RIPIANO` varchar<span style="color: #000000;">(</span><span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `P_COPER` double<span style="color: #000000;">(</span><span style="color: #000000;">15</span>,<span style="color: #000000;">2</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `VALORE` double<span style="color: #000000;">(</span><span style="color: #000000;">15</span>,<span style="color: #000000;">2</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `FORNITORE` varchar<span style="color: #000000;">(</span><span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `EDITORE` varchar<span style="color: #000000;">(</span><span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `MESE` varchar<span style="color: #000000;">(</span><span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `ANNO` double<span style="color: #000000;">(</span><span style="color: #000000;">15</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `PAGINE` double<span style="color: #000000;">(</span><span style="color: #000000;">15</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `FORMATO` double<span style="color: #000000;">(</span><span style="color: #000000;">15</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `ISBN` varchar<span style="color: #000000;">(</span><span style="color: #000000;">50</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `DEWEY` varchar<span style="color: #000000;">(</span><span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `DEWDESC` varchar<span style="color: #000000;">(</span><span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `SOGGETTO` varchar<span style="color: #000000;">(</span><span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> `<span style="color: #00C800;">ABSTRACT</span>` varchar<span style="color: #000000;">(</span><span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #00C800;">default</span> <span style="color: #00C800;">NULL</span>,<br /> PRIMARY KEY <span style="color: #000000;">(</span>`NumIns`<span style="color: #000000;">)</span>,<br /> UNIQUE KEY `INVENTARIO` <span style="color: #000000;">(</span>`INVENTARIO`<span style="color: #000000;">)</span>,<br /> UNIQUE KEY `NUM_ING` <span style="color: #000000;">(</span>`NUM_ING`<span style="color: #000000;">)</span>,<br /> KEY `NUM_COPY` <span style="color: #000000;">(</span>`NUM_COPY`<span style="color: #000000;">)</span><br /><span style="color: #000000;">)</span> ENGINE=InnoDB <span style="color: #00C800;">DEFAULT</span> CHARSET=latin1 AUTO_INCREMENT=<span style="color: #000000;">4246</span> ;</div>[/code:3ez05daf]
Create a dbf with the same structure, connect with your sql-server, read the data and save them in your dbf. I don´t have the sql-commands in my mind, but you can try to use the sqlwin rdd you can find here the forum.
Hope it helps |
sql 2 dbf | Dear Mr.Stefan,
If I am not wrong, I understand that Mr.Silvio is having a .sql file, which actually is a sql dump file. (It has the table structure as well as the data in it). He needs to read the data from the .sql file and then transfer that data to a DBF file.
Mr.Silvio ?
Regards
Anser |
sql 2 dbf | Dear Anser,
yes, it is a dump from phpmysqladmin. He can also use this dump file to get the data, but I think it´s better, to get the data out of the original file, because he can also update the dbf, if new records have been added to the sql file. |
sql 2 dbf | Dear Mr.Stefan,
If Mr.Silvio has access to the database then what you said is the best option <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> , but I am not sure whether he has access to the database. Has not mentioned anything about that.
Regards
Anser |
sql con AZURE | Estimados
En este momento estoy tratando de conectarme a una base de datos en Microsoft azure, les agradeceré si me pueden ayudar como realizar la conexión, la cadena que me entrega Microsoft no funciona remplazándola directamente.
w_sql='Provider=sqloledb;Server=tcp:siscont.database.windows.net,1433;Initial Catalog=prueba;Persist Security Info=False;User ID={marcelo};Password={C12345678};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30'
oCon:=CREATEOBJECT("adodb.connection")
oComando:=CREATEOBJECT("adodb.command")
oCon:open(w_sql)
oComando:ActiveConnection:=oCon
cadana original para remplazar
ADO.NET
w_sql='Provider=sqloledb;Server=tcp:siscont.database.windows.net,1433;Initial Catalog=prueba;Persist Security Info=False;User ID={your_username};Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30'
saludos,
Marcelo |
sql con AZURE | [url:16yg45am]https://groups.google.com/forum/#!topic/comp.lang.xharbour/vGiNFzL2xfw[/url:16yg45am] |
sql con AZURE | Marcelo,
mira si te sirven los siguientes enlaces
[url:376d42cx]https://azure.microsoft.com/en-us/blog/windows-azure-web-sites-how-application-strings-and-connection-strings-work/[/url:376d42cx]
[url:376d42cx]https://www.connectionstrings.com/sql-azure/[/url:376d42cx]
[url:376d42cx]https://www.connectionstrings.com/windows-azure/[/url:376d42cx]
[url:376d42cx]https://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/[/url:376d42cx]
Saludos |
sql definitivamente | Completamente de acuerdo con los que proponen SQLAhora si no quieres complicar al usuario con la instalacion del servidory este lo va a usar en una sola pc tienes la version "empotrado"donde tu ejecutable gestiona los datos y no hay servidor.Ahora definitivamente la conexion mysql es mucho mas facil que la de msql server pero si hay variantes en la syntaxis del sqlPor ejemplo En MYSQL se usa "LIMIT" en SQL SERVER "TOP"En MYSQL se puede usar apostrofes o comillas en SQL SERVER solo apostrofesEN MYSQL se pueda hacer un IF( en SQL SEVER es If THEN |
sql display: has someone already implemented? | sql display: has someone already implemented? |
sql server guardar y mostrar imagen | Hola gente, necesito ayuda como mostrar un campo "IMAGE" de una tabla sql server.
Lo guardo sin problema, pero no encuentro la forma de mostrar la imagen en jpg.
Saludos.
Jorge |
sql server guardar y mostrar imagen | Saving:
[code=fw:2wc5uzjb]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oRs:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> <image_fieldname> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := HB_STRTOHEX<span style="color: #000000;">(</span> MEMOREAD<span style="color: #000000;">(</span> cJpgFile <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br />oRs:<span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> </div>[/code:2wc5uzjb]
Display:
[code=fw:2wc5uzjb]<div class="fw" id="{CB}" style="font-family: monospace;"><br />cImage := oRs:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> <image_fieldname> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span><br /><br /><span style="color: #B900B9;">// 1</span><br />XImage<span style="color: #000000;">(</span> cImage <span style="color: #000000;">)</span><br /><br /><span style="color: #B900B9;">// 2</span><br />@ r,c XIMAGE cImage <span style="color: #0000ff;">SIZE</span> w,h <span style="color: #0000ff;">OF</span> oWnd<br /> </div>[/code:2wc5uzjb] |
sql server guardar y mostrar imagen | George
Are you trying to save an image or file to a Sql Table ?? and trying to reconstruct it back to its original file ?? I may have interpreted your question incorrectly .. however, This is how I store and retrieve a file from Sql Server ..
1) Use VarBinary(Max) field type
2 here is the code to save your file ( any file ) to a VarBinary(max) field in your table ... this is my code .. note this line is the key to the code
oRsCh:Fields("notes"):AppendChunk( VTArrayWrapper():New( 17, cBUFFER ) )
[code=fw:t12vd2tu]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">//------------------------------</span><br /><span style="color: #00C800;">Static</span> Func _Doit<span style="color: #000000;">(</span> oRsTrav, oRsCh, cPROJECTEID, cPath,oDLg <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">LOCAL</span> cFILENAME, nSTRING, nLEN, nSTART, SAYING, nDATETIME<br /><span style="color: #00C800;">LOCAL</span> nHANDLE, nBYTES, cEID, cFILE, dDATE<br /><br /><span style="color: #00C800;">LOCAL</span> cBUFFER <span style="color: #B900B9;">// <------- This is the actual data to be stored</span><br /><span style="color: #00C800;">LOCAL</span> nBytesRead<br /><br />cFILE := upper<span style="color: #000000;">(</span>ALLTRIM<span style="color: #000000;">(</span> cPATH <span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// C:\DBTMP\CHARTER.DOC</span><br />nLEN := LEN<span style="color: #000000;">(</span> cFILE <span style="color: #000000;">)</span><br /><br />nSTART := RAT<span style="color: #000000;">(</span> <span style="color: #ff0000;">"<span style="color: #000000;">\"</span>, cFILE )<br /><br />IF nSTART > 0<br />ELSE<br /> SAYING := "</span>INVALID File <span style="color: #0000ff;">name</span> or Location .. Aborting<span style="color: #ff0000;">"<br /> MsgInfo( SAYING )<br /> oDLG:END()<br /> RETURN(.F.)<br />ENDIF<br /><br />// get file name //<br />cFILENAME := SUBSTR( cPATH, nSTART+1, nLEN-nSTART ) // CHARTER.PDF<br /><br />IF LEN(cFILENAME) > 35<br /> SAYING := "</span>Sorry .. the maximum length <span style="color: #0000ff;">of</span> your file<span style="color: #ff0000;">"+chr(10)<br /> SAYING += cFILENAME+CHR(10)<br /> SAYING += "</span>is longer than <span style="color: #000000;">35</span> characters. Please re-<span style="color: #0000ff;">name</span><span style="color: #ff0000;">"+chr(10)<br /> SAYING += "</span>your file <span style="color: #0000ff;">to</span> meet the <span style="color: #000000;">35</span> <span style="color: #0000ff;">max</span> length<span style="color: #ff0000;">"+chr(10)<br /> MsgInfo( saying )<br /> oDlg:end()<br /> RETURN(.F.)<br />ENDIF<br /><br />// open file //<br />nHANDLE := FOpen( cFILE )<br />IF FERROR() <> 0<br /> SAYING := "</span>Error reading file <span style="color: #ff0000;">"+cFILE+CHR(10)<br /> SAYING += "</span> <span style="color: #ff0000;">"+STR(FERROR())+CHR(10)<br /> MsgInfo( SAYING )<br /> oDLG:END()<br /> RETURN(.F.)<br />ENDIF<br /><br />// get number of bytes in file<br />nBYTES := FSEEK( nHANDLE, 0,2 )<br /><br />// pad the buffer nBytes+1<br />cBUFFER := SPACE(nBYTES+1)<br /><br />FSeek( nHANDLE, 0, 0 )<br />nBytesRead := FRead( nHANDLE, @cBuffer, nBytes )<br /><br />FClose( nHANDLE )<br /><br />if nBytesRead != nBytes<br /> SAYING := "</span>nBytesRead = <span style="color: #ff0000;">"+str(nBYTESREAD)+CHR(10)<br /> SAYING += "</span>nBytes = <span style="color: #ff0000;">"+str(nBYTES)+CHR(10)<br /> SAYING += "</span>Error Reading <span style="color: #00C800;">Data</span><span style="color: #ff0000;">"+chr(10)<br /> MsgInfo( saying )<br /> oDLG:END()<br /> RETURN ( .F. )<br />endif<br /><br />cEID := _GenEid()<br />IF cEID = "</span>BOGUS<span style="color: #ff0000;">"<br /> oDlg:End()<br /> RETURN(.F.)<br />ENDIF<br /><br />nDateTime := dtoc(date())//+"</span> <span style="color: #ff0000;">"+time()<br /><br />oRsCh:AddNew()<br /><br />oRsCh:Fields("</span>doceid<span style="color: #ff0000;">"):Value := cEID<br />oRsCH:Fields("</span>TFormEid<span style="color: #ff0000;">"):Value := cPROJECTEID<br />oRsCh:Fields("</span>DImport<span style="color: #ff0000;">"):Value := nDateTime<br />oRsCh:Fields("</span>importby<span style="color: #ff0000;">"):Value := xLOGIN<br />oRsCh:Fields("</span>datalen<span style="color: #ff0000;">"):Value := nBYTES<br />oRsCh:Fields("</span>filename<span style="color: #ff0000;">"):Value := cFILENAME<br />oRsCh:Fields("</span>notes<span style="color: #ff0000;">"):AppendChunk( VTArrayWrapper():New( 17, cBUFFER ) ) // <--- here is the key to store the file in binary<br /><br />oRsCh:Update()<br /><br />SysReFresh()<br /><br />SAYING := "</span>Bytes Read = <span style="color: #ff0000;">"+str(nBYTESREAD)+CHR(10)<br />SAYING += "</span>Bytes Stored = <span style="color: #ff0000;">"+str(nBYTES)+CHR(10)<br />SAYING += "</span> <span style="color: #ff0000;">"+CHR(10)<br />SAYING += "</span>Upload Complete <span style="color: #00C800;">for</span> file <span style="color: #0000ff;">name</span> <span style="color: #ff0000;">"+cFILENAME+chr(10)<br />MsgInfo( saying )<br /><br />oRsCh:Sort("</span>DImport<span style="color: #ff0000;">")<br />oRsCh:MoveFirst()<br />oRsCh:Find( "</span>doceid = <span style="color: #ff0000;">'"+cEID+"'</span><span style="color: #ff0000;">" )<br /><br />oDLG:END()<br />RETURN(.T.)<br /><br /><br /></span></div>[/code:t12vd2tu]
3) To retrieve the image from a VarBinary(max) field ..
Please note this line of code
cREAD := oRsCh:Fields("NOTES"):GetChunk( oRsCh:Fields("datalen"):Value)
[code=fw:t12vd2tu]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">//-------------------------------</span><br /><span style="color: #00C800;">Static</span> Func _Viewum<span style="color: #000000;">(</span> oRsCh,oDLG <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">LOCAL</span> nHANDLE, cREAD, cFILENAME, saying<br /><br /><span style="color: #00C800;">If</span> oRsCH:<span style="color: #000000;">Eof</span><br /> Saying := <span style="color: #ff0000;">"Sorry .. there are no records to view"</span><br /> <span style="color: #0000ff;">Msginfo</span><span style="color: #000000;">(</span> saying <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Return</span><span style="color: #000000;">(</span>.f.<span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endif</span><br /><br /><br />cFILENAME := alltrim<span style="color: #000000;">(</span>oRsCh:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"filename"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> <span style="color: #000000;">)</span><br /><br />cREAD := oRsCh:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"NOTES"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">GetChunk</span><span style="color: #000000;">(</span> oRsCh:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"datalen"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span><span style="color: #000000;">)</span><br />FERASE<span style="color: #000000;">(</span> xVOL+<span style="color: #ff0000;">"<span style="color: #000000;">\D</span>BTMP<span style="color: #000000;">\"</span>+cFILENAME )<br /><br />nHANDLE := FCREATE( xVOL+"</span>\DBTMP\<span style="color: #ff0000;">"+cFILENAME, 0 )<br />IF FERROR() <> 0<br /> SAYING := "</span>Error Creating file <span style="color: #ff0000;">"+(xVOL+"</span>\DBTMP\<span style="color: #ff0000;">"+cFILENAME)+CHR(10)<br /> SAYING += "</span>Error <span style="color: #ff0000;">"+STR(FERROR())+CHR(10)<br /> MsgInfo( SAYING )<br /> RETURN(.F.)<br />ENDIF<br /><br />FWRITE( nHANDLE, cREAD ) // write out the file<br />FCLOSE( nHANDLE )<br /><br /><br />SysReFresh()<br /><br />SHELLEXECUTE( "</span><span style="color: #ff0000;">", "</span>open<span style="color: #ff0000;">", (xVOL+"</span>\DBTMP\<span style="color: #ff0000;">"+cFILENAME),"</span><span style="color: #ff0000;">","</span><span style="color: #ff0000;">",1)<br /><br />SysReFresh()<br /><br />RETURN(.T.)<br /></span></div>[/code:t12vd2tu]
Don't know if this is what you have in mind .. Hope this helps.
Rick Lipkin |
sql server guardar y mostrar imagen | Anyone can build and run this sample:
Here we connect to a free MSSQL server in the cloud provided by FWH for testing purposes.
[code=fw:3k41asrd]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">function</span> TestImageMSSQL<br /><br /> <span style="color: #00C800;">local</span> oCn, cSql, oRs, oDlg, oImage<br /> <span style="color: #00C800;">local</span> cTable := <span style="color: #ff0000;">"TEST_JPG"</span><br /><br /> oCn := FW_OpenAdoConnection<span style="color: #000000;">(</span> <span style="color: #ff0000;">"MSSQL,208.91.198.196,gnraore3_,fwhmsdemo,fwh@2000#"</span>, .t. <span style="color: #000000;">)</span><br /><br /> oCn:<span style="color: #000000;">Execute</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"DROP TABLE IF EXISTS "</span> + cTable <span style="color: #000000;">)</span><br /> FWAdoCreateTable<span style="color: #000000;">(</span> cTable, <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"NAME"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">20</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>, <span style="color: #000000;">{</span> <span style="color: #ff0000;">"PHOTO"</span>, <span style="color: #ff0000;">"m"</span>, <span style="color: #000000;">10</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span>, oCn <span style="color: #000000;">)</span><br /><br /> oRs := FW_OpenRecordSet<span style="color: #000000;">(</span> oCn, cTable <span style="color: #000000;">)</span><br /> oRs:<span style="color: #000000;">AddNew</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRs:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"NAME"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := <span style="color: #ff0000;">"OLGA1"</span><br /> oRs:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"PHOTO"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := HB_STRTOHEX<span style="color: #000000;">(</span> MEMOREAD<span style="color: #000000;">(</span> <span style="color: #ff0000;">"c:<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\o</span>lga1.jpg"</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> oRs:<span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> XBROWSER oRs<br /><br /> oRs:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">400</span>,<span style="color: #000000;">500</span> <span style="color: #0000ff;">PIXEL</span><br /> @ <span style="color: #000000;">10</span>,<span style="color: #000000;">10</span> XIMAGE oImage SOURCE oRs:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"PHOTO"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">-10</span>,<span style="color: #000000;">-10</span> <span style="color: #0000ff;">OF</span> oDlg<br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /><br /> oRs:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oCn:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span></div>[/code:3k41asrd]
Browse:
[url=https://imageshack.com/i/pnm6XBokp:3k41asrd][img:3k41asrd]https://imagizer.imageshack.com/v2/xq90/923/m6XBok.png[/img:3k41asrd][/url:3k41asrd]
XImage:
[url=https://imageshack.com/i/pn5gjH0pp:3k41asrd][img:3k41asrd]https://imagizer.imageshack.com/v2/xq90/923/5gjH0p.png[/img:3k41asrd][/url:3k41asrd] |
sql server guardar y mostrar imagen | Two ways of creating the above table
METHOD-1
[code=fw:3d9fv9jr]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">TEXT</span> INTO cSql<br />CREATE TABLE TEST_JPG <span style="color: #000000;">(</span><br /> <span style="color: #0000ff;">ID</span> INT IDENTITY<span style="color: #000000;">(</span><span style="color: #000000;">1</span>,<span style="color: #000000;">1</span><span style="color: #000000;">)</span> PRIMARY KEY,<br /> <span style="color: #0000ff;">NAME</span> VARCHAR<span style="color: #000000;">(</span> <span style="color: #000000;">20</span> <span style="color: #000000;">)</span>,<br /> PHOTO <span style="color: #0000ff;">IMAGE</span><br /> <span style="color: #000000;">)</span><br />ENDTEXT<br /> oCn:<span style="color: #000000;">Execute</span><span style="color: #000000;">(</span> cSql <span style="color: #000000;">)</span><br /> </div>[/code:3d9fv9jr]
METHOD-2: Simpler and recommended by FWH
[code=fw:3d9fv9jr]<div class="fw" id="{CB}" style="font-family: monospace;"><br />FWAdoCreateTable<span style="color: #000000;">(</span> cTable, <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"NAME"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">20</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>, <span style="color: #000000;">{</span> <span style="color: #ff0000;">"PHOTO"</span>, <span style="color: #ff0000;">"m"</span>, <span style="color: #000000;">10</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span>, oCn <span style="color: #000000;">)</span><br /> </div>[/code:3d9fv9jr]
Note: Use small "m" for binary data |
sql server guardar y mostrar imagen | Alternative methods for inserting image (or any binary) data:
USING RECORDSET OBJECT:
Method-1: Longer code if you have patience to write
[code=fw:2z370blq]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oRs := FW_OpenRecordSet<span style="color: #000000;">(</span> oCn, cTable <span style="color: #000000;">)</span><br />oRs:<span style="color: #000000;">AddNew</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oRs:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"NAME"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := <span style="color: #ff0000;">"OLGA1"</span><br />oRs:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"PHOTO"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := HB_STRTOHEX<span style="color: #000000;">(</span> MEMOREAD<span style="color: #000000;">(</span> <span style="color: #ff0000;">"c:<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\o</span>lga1.jpg"</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br />oRs:<span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> </div>[/code:2z370blq]
Method-2: Short and simpler code, for lazy people like me.
[code=fw:2z370blq]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oRs := FW_OpenRecordSet<span style="color: #000000;">(</span> oCn, cTable <span style="color: #000000;">)</span><br />oRs:<span style="color: #000000;">AddNew</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"NAME"</span>, <span style="color: #ff0000;">"PHOTO"</span> <span style="color: #000000;">}</span>, <span style="color: #000000;">{</span> <span style="color: #ff0000;">"OLGA1"</span>, HB_STRTOHEX<span style="color: #000000;">(</span> MEMOREAD<span style="color: #000000;">(</span> <span style="color: #ff0000;">"c:<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\o</span>lga1.jpg"</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> </div>[/code:2z370blq]
WITHOUT OPENING RECORDSET:
[code=fw:2z370blq]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adodef.ch"</span><br />...<br />...<br />cSql := SQL INSERT INTO TEST_JPG <span style="color: #000000;">(</span> <span style="color: #0000ff;">NAME</span>, PHOTO <span style="color: #000000;">)</span> VALUES <span style="color: #000000;">(</span> <span style="color: #ff0000;">"OLGA1"</span>, MEMOREAD<span style="color: #000000;">(</span> <span style="color: #ff0000;">"c:<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\o</span>lga1.jpg"</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br />oCn:<span style="color: #000000;">Execute</span><span style="color: #000000;">(</span> cSql <span style="color: #000000;">)</span><br /> </div>[/code:2z370blq] |
sql server guardar y mostrar imagen | Hola, me da error HB_STRTOHEX no definida, que librería me falta?
Saludos
Jorge |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.