topic
stringlengths
1
63
text
stringlengths
1
577k
Cerrar Previsualizacion de Reportes
nop... <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( -->
Cerrar Previsualizacion de Reportes
SOLUCIONADO GRACIAS A DANIEL.... [code=fw:44egkyjb]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">FUNCTION</span> FIC_EQUI<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />*<br /><span style="color: #00C800;">local</span> oDlgReporte<br /><br /><span style="color: #00C800;">local</span> aRep:= <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><br /><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlgReporte <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;">10</span>, <span style="color: #000000;">85</span> <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">'REPORTE'</span><br /><br />.<br />.<br />.<br /><br />&nbsp; @ <span style="color: #000000;">3</span>, &nbsp;<span style="color: #000000;">5</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">'Aceptar'</span> <span style="color: #0000ff;">OF</span> oDlgReporte ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> FIC_EQUI2<span style="color: #000000;">&#40;</span>aRep<span style="color: #000000;">&#41;</span> ,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oDlgReporte:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">50</span>, <span style="color: #000000;">10</span><br /><br />&nbsp; @ <span style="color: #000000;">3</span>, <span style="color: #000000;">25</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">'Salir'</span> &nbsp; <span style="color: #0000ff;">OF</span> oDlgReporte <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> oDlgReporte:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">50</span>, <span style="color: #000000;">10</span><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlgReporte <span style="color: #0000ff;">CENTERED</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> <span style="color: #000000;">&#40;</span> oCODI:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> , .f. <span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">VALID</span><span style="color: #000000;">&#40;</span> aEval<span style="color: #000000;">&#40;</span> aRep, <span style="color: #000000;">&#123;</span>| cName | sendmessage<span style="color: #000000;">&#40;</span> findwindow<span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span>,cName <span style="color: #000000;">&#41;</span>, WM_CLOSE <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span>, .T. <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />dbcloseall<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">nil</span><br />*<br />* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br /><span style="color: #00C800;">FUNCTION</span> FIC_EQUI2<span style="color: #000000;">&#40;</span>aRep<span style="color: #000000;">&#41;</span><br /><br />.<br />.<br />.<br /><br /><br />oPrn:=PrintBegin<span style="color: #000000;">&#40;</span>Titulo,.F.,lPrv,,.T.<span style="color: #000000;">&#41;</span><br /><br />oPrn:<span style="color: #000000;">lPrvModal</span>:=.T.<br />oPrn:<span style="color: #000000;">SetPortrait</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp;<br />aadd<span style="color: #000000;">&#40;</span> aRep, oPrn:<span style="color: #000000;">cDocument</span> <span style="color: #000000;">&#41;</span><br /><br />PageBegin<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />.<br />.<br />.<br />.<br /><br />PageEnd<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />PrintEnd<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />oPrn:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">Return</span> .t.</div>[/code:44egkyjb]
Cerrar Programas o aplicaciones externas
Holas a todos.... Necesito cerrar programas externos... como por ejemplo el WORD, a veces Excel dependiendo de algunos procesos que hago. El problema es que no los cierra si no se exactamente el nombre del documento abierto... Ej. Si word esta recien iniciado y ejecuto CerrarVentana("Documento1 - Microsoft Word"), lo ejecuta sin problemas, pero si es otro documento o no se el nombre, no lo hace. Me gustaria poder a lo menos cerrar Word y excel. [code=fw:1vh1wod9]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#define</span> WM_CLOSE                        0x0010<br /><span style="color: #00C800;">Function</span> CerrarVentana<span style="color: #000000;">&#40;</span>cTitle<span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">Local</span> hWnd<br /><span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span>hWnd:=FindWindow<span style="color: #000000;">&#40;</span>,cTitle<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>!=<span style="color: #000000;">0</span><br />   PostMessage<span style="color: #000000;">&#40;</span>hWnd,WM_CLOSE<span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">EndIf</span><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">Nil</span></div>[/code:1vh1wod9] Cualquier Ayuda sera bienvenida. Desde Chile Adolfo PD: Esa rutina es de Lailton, y la uso igual sin cambios.
Cerrar Programas o aplicaciones externas
Adolfo Intenta poniendo "WINWORD.EXE" o utiliza este proceso que funciona [code=fw:109g8l9v]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br />CerrarProceso<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"WINWORD.EXE"</span><span style="color: #000000;">&#41;</span><br />*..<br /><span style="color: #00C800;">FUNCTION</span> CerrarProceso<span style="color: #000000;">&#40;</span> cProceso <span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">Local</span> oWMIob, oWMIserver, aProcess, objProcess<br />?cProceso<br /><span style="color: #00C800;">try</span><br />oWMIob := CreateObject<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"wbemScripting.SwbemLocator"</span> <span style="color: #000000;">&#41;</span><br />catch<br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">nil</span><br />END<br /><br />oWMIserver := oWMIob:<span style="color: #000000;">ConnectServer</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />aProcess :=oWMIserver:<span style="color: #000000;">ExecQuery</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Select * from Win32_Process"</span> <span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">For</span> Each objProcess in aProcess<br /><span style="color: #00C800;">IF</span> UPPER<span style="color: #000000;">&#40;</span>objProcess:<span style="color: #0000ff;">Name</span><span style="color: #000000;">&#41;</span> = UPPER<span style="color: #000000;">&#40;</span>cProceso<span style="color: #000000;">&#41;</span><br />objProcess:<span style="color: #000000;">Terminate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">next</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">nil</span></div>[/code:109g8l9v] Saludos, Adhemar
Cerrar Programas o aplicaciones externas
Gracias Adhemar Pruebo y te comento...
Cerrar Programas o aplicaciones externas
Funciono Perfecto Adhemar... Muchisimas Gracias. Desde Chile Adolfo
Cerrar Programas o aplicaciones externas
Que bueno Saludos, Adhemar
Cerrar Programas o aplicaciones externas
Muy bien Gracias
Cerrar Programas o aplicaciones externas
acuellar muchas gracias por dar solución a un problema que llevaba meses arrastrando. funciona perfectamente <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: -->
Cerrar Programas o aplicaciones externas
Somos varios los que te agradecemos este importante aporte. Gracias Saludos
Cerrar Programas o aplicaciones externas
Adhemar muchas gracias por el proceso de cierre de word. Me estaba volviendo loco tratando de que no se me acumularan Words abiertos en mi aplicacion que exporta mucho a dico programa desde Tpreview. El hallazgo de tu proceso fue una bendicion! un abrazo desde Argentina
Cerrar Programas o aplicaciones externas
Genial logré por fin cerrar el AcroRd32.exe luego de mandar a imprimir desde ShellExecute(0,"Print",cPdf,,0,1) Gracias
Cerrar Programas o aplicaciones externas
<!-- s:P --><img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz" /><!-- s:P --> Saludos, Adhemar
Cerrar Programas o aplicaciones externas
Hola a todos, Al margen de la solución de Adhemar, yo en estos casos trato de ni diquiera pensar e ir a los más básico y crudo que existe dentro del Windows, es decir, la consola de comandos. Lo único importante es saber que comando se adapta a lo que necesito hacer. Dejo una función muy básica que se podría usar en este caso. [code=fw:1v4spkn8]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">Function</span> KillExe<span style="color: #000000;">&#40;</span>cExeKill<span style="color: #000000;">&#41;</span><br /><br />WAITRUN<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"CMD.EXE /C TASKKILL /F /IM "</span>+cExeKill,.t.<span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br /><span style="color: #B900B9;">//</span></div>[/code:1v4spkn8] Espero les sirva la idea. Saludos,
Cerrar Programas o aplicaciones externas
Hola Amigo, estoy impriiendo un archivo PDF, con acrobat WaitRun( 'C:\Program Files\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe /N /t "C:\ribon\bol-20.pdf" "EPSON TM-T81 Receipt" ', 0 ) y lo hace perfecto, lo que pasa que queda abierto. hago esto para : WAITRUN( "CMD.EXE /C TASKKILL /F /IM "+"AcroRd32.exe",.t.) no lo hace, pero si me pongo directo en cmd lo hace, y pruebbo esto: CerrarProceso("Acrord32.exe") tampoco que estare haciendo mal.. saludos
Cerrar Tablas en una Window
buenoas dias compañeros, pues eso tengo algo como esto Use tabla1 new alias tabla1 shared Use tabla2 new alias tabla2 shared define window oWnd From ... @ 000,255 LISTBOX oLbx FIELDS ... alias 'Tabla1' @ 255,0 LISTBOX oLbx1 FIELDS ... alias 'Tabla2' activate window oWnd Valid( If(Msgyesno('sales'), (CierraTablas(),.t.),.F.) ) function cierraTablas select tabla1 dbclosearea() select tabla2 dbclosearea() Return Nil pero me da error al salir de la ventana, la pregunta es en QUE EVENTO de la ventana debo cerrar las tablas ?? gracias x todo saludos
Cerrar Tablas en una Window
Wilson: Yo lo haría así: .... ..... ACTIVATE WINDOWS oWnd Valid((CierraTablas()) FUNCTION cierraTablas() IF MsgYesNo(Seguro desea salir ?) select tabla1 dbclosearea() select tabla2 dbclosearea() ELSE RETURN(.F.) ENDIF Return(.T.)
Cerrar Tablas en una Window
Wilson, El problema es que se genera un último pintado y los browses ya no tienen acceso a los datos pues se han cerrado las DBFs. La solución es asignar "" a cAlias antes de cerrar las DBFs: oLbx1:cAlias = "" oLbx2:cAlias = ""
Cerrar Tablas en una Window
Armando y Antonio, gracias , lo prueba y les aviso saludos
Cerrar Tablas en una Window
gracias Antonio, funciono perfecto, y con la idea de Armando, si a alguien le sirve, lo hice asi [code:jqkdu8f7] Activate Window oWnd Valir&#40; CierraTablas&#40; oWnd, aAlias &#41; &#41; &#46;&#46;&#46; Function CierraTablas&#40; oWnd, aAlias &#41; Local i &#58;= 0 Local oCtrl Local lRet &#58;= &#46;F&#46; if MsgYesno&#40; 'Sales' &#41; lRet &#58;= &#46;T&#46; while ++i <= len&#40; oWnd&#58;aControls &#41; oCtrl &#58;= oWnd&#58;aControls&#91; i &#93; if oCtrl&#58;ClassName&#40;&#41; == 'TWBROWSE' oCtrl&#58;cAlias &#58;= '' end end i&#58;= 0 while ++i <= len&#40; aAlias &#41; select &#40; aAlias&#91; i &#93; &#41; dbclosearea&#40;&#41; end end Return lRet [/code:jqkdu8f7] gracias x todo saludos [/code]
Cerrar Ventana de Dialogo
Hola Muchachos, Normalmente para salir de un dialogo presiono el boton correspondiente en mi barra de herramientas, Cuando hago esto valido ciertos detalles en una funcion "salir()". Lo que no se, es como hacer que mi programa vaya a esta funcion cuando doy click en el boton cerrar[x] que esta en la parte superior derecho del dialogo junto a maximizar o minimizar, aqui las lineas de mi programa... DEFINE WINDOW oWndPar MDICHILD OF oWndMain TITLE "Parametros del Sistema" STYLE NOR(WS_OVERLAPPED + WS_CAPTION + WS_SYSMENU + WS_MINIMIZEBOX ) DEFINE DIALOG oDlg RESOURCE "Fld_Par0" OF oWndPar ... ... ACTIVATE DIALOG oDlg CENTER NOWAIT ON INIT ( oDlg:move(0,0), CURSORARROW() ) VALID ( iif(Salir(), (oWndPar:END(), .T.), .F.) ) ACTIVATE WINDOW oWndPar ON INIT ( oWndPar:SetSize( oDlg:nWidth+1, oDlg:nHeight+14 ), oWndPar:CENTER() ) Alguien por favor me puede ayudar Gracias de antemano William Chavez Noriega Lima - Peru
Cerrar Ventana de Dialogo
William Tenes que colocar oWndPar:bValid:={ || salir() } Saludos Adhemar
Cerrar Ventana de Dialogo
Adehmar, 1ero que nada gracias por la ayuda... 2do, donde coloco esta linea... dentro del activate window ? Gracias Nuevamente William [quote="acuellar":2jkzf9hc]William Tenes que colocar oWndPar:bValid:={ || salir() } Saludos Adhemar[/quote:2jkzf9hc]
Cerrar Ventana de Dialogo
Despues de haber ingresado al programa. Por Ej: si te pide clave y es correcta, entonces coloca la línea. Saludos Adhemar
Cerrar Ventana de Dialogo
Muchas Gracias Adhemar...
Cerrar aplicacion
Buenas tardes. Hay alguna forma de cerrar aplicaciones externas desde mi ejecutable? Gracias Jorge Jaurena
Cerrar aplicacion
[url:2675vn7s]http&#58;//forums&#46;fivetechsupport&#46;com/viewtopic&#46;php?f=6&t=27474&p=180483&hilit=cerrar+aplicacion&sid=56fd806314f77dd9a7f849a2605a7a5f&sid=e3a5ff08817d2b15c6d766692b241fd1#p180483[/url:2675vn7s]
Cerrar archivo de Ayuda
Antonio un saludo cordial para ti al igual para la gente del foro Desde la aplicación se usan los archivos de ayuda html. La pregunta es como cierro el archivo html de ayuda justo cuando cierro la aplicación? Gracias Jairo
Cerrar archivo de Ayuda
Problema resuelto Con la clase Twcaptur y un código muy censillo no solo se puede cerrar cualquier aplicación, también se puede manipular la ventana muy fácil, dejo el exe de muestra, la clase y el código por si algún colega lo pudiera necesitar <!-- m --><a class="postlink" href="http://rapidshare.com/files/243581113/Cerrar.rar.html">http://rapidshare.com/files/243581113/Cerrar.rar.html</a><!-- m --> Cordialmente Jairo Barbosa Dios Bendiga Vuestros Caminos
Cerrar archivo de Ayuda
Jairo, Gracias. Copio aqui el contenido del fichero para que no se pierda <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> demo02.prg [code=fw:8lzeyk8j]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><span style="color: #B900B9;">// TWCapture by Manu Exposito</span><br /><span style="color: #B900B9;">// Demo02 de la clase TWCapture</span><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00D7D7;">#define</span> CRLF chr<span style="color: #000000;">&#40;</span> <span style="color: #000000;">13</span> <span style="color: #000000;">&#41;</span> + chr<span style="color: #000000;">&#40;</span> <span style="color: #000000;">10</span> <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #00C800;">local</span> oWnd := TWCapture<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />    <span style="color: #00C800;">local</span> cTitle := space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">40</span> <span style="color: #000000;">&#41;</span><br /><br />    oWnd:<span style="color: #000000;">WCapture</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"demo02 - bloc de notas"</span> <span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #00C800;">if</span> !oWnd:<span style="color: #000000;">lCaptured</span>      <span style="color: #B900B9;">// Si no esta la ventana la ejecutamos nosotros</span><br />        WinExec<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"NotePad.exe demo02.prg"</span> <span style="color: #000000;">&#41;</span><br />        oWnd:<span style="color: #000000;">WCapture</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"demo02 - bloc de notas"</span> <span style="color: #000000;">&#41;</span>  <span style="color: #B900B9;">// y la capturamos</span><br />    <span style="color: #00C800;">endif</span><br /><br />    Jugar<span style="color: #000000;">&#40;</span> oWnd <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> Jugar<span style="color: #000000;">&#40;</span> oWnd <span style="color: #000000;">&#41;</span><br /><br />        <span style="color: #00C800;">local</span> cTitle := oWnd:<span style="color: #000000;">cTitle</span><br /><br />        <span style="color: #00C800;">if</span> oWnd:<span style="color: #000000;">lCaptured</span><br /><br />            MsgAlert<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Muy bien, ya lo tenemos"</span> + CRLF + ;<br />                      <span style="color: #ff0000;">"Hemos capturado la ventana con titulo: "</span> + cTitle + ;<br />                      CRLF + <span style="color: #ff0000;">"Ahora vamos a jugar con ella"</span> <span style="color: #000000;">&#41;</span><br /><br />            <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"La centramos"</span> <span style="color: #000000;">&#41;</span><br />            oWnd:<span style="color: #0000ff;">Center</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />            <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Pinto una linea"</span> <span style="color: #000000;">&#41;</span><br />            oWnd:<span style="color: #000000;">Line</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">500</span>, <span style="color: #000000;">500</span> <span style="color: #000000;">&#41;</span><br /><br />            <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"La desplazo arriba a la izquierda"</span> <span style="color: #000000;">&#41;</span><br />            oWnd:<span style="color: #0000ff;">Move</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span><br /><br />            <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Ahora minimizo"</span> <span style="color: #000000;">&#41;</span><br />            oWnd:<span style="color: #000000;">Minimize</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />            <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Ahora maximizo"</span> <span style="color: #000000;">&#41;</span><br />            oWnd:<span style="color: #000000;">Maximize</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />            <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"La restauro"</span> <span style="color: #000000;">&#41;</span><br />            oWnd:<span style="color: #000000;">Restore</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />            <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Ahora cambio titulo"</span> <span style="color: #000000;">&#41;</span><br />            oWnd:<span style="color: #000000;">SetText</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"TWCapture captura ventanas - by Manu Exposito 2001"</span> <span style="color: #000000;">&#41;</span><br /><br />            <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Ahora la oculto"</span> <span style="color: #000000;">&#41;</span><br />            oWnd:<span style="color: #000000;">Hide</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />            <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Ahora la muestro"</span> <span style="color: #000000;">&#41;</span><br />            oWnd:<span style="color: #000000;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />            <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"y ahora termino"</span> <span style="color: #000000;">&#41;</span><br />            oWnd:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />        <span style="color: #00C800;">else</span><br /><br />            MsgStop<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"No se pudo capturar ninguna ventana"</span> <span style="color: #000000;">&#41;</span><br />            oWnd := <span style="color: #00C800;">nil</span><br /><br />        <span style="color: #00C800;">endif</span><br /><br /><span style="color: #00C800;">return</span><span style="color: #000000;">&#40;</span> <span style="color: #00C800;">nil</span> <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /> </div>[/code:8lzeyk8j] demo02.rc [code=fw:8lzeyk8j]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">/* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />captura.rc &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />Generado con VERCE v5.3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />*/</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /><span style="color: #000000;">1</span> <span style="color: #0000ff;">ICON</span> <span style="color: #ff0000;">"C:<span style="color: #000000;">\A</span>RCHIV~1<span style="color: #000000;">\V</span>ERCE53<span style="color: #000000;">\B</span>MPS<span style="color: #000000;">\v</span>erce.ico"</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />DLG_PRUEBAS <span style="color: #0000ff;">DIALOG</span> <span style="color: #000000;">6</span>, <span style="color: #000000;">15</span>, <span style="color: #000000;">207</span>, <span style="color: #000000;">111</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /><span style="color: #0000ff;">STYLE</span> DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />CAPTION <span style="color: #ff0000;">"VERCE pruebas"</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /><span style="color: #0000ff;">FONT</span> <span style="color: #000000;">8</span>, <span style="color: #ff0000;">"MS Sans Serif"</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /><span style="color: #000000;">&#123;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp;PUSHBUTTON <span style="color: #ff0000;">"&Aceptar"</span>, <span style="color: #000000;">201</span>, <span style="color: #000000;">40</span>, <span style="color: #000000;">32</span>, <span style="color: #000000;">101</span>, <span style="color: #000000;">28</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /><span style="color: #000000;">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp;</div>[/code:8lzeyk8j] TWCaptur.prg [code=fw:8lzeyk8j]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><span style="color: #B900B9;">//  AUTOR.....: Manuel Exp¢sito Su rez    Soft 4U '2001                       //</span><br /><span style="color: #B900B9;">//  e-Mail....: <!-- e --><a href="mailto:maex14@dipusevilla.es">maex14@dipusevilla.es</a><!-- e -->                                         //</span><br /><span style="color: #B900B9;">//  CLASE.....: TWCapture                                                     //</span><br /><span style="color: #B900B9;">//  FECHA MOD.: 18/08/2001                                                    //</span><br /><span style="color: #B900B9;">//  VERSION...: 1.00                                                          //</span><br /><span style="color: #B900B9;">//  PROPOSITO.: Captura una ventana abierta por nuestro programa o por otra   //</span><br /><span style="color: #B900B9;">//              aplicacion para poder enviarle mensajes como si fuera una     //</span><br /><span style="color: #B900B9;">//              ventana mas de nuestro programa.                              //</span><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><span style="color: #B900B9;">//  DATAS.....: * lCapture tiene un valor logico, .f. si la ventana no se     //</span><br /><span style="color: #B900B9;">//              pudo capturar y .t. si si se hizo                             //</span><br /><span style="color: #B900B9;">//                                                                            //</span><br /><span style="color: #B900B9;">//  METODOS...: * New( cTitle ) es el constructor, cTitle es el titulo de una //</span><br /><span style="color: #B900B9;">//              ventana, si se le pasa intentara capturarla y pondra .t. en   //</span><br /><span style="color: #B900B9;">//              ::lCapture                                                    //</span><br /><span style="color: #B900B9;">//              * WCapture se encarga de buscar la ventana y asignarla a      //</span><br /><span style="color: #B900B9;">//              nuestro objeto TWindow. Si la captura podremos interactuar    //</span><br /><span style="color: #B900B9;">//              como si fuera una ventana mas de nuestra aplicacion           //</span><br /><span style="color: #B900B9;">//                                                                            //</span><br /><span style="color: #B900B9;">//  NOTAS.....: TWCapture esta heredada de TWindows por lo que tendremos a    //</span><br /><span style="color: #B900B9;">//              nuestra disposicion todas las datas y metodos de esta clase.  //</span><br /><span style="color: #B900B9;">//              No distingue entre mayusculas y minuscula pero si se tienen   //</span><br /><span style="color: #B900B9;">//              en cuenta los espacios                                        //</span><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Objects.ch"</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">CLASS</span> TWCapture <span style="color: #0000ff;">FROM</span> TWindow<br /><br />    <span style="color: #00C800;">DATA</span> lCaptured  AS LOGICAL<br /><br />    <span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> cTitle <span style="color: #000000;">&#41;</span> CONSTRUCTOR<br />    <span style="color: #00C800;">METHOD</span> WCapture<span style="color: #000000;">&#40;</span> cTitle <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">ENDCLASS</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> cTitle <span style="color: #000000;">&#41;</span> <span style="color: #00C800;">CLASS</span> TWCapture<br /><br />    <span style="color: #00C800;">if</span><span style="color: #000000;">&#40;</span> ValType<span style="color: #000000;">&#40;</span> cTitle <span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">"C"</span>, ::<span style="color: #000000;">WCapture</span><span style="color: #000000;">&#40;</span> cTitle <span style="color: #000000;">&#41;</span>, ::<span style="color: #000000;">lCaptured</span> := .f. <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">return</span><span style="color: #000000;">&#40;</span> <span style="color: #00C800;">Self</span> <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> WCapture<span style="color: #000000;">&#40;</span> cTitle <span style="color: #000000;">&#41;</span> <span style="color: #00C800;">CLASS</span> TWCapture<br /><br />   <span style="color: #00C800;">local</span> hWnd := FindWindow<span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span>, cTitle <span style="color: #000000;">&#41;</span><br /><br />   ::<span style="color: #000000;">lCaptured</span> := <span style="color: #000000;">&#40;</span> hWnd > <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span><br />   ::<span style="color: #000000;">hWnd</span> := <span style="color: #00C800;">if</span><span style="color: #000000;">&#40;</span> ::<span style="color: #000000;">lCaptured</span>, hWnd, <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">return</span><span style="color: #000000;">&#40;</span> ::<span style="color: #000000;">lCaptured</span> <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /> </div>[/code:8lzeyk8j]
Cerrar archivo de Ayuda
Antonio Buendía Es un gusto poder colaborar, gracias también a Mario González quien me facilito la clase Antonio dos cosas 1. Tuve la intención de subir el código como tu lo hiciste pero no se como se hace para que quede la sintaxis de color. 2. Como quito la “X” que cierra una Windows, o como la deshabilito. Estuve revisando en el foro pero no encontré nada entendible para mí. Cordialmente Jairo Barbosa
Cerrar archivo de Ayuda
Jairo, > 1. Tuve la intención de subir el código como tu lo hiciste pero no se como se hace para que quede la sintaxis de color. Usa [ c o d e ] y [ / c o d e ], sin los espacios, y pones el código entre ellos. > 2. Como quito la “X” que cierra una Windows, o como la deshabilito. Puedes usar una variable lógica lSalir := .F. y usar el VALID: ACTIVATE WINDOW oWnd VALID lSalir solo saldrá cuando cambies el valor de lSalir a .T.
Cerrar bien FileXls con ENDXLS oXls?
saludotes. Compañeros del foro, y a quien use la clase FileXls. Creo correctamente un archivo XLS con esta clasey logicoal final la instruccion es ENDXLS oXls ---> oXls:End() y lo abre automaticamente, pero como este lo uso temporal delspues del ENDXLS: cTmpXls:=NombreTmp('XLS') nombre temporal XLS oXls FILE (cTmpXls) AUTOEXEC .... ... ... ENDXLS oXls aqui lo abre FErase(cTmpXls) cTmpXls es el archivo que genera la clase FileXls FErase(cTmpXls) no lo borra como podre eliminar este archivo? gracias.
Cerrar bien archivo abierto de Excel Ayuda
Saludos. Hace tiempo expuse el mismo tema de hoy y sigo teniendo problemas para cerrar correctamente un archivo abierto de excel... Tengo esto: [code=fw:2bki1oyl]<div class="fw" id="{CB}" style="font-family: monospace;"><br />&nbsp; bSalida:=Mensaje<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'...'</span>,<span style="color: #ff0000;">'Importando codigos de excel SAT'</span><span style="color: #000000;">&#41;</span><br />&nbsp; oExcel:=TOleAuto<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Excel.Application"</span> <span style="color: #000000;">&#41;</span><br />&nbsp; oExcel:<span style="color: #000000;">WorkBooks</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'P:<span style="color: #000000;">\t</span>mp<span style="color: #000000;">\C</span>SAT.xlsx'</span><span style="color: #000000;">&#41;</span><br />&nbsp; oHoja := oExcel:<span style="color: #0000ff;">Get</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ActiveSheet"</span> <span style="color: #000000;">&#41;</span><br />&nbsp; nRows := oHoja:<span style="color: #000000;">UsedRange</span>:<span style="color: #000000;">Rows</span>:<span style="color: #0000ff;">Count</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; nCols := oHoja:<span style="color: #000000;">UsedRange</span>:<span style="color: #000000;">Columns</span>:<span style="color: #0000ff;">Count</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; <span style="color: #B900B9;">//</span><br />&nbsp; <span style="color: #B900B9;">//</span><br />&nbsp; oExcel:<span style="color: #000000;">Quit</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; eval<span style="color: #000000;">&#40;</span>bSalida<span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:2bki1oyl] Abre el archivo de excel sin problemas, el caso es que no se como cerrarlo. Al final le doy el oExcel:Quit() pero el archivo abierto se queda asi, al intentar abrirlo con EXCEL me dice "Solo lectura" y pues igual no lo puedo eliminar. Ayuda porfa...
Cerrar bien archivo abierto de Excel Ayuda
Intenta asi, [code=fw:3np8cqis]<div class="fw" id="{CB}" style="font-family: monospace;"><br />&nbsp; &nbsp;oExcel:<span style="color: #000000;">DisplayAlerts</span> := .F.<br /><br />&nbsp; &nbsp;oWorkBook:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;oExcel:<span style="color: #000000;">Quit</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp;oWorkBook := <span style="color: #00C800;">NIL</span><br /><br />&nbsp; &nbsp;oHoja := <span style="color: #00C800;">NIL</span><br /><br />&nbsp; &nbsp;oExcel := <span style="color: #00C800;">NIL</span><br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp;<span style="color: #0000ff;">Release</span> oWorkBook<br />&nbsp; &nbsp;<span style="color: #0000ff;">Release</span> oHoja<br />&nbsp; &nbsp;<span style="color: #0000ff;">Release</span> oExcel<br />&nbsp;</div>[/code:3np8cqis] Saludos.
Cerrar bien archivo abierto de Excel Ayuda
Solucionado con: oExcel:WorkBooks:Close() oExcel:Application:Quit() gracias.
Cerrar conexión MySql con TDolphin (Solucionado)
la idea de las funciones garbage, es que son llamadas cuando el programa entra en idle, y se ejecuta al recolector de basura, ahi las variables a nil, son procesadas. ahi es cuando se llama la función mysql_close, para el caso de la variable que contiene la conexion. es cuando se cierra la conexión. de ahi que karinha haga el llamado a hb_gcall, obligando al recolector de basura de harbour a ejecutarse inmediatamente, y no hasta que el programa este en idle. Mil Gracias karinha, eso es lo que me faltaba. salu2
Cerrar conexión MySql con TDolphin (Solucionado)
Gracias por las respuestas y aclaraciones. Probé como indicó Karinha pero sigue sin matar la conexión. Seguramente esté haciendo algo mal, voy a revisar más mi código
Cerrar conexión MySql con TDolphin (Solucionado)
Estimados: Tengo un sistema que hace la apertura de una base de datos que uso para configuración, y luego la cierro para abrir otra. El problema que estoy teniendo es que, aunque hago un End de la primera conexión, en la base de datos me sigue mostrando (con SHOW PROCESSLIST) que la conexión sigue activa. Esto hace que la cantidad de concurrencias en la base de datos se multiplique por dos, y que alcance el máximo definido en max_connections. Como puedo hacer para matar dicha conexión? Desde ya muchas gracias.
Cerrar conexión MySql con TDolphin (Solucionado)
en tdolphin, [quote:1k3551fo] static HB_GARBAGE_FUNC( MYSQL_release ) { void ** ph = (void **) Cargo; /* Check if pointer is not NULL to avoid multiple freeing */ if( ph && * ph ) { /* Destroy the object */ mysql_close( (MYSQL *) * ph ); /* set pointer to NULL to avoid multiple freeing */ * ph = NULL; } } [/quote:1k3551fo] intenta con esto, y nos comenta por favor: [code=fw:1k3551fo]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oCon:<span style="color: #000000;">end</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />oCon := <span style="color: #00C800;">nil</span><br /> </div>[/code:1k3551fo]
Cerrar conexión MySql con TDolphin (Solucionado)
Carlos: Muchas gracias por la pronta respuesta Con: [code=fw:33ll71xq]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oServer:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />oServer := <span style="color: #00C800;">nil</span><br />&nbsp;</div>[/code:33ll71xq] No la mata a la conexión. Por ahí te interprete mal, HB_GARBAGE_FUNC como la llamo? Esa funcion veo que esta en function.c de dolphin, pero no la llama en ningun lado al hacer End
Cerrar conexión MySql con TDolphin (Solucionado)
Y asi? [code=fw:1adz9e6h]<div class="fw" id="{CB}" style="font-family: monospace;"><br />   oServer:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>  <br />   oConn:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>  <br /><br />   oServer := <span style="color: #00C800;">NIL</span><br />   oConn := <span style="color: #00C800;">NIL</span><br /><br />   HB_GCALL<span style="color: #000000;">&#40;</span> .T. <span style="color: #000000;">&#41;</span><br /> </div>[/code:1adz9e6h] Regards, saludos.
Cerrar conexión MySql con TDolphin (Solucionado)
Revisé mi código y sigue sin funcionar. Agradecería cualquier sugerencia. Desde ya muchas gracias
Cerrar conexión MySql con TDolphin (Solucionado)
Hola César, Saludos.. ¿Será que en algún momento tienes dos conexiones con la misma variable? Yo no he tenido problemas con el END, y mi forma de trabajar es [b:1v3k2nvl]Conectar, Hacer, Desconectar[/b:1v3k2nvl] o sea que conecto y desconecto constantemente. Es una idea, trata de descartarla.
Cerrar conexión MySql con TDolphin (Solucionado)
Gracias a todos por su interés. Dado que a todos le funcionaba, profundicé en mi código, y efectivamente tenía un apertura extra que después no cerraba.
Cerrar dbf despues de preview
Hola: En un informe y haciendo caso a Mr. Rao abro el dbf con un nuevo alias para realizar el mismo activo el boton excel para exportar a esa hoja de calculo. Pero quiero cerrar la base de datos abierta al terminar el informe. utilizo este codigo. [code=fw:1ty38ai1]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oRepObr:<span style="color: #000000;">bInit</span> := <span style="color: #000000;">&#123;</span>|| ListO-><span style="color: #000000;">&#40;</span>dbgotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #B900B9;">// Activa boton Excel en Preview &nbsp;Da error</span><br />&nbsp; &nbsp;<br />&nbsp; &nbsp;<span style="color: #0000ff;">ACTIVATE</span> REPORT oRepObr <span style="color: #00C800;">FOR</span> <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> lSoloOpen, ListO->Cerrada = .F., .T. <span style="color: #000000;">&#41;</span> .AND. <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> lSoloClose, ListO->Cerrada = .T., .T. <span style="color: #000000;">&#41;</span> ;<br />&nbsp; &nbsp;.AND. <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> ListO-><span style="color: #000000;">&#40;</span> ordSetFocus<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">"CODIGO"</span>, ListO->Codigo <= cFinal, ListO->Nombre <= cFinal <span style="color: #000000;">&#41;</span> <span style="color: #00C800;">WHILE</span> ListO-><span style="color: #000000;">&#40;</span> ! Eof<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oFont:<span style="color: #000000;">END</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">ENDIF</span><br /><br />ListO-><span style="color: #000000;">&#40;</span>DBCloseArea<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">// error.</span><br />&nbsp;</div>[/code:1ty38ai1] Este codigo provoca error . ya que al exportar a excel dice que la base de datos no esta abierta. Como hago para cerrar la base de datos despues de exportar a Excel.? Gracias por vuestra inestamable ayuda. Saludos. Jose.
Cerrar dbf despues de preview
[code=fw:ee29o74d]<div class="fw" id="{CB}" style="font-family: monospace;"><br />DbCloseArea<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />Ó<br /><br /><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> ListO <span style="color: #000000;">&#41;</span>->DBCloseArea<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <br /><br />Ó <br /><br />CLOSE  ListO <br /><br />Ó <br /><br />DBCLOSEALL<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /> </div>[/code:ee29o74d] Regards, saludos.
Cerrar dbf despues de preview
Muchas gracias por tu interés Joao No me he explicado bien. Mira tengo un browse con una dbf entonces tengo una opción que lanza un diálogo en el cual se preguntan datos del informe, ahí ya se abre la misma dbf con otro alias, se pregunta si queremos Filtrar por código por nombre etc si aceptamos se prepara el informe, En este informe se activa el botón Excel y al acabar el informe se cierra la dbf que hemos abierto para ese informe solamente. Todo eso Funciona ok. Se activa el botón de Excel , pero colo le des al botón de exportar a Excel te da error de que el alias no existe. O sea ejecuta la última instrucción del código que he publicado estando en el preview. es eso lo que no entiendo porque incluso si no cierro la dbf en el código que llamo al diálogo sino a continuación. O se en el action del botón que llamó al diálogo. Después de eso cierro la dbf. Sorprendente también me da error. Que el alias no existe. Espero vuestra inestimable ayuda. Jose. No Enviado desde mi POCOPHONE F1 mediante Tapatalk
Cerrar dbf despues de preview
Hola amigos: Muchisimas gracias a todos por el interes. Pero creo que incluso con la solucion de Artu01, que parecia la que mas se adaptaba cuando le das al boton de exportar de excel te dice que no existe el alias, o sea la base de datos ya esta cerrada. Es por lo que deduzco que cuando tenemos el preview en nuestra pantalla ya se ha producido el ON END del informe y si pulsas el boton de excel te da error. Yo creo que lo normal seria que el ON END se lanzara cuando cierras el preview, pero bueno son opiniones. de todas formas yo cierro la dbf despues de salir del informe, es por lo que no entiendo que desde el preview la dbf ya esta cerrada. el codigo es trivial , yo presento un dialogo. [code=fw:2lgg7m3v]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> ListObras<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">local</span> oDlg, oFont<br /><span style="color: #00C800;">local</span> oDevice, oRepObr<br /><span style="color: #B900B9;">// etc . ...</span><br /><br />dbUseArea<span style="color: #000000;">&#40;</span> .T., , <span style="color: #ff0000;">"Obras"</span>, <span style="color: #ff0000;">"ListO"</span>, .T. <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"LISTAOBR"</span> ;<br />&nbsp; &nbsp;<span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"LISTADO DE OBRAS"</span><br /><br />&nbsp; <br />&nbsp; &nbsp;<span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BTNBMP</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">750</span> <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"ACCEPT"</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> lAcepta := .t., oDlg:<span style="color: #000000;">END</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BTNBMP</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">751</span> <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"CANCEL"</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;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<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;">IF</span> lAcepta<br /><br />&nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// code....</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"Courier New"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>, - <span style="color: #000000;">12</span><br />&nbsp; &nbsp; &nbsp; oDevice := TPrinter<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">NEW</span><span style="color: #000000;">&#40;</span> cCaption, .F., <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> nRdest == <span style="color: #000000;">1</span>, .T., .F. <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <br /><br />&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; REPORT oRepObr <span style="color: #0000ff;">TITLE</span> Replicate <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"_"</span>, <span style="color: #000000;">87</span> <span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">""</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Replicate<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">" "</span>, <span style="color: #000000;">36</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"LISTADO DE OBRAS"</span> ,Replicate <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"_"</span>, <span style="color: #000000;">87</span> <span style="color: #000000;">&#41;</span> , <span style="color: #ff0000;">""</span> <span style="color: #0000ff;">Left</span> ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Header <span style="color: #ff0000;">"Pag. "</span> + Str<span style="color: #000000;">&#40;</span> oRepObr:<span style="color: #000000;">nPage</span>, <span style="color: #000000;">3</span> <span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">Right</span> ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FOOTER aEmpresa<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">" - "</span> + aEmpresa<span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">" ("</span> + aEmpresa<span style="color: #000000;">&#91;</span> <span style="color: #000000;">11</span> <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">")"</span> ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CAPTION cCaption <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">TO</span> DEVICE oDevice<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Codigo"</span>, <span style="color: #ff0000;">"Inicio"</span> &nbsp;<span style="color: #00C800;">DATA</span> ListO->Codigo, DToC<span style="color: #000000;">&#40;</span> ListO->Inicio <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Nombre"</span>, <span style="color: #ff0000;">"C.I.F."</span> &nbsp;<span style="color: #00C800;">DATA</span> ListO->Nombre, ListO->Cif<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Dirección"</span>, <span style="color: #ff0000;">"Provincia"</span> <span style="color: #00C800;">DATA</span> <span style="color: #0000ff;">SubStr</span><span style="color: #000000;">&#40;</span> ListO->Direc, <span style="color: #000000;">1</span>, <span style="color: #000000;">20</span> <span style="color: #000000;">&#41;</span>, ListO->Provin<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Población"</span>, <span style="color: #ff0000;">"C.Postal"</span> <span style="color: #00C800;">DATA</span> <span style="color: #0000ff;">SubStr</span><span style="color: #000000;">&#40;</span> ListO->Pobla, <span style="color: #000000;">1</span>, <span style="color: #000000;">14</span> <span style="color: #000000;">&#41;</span>, ListO->Postal<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Telefono"</span>, <span style="color: #ff0000;">"Presupuesto"</span> <span style="color: #00C800;">DATA</span> ListO->Tele, ListO->Presup <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"@E 999,999.99"</span><br /><br />&nbsp; &nbsp; &nbsp; END REPORT<br />&nbsp; &nbsp; &nbsp; oRepObr:<span style="color: #000000;">nTitleUpline</span> := <span style="color: #000000;">0</span> &nbsp;<span style="color: #B900B9;">// Quita la linea de arriba de los titulos 0</span><br />&nbsp; &nbsp; &nbsp; oRepObr:<span style="color: #000000;">MARGIN</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">4</span>, <span style="color: #000000;">5</span>, <span style="color: #000000;">2</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; oRepObr:<span style="color: #000000;">bInit</span> := <span style="color: #000000;">&#123;</span>|| ListO-><span style="color: #000000;">&#40;</span>dbgotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ACTIVATE</span> REPORT oRepObr <span style="color: #00C800;">FOR</span> <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> lSoloOpen, ListO->Cerrada = .F., .T. <span style="color: #000000;">&#41;</span> .AND. <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> lSoloClose, ListO->Cerrada = .T., .T. <span style="color: #000000;">&#41;</span> ;<br />&nbsp; &nbsp; &nbsp; .AND. <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> ListO-><span style="color: #000000;">&#40;</span> ordSetFocus<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">"CODIGO"</span>, ListO->Codigo <= cFinal, ListO->Nombre <= cFinal <span style="color: #000000;">&#41;</span> <span style="color: #00C800;">WHILE</span> ! ListO-><span style="color: #000000;">&#40;</span> &nbsp;Eof<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <br /><br />&nbsp; &nbsp; &nbsp; oFont:<span style="color: #000000;">END</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<br />&nbsp; &nbsp;<span style="color: #00C800;">ENDIF</span><br /><br />&nbsp; &nbsp;ListO-><span style="color: #000000;">&#40;</span>DbcloseArea<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> &nbsp;<br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">NIL</span><br />&nbsp;</div>[/code:2lgg7m3v] Deduzco que cuando se muestra el preview ya se ha ejecutado todo el codigo incluso el ListO->(DbCloseArea()) con lo cual la dbf esta cerrada y al llamar al boton de excel da error que no existe el alias. yo creo que es un tema de diseño del preview , espero una orientacion de los mienbros de Fivetech o que me expliquen como puedo hacer un informe abriendo la dbf y cerrandola en la misma funcion. Un abrazo a todos. Jose.
Cerrar dbf despues de preview
José, como defines el reporte completo. Por lo que veo estaría bien, pero tienes un endif que no se nota de donde viene. Este código funciona bien para mi: [code=fw:3qhq3si7]<div class="fw" id="{CB}" style="font-family: monospace;"><br />use rubros <span style="color: #0000ff;">alias</span> <span style="color: #ff0000;">"base01"</span> shared <span style="color: #00C800;">new</span><br />SET <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">TO</span> rubrnom<br /><br /><span style="color: #B900B9;">// Defino el reporte</span><br />REPORT oRep <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Reporte de Rubros"</span> <span style="color: #0000ff;">FONT</span> &nbsp;oFont1,oFont2,oFont3 ;<br />&nbsp; &nbsp; &nbsp; &nbsp;HEADER OemToAnsi<span style="color: #000000;">&#40;</span>cTitulo<span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">CENTER</span> ;<br />&nbsp; &nbsp; &nbsp; &nbsp;FOOTER <span style="color: #ff0000;">"Hoja:"</span> + STR<span style="color: #000000;">&#40;</span>oRep:<span style="color: #000000;">npage</span>,<span style="color: #000000;">3</span><span style="color: #000000;">&#41;</span> ,<span style="color: #ff0000;">"Fecha:"</span>+DTOC<span style="color: #000000;">&#40;</span>DATE<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">CENTER</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp;PREVIEW CAPTION &nbsp;<span style="color: #ff0000;">"Reporte de Rubros"</span><br />COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Nombre"</span> <span style="color: #00C800;">DATA</span> base01->nombre &nbsp;<span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">30</span> <span style="color: #0000ff;">FONT</span> <span style="color: #000000;">2</span> GRID<br />COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Codigo"</span> <span style="color: #00C800;">DATA</span> base01->codigo &nbsp;<span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">20</span> <span style="color: #0000ff;">FONT</span> <span style="color: #000000;">3</span> GRID<br />END REPORT<br /><span style="color: #B900B9;">// Activo el reporte</span><br /><span style="color: #0000ff;">ACTIVATE</span> REPORT oRep <span style="color: #00C800;">WHILE</span> base01-><span style="color: #000000;">&#40;</span>!EOF<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> &nbsp;<span style="color: #0000ff;">ON</span> STARTPAGE oRep:<span style="color: #000000;">SayBitmap</span><span style="color: #000000;">&#40;</span>.<span style="color: #000000;">1</span>,.<span style="color: #000000;">1</span>,<span style="color: #ff0000;">"LOGO.BMP"</span>,<span style="color: #000000;">1.5</span>,.<span style="color: #000000;">5</span><span style="color: #000000;">&#41;</span> <br />CLOSE base01<br />&nbsp;</div>[/code:3qhq3si7]
Cerrar dbf despues de preview
[quote="jvtecheto":6g8ll555]Hola: En un informe y haciendo caso a Mr. Rao abro el dbf con un nuevo alias para realizar el mismo activo el boton excel para exportar a esa hoja de calculo. Pero quiero cerrar la base de datos abierta al terminar el informe. utilizo este codigo. [code=fw:6g8ll555]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oRepObr:<span style="color: #000000;">bInit</span> := <span style="color: #000000;">&#123;</span>|| ListO-><span style="color: #000000;">&#40;</span>dbgotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #B900B9;">// Activa boton Excel en Preview  Da error</span><br />   <br />   <span style="color: #0000ff;">ACTIVATE</span> REPORT oRepObr <span style="color: #00C800;">FOR</span> <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> lSoloOpen, ListO->Cerrada = .F., .T. <span style="color: #000000;">&#41;</span> .AND. <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> lSoloClose, ListO->Cerrada = .T., .T. <span style="color: #000000;">&#41;</span> ;<br />   .AND. <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> ListO-><span style="color: #000000;">&#40;</span> ordSetFocus<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">"CODIGO"</span>, ListO->Codigo <= cFinal, ListO->Nombre <= cFinal <span style="color: #000000;">&#41;</span> <span style="color: #00C800;">WHILE</span> ListO-><span style="color: #000000;">&#40;</span> ! Eof<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   oFont:<span style="color: #000000;">END</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">ENDIF</span><br /><br />ListO-><span style="color: #000000;">&#40;</span>DBCloseArea<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">// error.</span><br /> </div>[/code:6g8ll555] Este codigo provoca error . ya que al exportar a excel dice que la base de datos no esta abierta. Como hago para cerrar la base de datos despues de exportar a Excel.? Gracias por vuestra inestamable ayuda. Saludos. Jose.[/quote:6g8ll555] Y asi haz probado [code=fw:6g8ll555]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">ACTIVATE</span> REPORT oRepObr ...<br /><span style="color: #0000ff;">ON</span> END ListO-><span style="color: #000000;">&#40;</span>DBCloseArea<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /> </div>[/code:6g8ll555]
Cerrar dbf despues de preview
Hello José, After working on my | i zi pi zi | HTML Report, I follow all the printing problems in the forum and think about how it could be done with HTML Reports. I think that using HTML as the report definition language has certain advantages. The HTML Report Generator saves the entire report as an HTML file before the preview. I think that this can also solve the EXCEL export. All you have to do is open this file in EXCEL. This is how my report looks if I open with EXCEL. [img:1fx80qpk]https&#58;//mybergland&#46;com/fwforum/html2excel&#46;jpg[/img:1fx80qpk] Best regards, Otto <!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=40621">viewtopic.php?f=3&t=40621</a><!-- l -->
Cerrar dbf despues de preview
Mira: [code=fw:2z7q2zsu]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#Include</span> <span style="color: #ff0000;">"Report.Ch"</span> &nbsp; &nbsp;<span style="color: #B900B9;">//-> Classe Para Reportes</span><br /><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> ListObras<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> oDlg, oFont<br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> oDevice, oRepObr, ListO, cAlias<br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// dbUseArea( .T., , "Obras", "ListO", .T. )</span><br /><br />&nbsp; &nbsp;USE OBRAS <span style="color: #0000ff;">INDEX</span> OBRAS <span style="color: #00C800;">NEW</span> SHARED <span style="color: #0000ff;">ALIAS</span> OBRAS<br />&nbsp; &nbsp;GO TOP<br /><br />&nbsp; &nbsp;ListO &nbsp;:= <span style="color: #0000ff;">ALIAS</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #B900B9;">// O</span><br />&nbsp; &nbsp;cAlias := <span style="color: #0000ff;">ALIAS</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"LISTAOBR"</span> <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"LISTADO DE OBRAS"</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BTNBMP</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">750</span> <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"ACCEPT"</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> lAcepta := .t., oDlg:<span style="color: #000000;">END</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BTNBMP</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">751</span> <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"CANCEL"</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;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">IF</span> lAcepta<br /><br />&nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// code....</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"Courier New"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>, - <span style="color: #000000;">12</span><br />&nbsp; &nbsp; &nbsp; oDevice := TPrinter<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">NEW</span><span style="color: #000000;">&#40;</span> cCaption, .F., <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> nRdest == <span style="color: #000000;">1</span>, .T., .F. <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; REPORT oRepObr <span style="color: #0000ff;">TITLE</span> Replicate <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"_"</span>, <span style="color: #000000;">87</span> <span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">""</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Replicate<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">" "</span>, <span style="color: #000000;">36</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"LISTADO DE OBRAS"</span> ,Replicate <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"_"</span>, <span style="color: #000000;">87</span> <span style="color: #000000;">&#41;</span> , <span style="color: #ff0000;">""</span> <span style="color: #0000ff;">Left</span> ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Header <span style="color: #ff0000;">"Pag. "</span> + Str<span style="color: #000000;">&#40;</span> oRepObr:<span style="color: #000000;">nPage</span>, <span style="color: #000000;">3</span> <span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">Right</span> ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FOOTER aEmpresa<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">" - "</span> + aEmpresa<span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">" ("</span> + aEmpresa<span style="color: #000000;">&#91;</span> <span style="color: #000000;">11</span> <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">")"</span> ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CAPTION cCaption <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">TO</span> DEVICE oDevice<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Codigo"</span>, <span style="color: #ff0000;">"Inicio"</span> &nbsp;<span style="color: #00C800;">DATA</span> ListO->Codigo, DToC<span style="color: #000000;">&#40;</span> ListO->Inicio <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Nombre"</span>, <span style="color: #ff0000;">"C.I.F."</span> &nbsp;<span style="color: #00C800;">DATA</span> ListO->Nombre, ListO->Cif<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Dirección"</span>, <span style="color: #ff0000;">"Provincia"</span> <span style="color: #00C800;">DATA</span> <span style="color: #0000ff;">SubStr</span><span style="color: #000000;">&#40;</span> ListO->Direc, <span style="color: #000000;">1</span>, <span style="color: #000000;">20</span> <span style="color: #000000;">&#41;</span>, ListO->Provin<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Población"</span>, <span style="color: #ff0000;">"C.Postal"</span> <span style="color: #00C800;">DATA</span> <span style="color: #0000ff;">SubStr</span><span style="color: #000000;">&#40;</span> ListO->Pobla, <span style="color: #000000;">1</span>, <span style="color: #000000;">14</span> <span style="color: #000000;">&#41;</span>, ListO->Postal<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Telefono"</span>, <span style="color: #ff0000;">"Presupuesto"</span> <span style="color: #00C800;">DATA</span> ListO->Tele, ListO->Presup <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"@E 999,999.99"</span><br /><br />&nbsp; &nbsp; &nbsp; END REPORT<br /><br />&nbsp; &nbsp; &nbsp; oRepObr:<span style="color: #000000;">nTitleUpline</span> := <span style="color: #000000;">0</span> &nbsp;<span style="color: #B900B9;">// Quita la linea de arriba de los titulos 0</span><br />&nbsp; &nbsp; &nbsp; oRepObr:<span style="color: #000000;">MARGIN</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">4</span>, <span style="color: #000000;">5</span>, <span style="color: #000000;">2</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; oRepObr:<span style="color: #000000;">bInit</span> := <span style="color: #000000;">&#123;</span>|| ListO-><span style="color: #000000;">&#40;</span>dbgotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ACTIVATE</span> REPORT oRepObr <span style="color: #00C800;">FOR</span> <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> lSoloOpen, ListO->Cerrada = .F., .T. <span style="color: #000000;">&#41;</span> .AND. <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> lSoloClose, ListO->Cerrada = .T., .T. <span style="color: #000000;">&#41;</span> ;<br />&nbsp; &nbsp; &nbsp; .AND. <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> ListO-><span style="color: #000000;">&#40;</span> ordSetFocus<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">"CODIGO"</span>, ListO->Codigo <= cFinal, ListO->Nombre <= cFinal <span style="color: #000000;">&#41;</span> <span style="color: #00C800;">WHILE</span> ! ListO-><span style="color: #000000;">&#40;</span> &nbsp;Eof<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; &nbsp; oFont:<span style="color: #000000;">END</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<br />&nbsp; &nbsp;<span style="color: #00C800;">ENDIF</span><br /><br />&nbsp; &nbsp;CLOSE ListO<br />&nbsp; &nbsp;CLOSE cAlias<br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">NIL</span><br />&nbsp;</div>[/code:2z7q2zsu] Regards, saludos.
Cerrar dbf despues de preview
Hola Joao. Muchas gracias por tu interes, pero igual da error que no existe el alias ListO ( o el que sea) , lo que significa que cuando se visualiza el preview se ha ejecutado todo el codigo de la funcion hasta el final y la dbf ha sido cerrada, y si pulsas el boton de excel como se supone que tiene que usar los datos de la dbf esta cerrada. No digo que sea un bug pero si se podria rediseñar el preview para que no ejecutara todo el codigo, solo lo hiciera cuando cierras el preview [code=fw:1zg2f24f]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">ACTIVATE</span> REPORT oRepObr <span style="color: #00C800;">FOR</span> <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> lSoloOpen, ListO->Cerrada = .F., .T. <span style="color: #000000;">&#41;</span> .AND. <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> lSoloClose, ListO->Cerrada = .T., .T. <span style="color: #000000;">&#41;</span> ;<br />      .AND. <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> ListO-><span style="color: #000000;">&#40;</span> ordSetFocus<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">"CODIGO"</span>, ListO->Codigo <= cFinal, ListO->Nombre <= cFinal <span style="color: #000000;">&#41;</span> <span style="color: #00C800;">WHILE</span> ListO-><span style="color: #000000;">&#40;</span> ! Eof<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <br /><br />   ListO-><span style="color: #000000;">&#40;</span>dbcloseArea<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /> </div>[/code:1zg2f24f] No se ejecutara el ListO->(DbCloseArea()) , hasta que se cerrara el preview cosa que no ocurre actualmente. imaginaros que en una funcion que presenta un dialogo se ejecutara todo el codigo de la funcion, en este caso no se ejecuta el codigo a partir de ACTIVATE DIALOG ... hasta que se cierra el mismo. En el codigo de abajo la condicion de IF lAcepta se ejecuta cuando cierras el DIALOG. [code=fw:1zg2f24f]<div class="fw" id="{CB}" style="font-family: monospace;"><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;">IF</span> lAcepta<br /><br />      <span style="color: #00C800;">IF</span> nRad == <span style="color: #000000;">1</span><br />         <span style="color: #00C800;">IF</span> ListO-><span style="color: #000000;">&#40;</span>Ordsetfocus<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> != <span style="color: #ff0000;">"CODIGO"</span><br />            ListO-><span style="color: #000000;">&#40;</span> ordSetFocus<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Codigo"</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />         <span style="color: #00C800;">ENDIF</span><br />      ELSEIF nRad == <span style="color: #000000;">2</span><br />         <span style="color: #00C800;">IF</span> ListO-><span style="color: #000000;">&#40;</span>Ordsetfocus<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> != <span style="color: #ff0000;">"NOMBRE"</span><br />            ListO-><span style="color: #000000;">&#40;</span> ordSetFocus<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Nombre"</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />         <span style="color: #00C800;">ENDIF</span><br />         cInicio := Upper<span style="color: #000000;">&#40;</span> cInicio <span style="color: #000000;">&#41;</span><br />         cFinal := Upper<span style="color: #000000;">&#40;</span> cFinal <span style="color: #000000;">&#41;</span><br />      <span style="color: #00C800;">ENDIF</span><br /><span style="color: #B900B9;">// code ....</span><br /><br /> </div>[/code:1zg2f24f] u ofrecer una solucion para en una funcion que crea un informe y abrimos la misma dbf que tenemos en el Xbrowse pero con otro alias podamos utilizar la exportacion a Excel, creo que me explico bien. No se sino es asi me lo indicais. Mr. Rao, como se haria eso? Saludos Jose.
Cerrar dbf despues de preview
Buén dia. Haga un ejemplo com la DBF, e ZIP todo e ponga en el Mega Upload, para testes, porfa. [url:zfk5vkgx]https&#58;//mega&#46;nz[/url:zfk5vkgx] Regards, saludos.
Cerrar dbf despues de preview
[quote="jvtecheto":2hhokc4a]Hola Joao. [code=fw:2hhokc4a]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">ACTIVATE</span> REPORT oRepObr <span style="color: #00C800;">FOR</span> <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> lSoloOpen, ListO->Cerrada = .F., .T. <span style="color: #000000;">&#41;</span> .AND. <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> lSoloClose, ListO->Cerrada = .T., .T. <span style="color: #000000;">&#41;</span> ;<br />      .AND. <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> ListO-><span style="color: #000000;">&#40;</span> ordSetFocus<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">"CODIGO"</span>, ListO->Codigo <= cFinal, ListO->Nombre <= cFinal <span style="color: #000000;">&#41;</span> <span style="color: #00C800;">WHILE</span> ListO-><span style="color: #000000;">&#40;</span> ! Eof<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <br /><br />   ListO-><span style="color: #000000;">&#40;</span>dbcloseArea<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /> </div>[/code:2hhokc4a] [/quote:2hhokc4a] Jose y si solamente dejas [code=fw:2hhokc4a]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">ACTIVATE</span> REPORT oRepObr<br /> </div>[/code:2hhokc4a] Tambien se cuelga?
Cerrar dbf despues de preview
[quote="jvtecheto":2kb7gu57] [code=fw:2kb7gu57]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> ListObras<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">local</span> oDlg, oFont<br /><span style="color: #00C800;">local</span> oDevice, oRepObr<br /><span style="color: #B900B9;">// etc . ...</span><br /><br />dbUseArea<span style="color: #000000;">&#40;</span> .T., , <span style="color: #ff0000;">"Obras"</span>, <span style="color: #ff0000;">"ListO"</span>, .T. <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"LISTAOBR"</span> ;<br />   <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"LISTADO DE OBRAS"</span><br /><br />  <br />   <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BTNBMP</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">750</span> <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"ACCEPT"</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> lAcepta := .t., oDlg:<span style="color: #000000;">END</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />   <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BTNBMP</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">751</span> <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"CANCEL"</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;">&#40;</span><span style="color: #000000;">&#41;</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;">IF</span> lAcepta<br /><br />     <span style="color: #B900B9;">// code....</span><br />      <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"Courier New"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>, - <span style="color: #000000;">12</span><br />      oDevice := TPrinter<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">NEW</span><span style="color: #000000;">&#40;</span> cCaption, .F., <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> nRdest == <span style="color: #000000;">1</span>, .T., .F. <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <br /><br />      <br />      REPORT oRepObr <span style="color: #0000ff;">TITLE</span> Replicate <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"_"</span>, <span style="color: #000000;">87</span> <span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">""</span>, ;<br />         Replicate<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">" "</span>, <span style="color: #000000;">36</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"LISTADO DE OBRAS"</span> ,Replicate <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"_"</span>, <span style="color: #000000;">87</span> <span style="color: #000000;">&#41;</span> , <span style="color: #ff0000;">""</span> <span style="color: #0000ff;">Left</span> ;<br />         Header <span style="color: #ff0000;">"Pag. "</span> + Str<span style="color: #000000;">&#40;</span> oRepObr:<span style="color: #000000;">nPage</span>, <span style="color: #000000;">3</span> <span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">Right</span> ;<br />         FOOTER aEmpresa<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">" - "</span> + aEmpresa<span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">" ("</span> + aEmpresa<span style="color: #000000;">&#91;</span> <span style="color: #000000;">11</span> <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">")"</span> ;<br />         CAPTION cCaption <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">TO</span> DEVICE oDevice        <br /><br />         COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Codigo"</span>, <span style="color: #ff0000;">"Inicio"</span>  <span style="color: #00C800;">DATA</span> ListO->Codigo, DToC<span style="color: #000000;">&#40;</span> ListO->Inicio <span style="color: #000000;">&#41;</span><br />         COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Nombre"</span>, <span style="color: #ff0000;">"C.I.F."</span>  <span style="color: #00C800;">DATA</span> ListO->Nombre, ListO->Cif<br />         COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Dirección"</span>, <span style="color: #ff0000;">"Provincia"</span> <span style="color: #00C800;">DATA</span> <span style="color: #0000ff;">SubStr</span><span style="color: #000000;">&#40;</span> ListO->Direc, <span style="color: #000000;">1</span>, <span style="color: #000000;">20</span> <span style="color: #000000;">&#41;</span>, ListO->Provin<br />         COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Población"</span>, <span style="color: #ff0000;">"C.Postal"</span> <span style="color: #00C800;">DATA</span> <span style="color: #0000ff;">SubStr</span><span style="color: #000000;">&#40;</span> ListO->Pobla, <span style="color: #000000;">1</span>, <span style="color: #000000;">14</span> <span style="color: #000000;">&#41;</span>, ListO->Postal<br />         COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Telefono"</span>, <span style="color: #ff0000;">"Presupuesto"</span> <span style="color: #00C800;">DATA</span> ListO->Tele, ListO->Presup <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"@E 999,999.99"</span><br /><br />      END REPORT<br />      oRepObr:<span style="color: #000000;">nTitleUpline</span> := <span style="color: #000000;">0</span>  <span style="color: #B900B9;">// Quita la linea de arriba de los titulos 0</span><br />      oRepObr:<span style="color: #000000;">MARGIN</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">4</span>, <span style="color: #000000;">5</span>, <span style="color: #000000;">2</span> <span style="color: #000000;">&#41;</span><br />      oRepObr:<span style="color: #000000;">bInit</span> := <span style="color: #000000;">&#123;</span>|| ListO-><span style="color: #000000;">&#40;</span>dbgotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />   <br />      <span style="color: #0000ff;">ACTIVATE</span> REPORT oRepObr <span style="color: #00C800;">FOR</span> <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> lSoloOpen, ListO->Cerrada = .F., .T. <span style="color: #000000;">&#41;</span> .AND. <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> lSoloClose, ListO->Cerrada = .T., .T. <span style="color: #000000;">&#41;</span> ;<br />      .AND. <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> ListO-><span style="color: #000000;">&#40;</span> ordSetFocus<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">"CODIGO"</span>, ListO->Codigo <= cFinal, ListO->Nombre <= cFinal <span style="color: #000000;">&#41;</span> <span style="color: #00C800;">WHILE</span> ! ListO-><span style="color: #000000;">&#40;</span>  Eof<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <br /><br />      oFont:<span style="color: #000000;">END</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />   <br />   <span style="color: #00C800;">ENDIF</span><br /><br />   ListO-><span style="color: #000000;">&#40;</span>DbcloseArea<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>  <br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:2kb7gu57] [/quote:2kb7gu57] Para que usas oDevice? [code=fw:2kb7gu57]<div class="fw" id="{CB}" style="font-family: monospace;"><br />      REPORT oRepObr <span style="color: #0000ff;">TITLE</span> Replicate <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"_"</span>, <span style="color: #000000;">87</span> <span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">""</span>, ;<br />         Replicate<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">" "</span>, <span style="color: #000000;">36</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"LISTADO DE OBRAS"</span> ,Replicate <span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"_"</span>, <span style="color: #000000;">87</span> <span style="color: #000000;">&#41;</span> , <span style="color: #ff0000;">""</span> <span style="color: #0000ff;">Left</span> ;<br />         Header <span style="color: #ff0000;">"Pag. "</span> + Str<span style="color: #000000;">&#40;</span> oRepObr:<span style="color: #000000;">nPage</span>, <span style="color: #000000;">3</span> <span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">Right</span> ;<br />         FOOTER aEmpresa<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">" - "</span> + aEmpresa<span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">" ("</span> + aEmpresa<span style="color: #000000;">&#91;</span> <span style="color: #000000;">11</span> <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">")"</span> ;<br />         CAPTION cCaption <span style="color: #0000ff;">FONT</span> oFont  PREVIEW<br />         ....<br />         ....<br /><br /> </div>[/code:2kb7gu57]
Cerrar dbf despues de preview
Hola Artu01. No si no cierro la dbf no se cuelga por supuesto pero lo que yo quiero es en la misma función abrir la dbf que tengo en el xbrowse pero con otro alias, confeccionó el informe, exporto a excel si el usuario quiere y luego cerrar la dbf que he abierto exclusivamente para ese informe. Y en el xbrowse sigo teniendo la dbf abierta y no tengo problemas de refresco. Y no lo consigo.... <!-- s:-( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":-(" title="Sad" /><!-- s:-( --> Lo del oDevice es un código que tenía con Fivewin para clipper versión 2.0 imagínate más de 20 años. Y que adapte hace 2 años al volver a Fivewin. Y hay partes que voy mejorando poco a poco. Pero imagínate el poder de Fivewin que logre convertir la dll que usaba entonces para los recursos de 16 bits a. Rc y el 90% del código me compilo. Gracias por tu interés Jose. Enviado desde mi POCOPHONE F1 mediante Tapatalk
Cerrar diálogo como si clickeara en la ""X""
Buenas noches,Hay alguna manera por la que pueda cerrar un diálogo como si clickara sobre la "X" del diálogo, pero al clickear sobre un botón?.Lo que pasa es que si hago oDlg:end(), me ejecuta el valid del get en el que se encuentra el cursor y, como ese valid pasa a una función que llama a otro dialogo, esto impide que se cierre.Al clickear sobre la "X" del diálogo se cierra sin problemas.Hay alguna manera de acceder a la rutina que se accede al clickear sobre la "X"?Gracias.Rolando <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
Cerrar diálogo como si clickeara en la ""X""
[quote="rolando":1m3vd3wg]Buenas noches, Hay alguna manera por la que pueda cerrar un diálogo como si clickara sobre la "X" del diálogo, pero al clickear sobre un botón?. Lo que pasa es que si hago oDlg:end(), me ejecuta el valid del get en el que se encuentra el cursor y, como ese valid pasa a una función que llama a otro dialogo, esto impide que se cierre. Al clickear sobre la "X" del diálogo se cierra sin problemas. Hay alguna manera de acceder a la rutina que se accede al clickear sobre la "X"? Gracias. Rolando <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->[/quote:1m3vd3wg]Prueba con oBtn:lCancel = .T. ó con la clásula CANCELREDEFINE BUTTON oBtn ID 101 OF oDlg ACTION oDlg:End() CANCELSaludos
Cerrar diálogo como si clickeara en la ""X""
Asi:REDEFINE BUTTON oEsconde ACTION oDlg:Hide() ID 105 OF oDlgSalu2
Cerrar diálogo como si clickeara en la ""X""
Gracias por responder.Willi, no se si entendiste lo que quiero hacer, con "oDlg:Hide()", el dialog no se cierra, sólo se oculta.Francisco, usé "oBtn:lCancel = .T." como indicas y funcionó según mis expectativas.Saludos.Rolando <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
Cerrar el dialogo clickando fuera
Hola, A ver si alguien puede ayudarme. Se trataría de que teniendo un dialogo en pantalla, clickando fuera de él, incluso sin perder el foco, el dialogo se cerrara. Saludos
Cerrar el dialogo clickando fuera
Antonio, Prueba a capturar todos los eventos del ratón para que te lleguen a ti: SetCapture( oDlg:hWnd ) cuando ya no lo necesites, lo liberas asi: ReleaseCapture()
Cerrar el dialogo clickando fuera
Antonio, Le echaré un vistazo, a ver si consigo que funcione. Si me funcionar con el ratón, después lo intentaré con el tablet pointer. Saludos
Cerrar o 'colapsar' paneles en TExplorerBar (SOLUCIONADO)
Hola, una nueva consulta. Estoy implementando las TExplorerBar en mi aplicación y están funcionando bastante bien, aunque no consigo cerrar los paneles vía código. Por lo que veo en la clase hay un data en el TTaskpanel que es lCollapsed, así que intento realizar un : [code=fw:rui7kxfx]<div class="fw" id="{CB}" style="font-family: monospace;">oExBar:<span style="color: #000000;">aPanels</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">lCollapsed</span>:=.T.<br />oExBar:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>[/code:rui7kxfx] donde oExbar es el objeto TExplorerBar previamente creado y en funcionamiento, pero nada ocurre, ¿alguna sugerencia? Gracias Angel Salom FWH10.11 - Harbour - BCC582
Cerrar o 'colapsar' paneles en TExplorerBar (SOLUCIONADO)
Yo mismo : [code=fw:349yiytb]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// Cierro 1 panel</span><br />nCerrar:=<span style="color: #000000;">3</span><br />oExBar:<span style="color: #000000;">aPanels</span><span style="color: #000000;">&#91;</span>nCerrar<span style="color: #000000;">&#93;</span>:<span style="color: #000000;">nHeight</span> = oExBar:<span style="color: #000000;">aPanels</span><span style="color: #000000;">&#91;</span>nCerrar<span style="color: #000000;">&#93;</span>:<span style="color: #000000;">nTitleHeight</span><br /><span style="color: #00C800;">For</span> nC:=nCerrar<span style="color: #000000;">+1</span> <span style="color: #0000ff;">To</span> Len <span style="color: #000000;">&#40;</span>oExBar:<span style="color: #000000;">aPanels</span><span style="color: #000000;">&#41;</span><br />  oExBar:<span style="color: #000000;">aPanels</span><span style="color: #000000;">&#91;</span>nC<span style="color: #000000;">&#93;</span>:<span style="color: #000000;">nTop</span> -= oExBar:<span style="color: #000000;">aPanels</span><span style="color: #000000;">&#91;</span>nCerrar<span style="color: #000000;">&#93;</span>:<span style="color: #000000;">nBodyHeight</span><br /><span style="color: #00C800;">Next</span>     <br />oExBar:<span style="color: #000000;">aPanels</span><span style="color: #000000;">&#91;</span>nCerrar<span style="color: #000000;">&#93;</span>:<span style="color: #000000;">lCollapsed</span>:=.T.<br /> </div>[/code:349yiytb] Donde oExBar es la tExplorerBar y nCerrar es el panel que se quiere cerrar. Angel Salom
Cerrar o 'colapsar' paneles en TExplorerBar (SOLUCIONADO)
Angel, Gracias funciona 100%
Cerrar o 'colapsar' paneles en TExplorerBar (SOLUCIONADO)
Angel, igualmente muchas gracias, es lo que necesitaba.
Cerrar o 'colapsar' paneles en TExplorerBar (SOLUCIONADO)
If you want search on english forum I made some modify on TexplorerBar and Add new methods to collapse and expand panels, watermak and other methods but linares never add these methods on new releases
Cerrar o 'colapsar' paneles en TExplorerBar (SOLUCIONADO)
Silvio, gracias por la información. Lo voy a mirar. Estoy echando en falta funcionalidades tales como desactivar link en los panel o poder usar bitmap en los títulos de los panel desde recursos.
Cerrar o 'colapsar' paneles en TExplorerBar (SOLUCIONADO)
I ASKED TO LINARES TO CREATE A MENU SYSTEM FOR THIS CLASS BUT IT SEEMS NOT INTEREST FOR ALL THE DANIEL MADE LISTBAR CLASS but the explorer not is modified Now I use another class ( of Mr P a c o)
Cerrar o 'colapsar' paneles en TExplorerBar (SOLUCIONADO)
Silvio, ¿puedes aportar información sobre la clase que estás usando actualmente? Gracias, Angel Salom FWH10.11 - Harbour - BCC582
Cerrar programa
Tengo el siguiente problema, he confeccionado una aplicación tipo menu para hacer llamadas a otros programas. Funciona perfectamente pero cuando cierro la aplicación sigue estando en el administrador de tareas, es decir no cerró. Hay alguna manera de forzar el cierre ?. Muchas gracias de antemano por cualquier ayuda. Salu2
Cerrar programa
[code=fw:2m0kqw74]<div class="fw" id="{CB}" style="font-family: monospace;"><br />&nbsp; &nbsp; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> oSaida <span style="color: #0000ff;">OF</span> OBAR <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"SAIDA"</span>, <span style="color: #ff0000;">"SAIR2"</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Saida"</span> &nbsp; &nbsp;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">MESSAGE</span> <span style="color: #ff0000;">"Saida do Programa"</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TOOLTIP <span style="color: #ff0000;">"Saida do Programa-Use <Alt+Z>"</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ACTION</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Click</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, oSaida:<span style="color: #000000;">Toggle</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, TERMINAR<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, oSaida:<span style="color: #000000;">GoUp</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NOBORDER GROUP TOP<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> OWNDMAIN <span style="color: #0000ff;">MAXIMIZED</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">VALID</span><span style="color: #000000;">&#40;</span> TERMINAR<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br /><br /><span style="color: #B900B9;">// -----------------------------------------------------------------------</span><br /><span style="color: #B900B9;">// Fun‡Æo.....: Terminar()</span><br /><span style="color: #B900B9;">// Descri‡Æo..: Fun‡Æo de Saida do Programa.</span><br /><span style="color: #B900B9;">// Para : Nenhum.</span><br /><span style="color: #B900B9;">// Devolve....: Nada.</span><br /><span style="color: #B900B9;">// -----------------------------------------------------------------------</span><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> TERMINAR<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> oDlg, oFontSay, IDCor, oBrush, oSaida, oCancela, oGroup, oQuestao<br /><br />&nbsp; &nbsp;<span style="color: #00C800;">PUBLIC</span> XSINALSONOR<br /><br />&nbsp; &nbsp;<span style="color: #00C800;">IF</span> VAL<span style="color: #000000;">&#40;</span> XSINALSONOR <span style="color: #000000;">&#41;</span> = <span style="color: #000000;">2</span><br />&nbsp; &nbsp; &nbsp; SndPlaySound<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Encerra.Wav"</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">ENDIF</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFontSay <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"Arial"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">-14</span> BOLD<br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BRUSH</span> oBrush &nbsp; &nbsp;<span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"LOGO2"</span> <span style="color: #B900B9;">//-> PEGA A BITMAP DO ARQUIVO.RES(LOGO.BMP)</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"TERMINAR"</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">BRUSH</span> oBrush TRANSPARENT<br /><br />&nbsp; &nbsp;oDlg:<span style="color: #000000;">lHelpIcon</span> := .F.<br /><br />&nbsp; &nbsp;<span style="color: #00C800;">For</span> iDcor=<span style="color: #000000;">401</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">402</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">REDEFINE</span> SENSITIVE <span style="color: #0000ff;">SAY</span> <span style="color: #0000ff;">ID</span> IDCor ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">COLOR</span> CLR_VERMELHO &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">OF</span> oDlg ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">UPDATE</span> RAISED <span style="color: #0000ff;">CENTER</span> <span style="color: #0000ff;">FONT</span> oFontSay TRANSPARENT<br />&nbsp; &nbsp;<span style="color: #00C800;">Next</span> IDCor &nbsp;<span style="color: #B900B9;">// By Ednaldo Rolim - Yes!</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">REDEFINE</span> DYNAMIC <span style="color: #0000ff;">SAY</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">801</span> <span style="color: #0000ff;">OF</span> oDlg &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">PROMPT</span> <span style="color: #000000;">&#40;</span> OemToAnsi<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">" &nbsp; &nbsp; &nbsp; &nbsp; Sugestäes: &nbsp; &nbsp; "</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"kmt_karinha@pop.com.br &nbsp;"</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"(11) 3106-2832 / 8243-5632 "</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">CENTERED</span> <span style="color: #0000ff;">HORIZONTAL</span> <span style="color: #0000ff;">SCROLL</span> SPEED <span style="color: #000000;">53</span> WRAP &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">COLOR</span> CLR_BLACK, nRGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">255</span>, <span style="color: #000000;">150</span> <span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">FONT</span> oFontSay<br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">REDEFINE</span> GROUP oGroup <span style="color: #0000ff;">ID</span> <span style="color: #000000;">501</span> <span style="color: #0000ff;">OF</span> oDlg &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">COLOR</span> nRGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">000</span>, <span style="color: #000000;">000</span>, <span style="color: #000000;">000</span> <span style="color: #000000;">&#41;</span>, nRGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">135</span>, <span style="color: #000000;">206</span>, <span style="color: #000000;">235</span> <span style="color: #000000;">&#41;</span> ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">FONT</span> oFontSay TRANSPARENT<br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">REDEFINE</span> BITMAP oQuestao <span style="color: #0000ff;">ID</span> <span style="color: #000000;">121</span> <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"F_QUESTAO2"</span> TRANSPARENT <span style="color: #0000ff;">OF</span> oDlg<br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> oSaida <span style="color: #0000ff;">ID</span> <span style="color: #000000;">301</span> &nbsp;<span style="color: #0000ff;">OF</span> oDlg &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ACTION</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, FINALIZA<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> CANCEL <span style="color: #0000ff;">UPDATE</span><br /><br />&nbsp; &nbsp;oSaida:<span style="color: #000000;">cToolTip</span> := <span style="color: #000000;">&#40;</span> OemToAnsi<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Saida - Exit - Finalizar o Programa "</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> oCancela <span style="color: #0000ff;">ID</span> <span style="color: #000000;">302</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> CANCEL <span style="color: #0000ff;">UPDATE</span><br /><br />&nbsp; &nbsp;oCancela:<span style="color: #000000;">cToolTip</span> := <span style="color: #000000;">&#40;</span> OemToAnsi<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Cancelar a Saida e Voltar ao Programa "</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;SET <span style="color: #0000ff;">FONT</span> <span style="color: #0000ff;">OF</span> oSaida &nbsp; <span style="color: #0000ff;">TO</span> oFontSay<br />&nbsp; &nbsp;SET <span style="color: #0000ff;">FONT</span> <span style="color: #0000ff;">OF</span> oCancela <span style="color: #0000ff;">TO</span> oFontSay<br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /><br />&nbsp; &nbsp;oBrush:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oFontSay:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">&#40;</span> .F. <span style="color: #000000;">&#41;</span><br /><br /><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> FINALIZA<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; FreeResources<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">// Set Resources To</span><br /><br />&nbsp; &nbsp; DBCLOSEALL<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">Release</span> All<br />&nbsp; &nbsp; SysRefresh<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; __QUIT<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">&#40;</span> .T. <span style="color: #000000;">&#41;</span><br /><br />&nbsp;</div>[/code:2m0kqw74] 
Cerrar programa
Gracias Karinha por responder, me he dado cuenta que la aplicación no cierra si llamo aplicaciones DOS, no tengo ese problema si llamo aplicaciones Windows. He probado tu sugerencia pero no funcionó ( En aplicaciones dos, si para prog windows ). Alguna otra sugerencia. Gracias de antemano Salu2
Cerrar programa
Horacio, intenta con esto: [code=fw:227tslu5]<div class="fw" id="{CB}" style="font-family: monospace;"><br />dBCloseAll<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />Set Resources <span style="color: #0000ff;">To</span><br />resallfree<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;memory<span style="color: #000000;">&#40;</span><span style="color: #000000;">-1</span><span style="color: #000000;">&#41;</span>;PostQuitMessage<span style="color: #000000;">&#40;</span><span style="color: #000000;">0</span><span style="color: #000000;">&#41;</span><br />&nbsp;__Quit<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:227tslu5] Saludos, Adhemar
Cerrar programa
Adhemar, funcionó correctamente. Muchisimas gracias. Salu2
Cerrar shellexecute
Hola gente ! Selecciono un archivo con shellexecute y pregunto si quiere o no abrirlo. Como hago lyego para cerrarlo ? Por Ejemplo shellexecute(nil,"open",cfile,,,1) if ! msgyesno("Planilla Correcta ?","???") // ¿Como lo cierro si no es la planilla correcta ?........ clos data return nil endif
Cerrar shellexecute
hi, you can "close" a Window when know it´s "Title" [code=fw:52of40yf]<div class="fw" id="{CB}" style="font-family: monospace;">PROCEDURE CloseWindow<span style="color: #000000;">&#40;</span>cTitle<span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">LOCAL</span> hWnd := FindWindowEx<span style="color: #000000;">&#40;</span>,,, cTitle <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">IF</span> EMPTY<span style="color: #000000;">&#40;</span>hWnd<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"need Title of Windows to close"</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">ELSE</span><br />   <span style="color: #00C800;">IF</span> !<span style="color: #000000;">&#40;</span> hWnd == <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span><br />      SetForegroundWindow<span style="color: #000000;">&#40;</span> hWnd <span style="color: #000000;">&#41;</span><br />      BringWindowToTop<span style="color: #000000;">&#40;</span> hWnd <span style="color: #000000;">&#41;</span><br />      ShowWindow<span style="color: #000000;">&#40;</span> hWnd, <span style="color: #000000;">1</span> <span style="color: #000000;">&#41;</span><br />      UpdateWindow<span style="color: #000000;">&#40;</span> hWnd <span style="color: #000000;">&#41;</span><br />      SendMessageA<span style="color: #000000;">&#40;</span> hWnd, WM_CLOSE, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span>   <br />   <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">RETURN</span></div>[/code:52of40yf]
Cerrar un Dialog Automatico
holas Amigos... Hay alguna forma de cerrar un Dialog cuando este luego de un tiempo sin usar por el usuario ? gracias david
Cerrar un Dialog Automatico
Puedes usar un Timer que controle el estado de una variable en donde anotas si se ha usado ó no, y de llegar a un tiempo sin usarse, cerrar el diálogo Controlar si se ha usado puedes hacerlo desde las acciones de los botones, ó desde los VALIDs, etc... según te interese
Cerrar un Dialog luego de un tiempo
Amigos Alguien tiene un ejemplo de como cerrar un Dialog luego de un cierto tiempo de no tener ninguna actuvidad ? gracias david <!-- s:roll: --><img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" /><!-- s:roll: -->
Cerrar un Dialog luego de un tiempo
David aqui un Ej: [code=fw:15vjioav]<div class="fw" id="{CB}" style="font-family: monospace;"><br />&nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">125</span>,<span style="color: #000000;">207</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">520</span>,<span style="color: #000000;">873</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"FACTURAS"</span> <br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">TIMER</span> oTimer <span style="color: #0000ff;">INTERVAL</span> <span style="color: #000000;">400000</span> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span>oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,oTimer:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp;<span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> oTimer:<span style="color: #0000ff;">Activate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; oTimer:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp;</div>[/code:15vjioav] Saludos, Adhemar
Cerrar un Dialog luego de un tiempo
Esta bien el timer, pero como determinas si el dialogo no halla tenido algun cambio ?
Cerrar un dialogo
Hola foreros Repasando algunos asuntos que tenía pendientes, he notado que en este foro ha salido, en distintas ocasiones, el tema de cerrar un dialogo cuando pulsamos fuera con el ratón, sin que se le haya dado una solución genérica. Bueno pues quiero exponer aquí algunas soluciones que he aplicado a mis programas y que me han ido muy bien. Como podrá imaginar todo depende del tipo de dialogo y de la cantidad de controles que tenga el dialogo; lo que sí es absolutamente necesario es que sea no modal (NOWAIT). Aun así he probado distintas soluciones, unas me han ido mejor que otras. Principalmente utilizo tres métodos, todos efectivos (al menos en mis programas): 1º Tengo un dialogo NOWAIT con un solo control. Por ejemplo un Listbox que ocupa todo el dialogo. Solución: [code=fw:epk4odj4]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg ….<br />   <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">LISTBOX</span> oLbx …<br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">NOWAIT</span> …<br />*<br />oLbx:<span style="color: #000000;">bLostFocus</span> = <span style="color: #000000;">&#123;</span> || oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br /> </div>[/code:epk4odj4] Con la única precaución de asegurarse de que el Listbox toma el foco siempre que se activa el dialogo. Por ejemplo comprobando que el nStyle del Listbox contiene la directiva WS_TABSTOP. 2º Tengo un dialogo con dos o tres controles. Por ejemplo un Listbox y dos botones. Es muy común. Mi solución: [code=fw:epk4odj4]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">LOCAL</span> oCtrl<span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span><br />*<br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg ….<br />   <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">LISTBOX</span> oCtrl<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span> …<br />   <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> oCtrl<span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span> …<br />   <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> oCtrl<span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span> …<br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">NOWAIT</span> …<br />*<br />AEVAL<span style="color: #000000;">&#40;</span> oCtrl, <span style="color: #000000;">&#123;</span> |oCt|  oCt:<span style="color: #000000;">bLostFocus</span> := <span style="color: #000000;">&#123;</span> || <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span>GetActiveWindow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> # oDlg:<span style="color: #000000;">hWnd</span>,oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br /> </div>[/code:epk4odj4] Precauciones: - Que al menos uno de los controles tome el foco al activarse el dialogo. - Definir todos los controles un en solo array, en este caso oCtrl[3] para manejarlos con AEVAL(), ahorra tener que definir un bLostFocus para cada control, aunque tampoco pasa nada pues sólo son tres controles. También podría dirigir todos los bLostFocus hacia una función que controle el cierre del dialogo: AEVAL( oCtrl, { |oCt| oCt:bLostFocus := { |Self| FuncEnd( Self,…) } } ) ¿Ha notado que, en ambos casos, he definido los bLostFocus después de activar el dialogo? Es importante, pero no necesario, aunque aconsejo que lo haga así, especialmente cuando tiene que definir un ON INIT para el dialogo. Por otra parte, he de señalar que muchas veces el bLostFocus interfiere con las acciones a las que llaman los distintos controles. Por ejemplo desplegar un MessageBox al pulsar uno de los botones, en cuyo caso se activaría el bLostFocus y se cerraría el dialogo inoportunamente. No es problema, en la función que llama al MessageBox guarde el contenido del bLostFocus en una variable, ponga el bLostFocus a NIL y recupérelo después de la acción, al final de la función. [code=fw:epk4odj4]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">FUNCTION</span> MiFunc<span style="color: #000000;">&#40;</span>…<span style="color: #000000;">&#41;</span><br />   <span style="color: #00C800;">LOCAL</span> bLost := oCtrl: <span style="color: #000000;">bLostFocus</span><br />   *<br />   bLostFocus := <span style="color: #00C800;">NIL</span><br />   …<br />   MSGALERT<span style="color: #000000;">&#40;</span> … <span style="color: #000000;">&#41;</span><br />   …<br />   bLostFocus := bLost<br /><span style="color: #00C800;">RETURN</span> …<br /><br />O<br /><br /><span style="color: #00C800;">FUNCTION</span> MiFunc<span style="color: #000000;">&#40;</span>…<span style="color: #000000;">&#41;</span><br />   <span style="color: #00C800;">LOCAL</span> bLost := oCtrl<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>: <span style="color: #000000;">bLostFocus</span><br />   *<br />   AEVAL<span style="color: #000000;">&#40;</span>oDlg:<span style="color: #000000;">aControls</span>,<span style="color: #000000;">&#123;</span> |o| o:<span style="color: #000000;">bLostFocus</span> := <span style="color: #00C800;">NIL</span> <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><br />   …<br />   MSGALERT<span style="color: #000000;">&#40;</span> … <span style="color: #000000;">&#41;</span><br />   …<br />   AEVAL<span style="color: #000000;">&#40;</span>oDlg:<span style="color: #000000;">aControls</span>,<span style="color: #000000;">&#123;</span> |o| o:<span style="color: #000000;">bLostFocus</span> := bLost <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">RETURN</span> …<br /><br /> </div>[/code:epk4odj4] 3º Tengo un dialogo NOWAIT complejo, con controles de todo tipo, y el dialogo tiene definidas clausulas ON INIT, VALID, etc y quiero que se cierre cuando pulso fuera con el ratón, sin renunciar al comportamiento normal del dialogo, todos sus controles, sus cláusulas y codeblocks. Esta solución implica modificar ligeramente la clase TWINDOW, o en su defecto la TDIALOG, pero merece la pena, pues el programa hace exactamente lo que queremos que haga. En cuanto pulsas fuera del dialogo este ejecuta su VALID y se cierra (si el VALID devuelvió .T. claro) 1) Hay que añadir un data, el que recoje el codeblock que deberá ejecutarse cuando pulse fuera del dialogo. Yo lo he llamado ‘bNcLost’, pero podeis darle el nombre que más os guste - Hay que modificar el METHOD NcActivate() de TWINDOWS de la siguiente manera (o podeis crearlo en TDIALOG): [code=fw:epk4odj4]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">METHOD</span> NcActivate<span style="color: #000000;">&#40;</span> lOnOff <span style="color: #000000;">&#41;</span>     <span style="color: #00C800;">CLASS</span> TDIalog<br />   <span style="color: #00C800;">LOCAL</span> hFWnd := GetFocus<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />   *<br />   <span style="color: #00C800;">IF</span> !lOnOff .AND. ::<span style="color: #000000;">hWnd</span> # hFWnd<br />      <span style="color: #00C800;">IF</span> ::<span style="color: #000000;">bNcLost</span> # <span style="color: #00C800;">NIL</span><br />         Eval<span style="color: #000000;">&#40;</span> ::<span style="color: #000000;">bNcLost</span>, <span style="color: #00C800;">Self</span>, hFWnd<span style="color: #000000;">&#41;</span><br />      ELSEIF ::<span style="color: #000000;">bLostFocus</span> # <span style="color: #00C800;">NIL</span><br />         Eval<span style="color: #000000;">&#40;</span> ::<span style="color: #000000;">bLostFocus</span>, <span style="color: #00C800;">Self</span>, hFWnd <span style="color: #000000;">&#41;</span><br />      <span style="color: #00C800;">ENDIF</span><br />   <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:epk4odj4] Si analizáis el METHOD comprobará que varía muy poquito respecto del original, aunque no lo parezca. - ahora, en vuestro programa, definid vuestro dialogo de la siguiente manera: [code=fw:epk4odj4]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg ….<br />   <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">LISTBOX</span> oLbx …<br />   <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">SAY</span> oSay1 …<br />   <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">SAY</span> oSay2 …<br />   …<br />   <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBot1 …<br />   <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBot2 …<br />   …<br />   oDlg: <span style="color: #000000;">bPainted</span>  := <span style="color: #000000;">&#123;</span> |hdc| …<span style="color: #000000;">&#125;</span><br />   oDlg: <span style="color: #000000;">bRClicked</span> := <span style="color: #000000;">&#123;</span> ||  … <span style="color: #000000;">&#125;</span><br />  …<br /><br />oDlG:<span style="color: #000000;">bNcLost</span>   := <span style="color: #000000;">&#123;</span> |oDiag| PostMessage<span style="color: #000000;">&#40;</span>oDiag:<span style="color: #000000;">hWnd</span>,WM_CLOSE<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <br />o<br />oDlG:<span style="color: #000000;">bNcLost</span>   := <span style="color: #000000;">&#123;</span> |oDiag| FuncClose<span style="color: #000000;">&#40;</span> oDiag,…<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <br /><br />  …<br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">NOWAIT</span> … <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> … <span style="color: #0000ff;">VALID</span> …<br /> </div>[/code:epk4odj4] En este caso no es necesario definir bNcLost después de activar el dialogo. Espero os sea de utilidad. Saludos.
Cerrar un dialogo
Magnifico post Antolín. Antonio Linares puso un post para cerrar un dialog. Utilizaba la tecnica de capturar el mouse para el dialogo. Cualquier clicking fuera de las dimensiones del dialogo provocaba el cierre de este. No lo llegue a probar pero la idea me parecio muy buena: el proceso era limpio y rapido. De tus metodos, el que parece que me gusta mas es el ultimo. Creo que fwh deberia incorporar de serie un sistema que hiciera esto, especialmente pensando en los sistemas tactiles. Quiza se podria aprovechar tu sistema: me parece limpio y claro.
Cerrar un dialogo
La verdad es que, ahora, mirando mi post, me he dado cuenta de un pequeño detalle. Parece como si bNcLost hiciera lo mismo que bLostFocus, sin embargo he de decir, en honor a la verdad, que yo no he modificado el METHDO de TWINDOWS, pues tengo un TDIALOG modificado y en esa clase he añadido el METHOD NcActivate (sin la parte de bLostFocus). En teoría es lo mismo puesto que TDIALOG hereda de TWINDOWS, pero lo que si es cierto es que con bLostFocus de TWINDOS no ocurre el efecto que logro con el bNcLost de mi TDIALOG y no se porqué. Un saludo
Cerrar un dialogo
Colegas, aquí pongo un ejemplo donde nunca se llega a abrir el dialogo, ya que no hace nunca foco. [code=fw:2c3jj6kg]<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: #B900B9;">//----------------------------------------------------------------------------//</span><br /><span style="color: #00C800;">Function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">Local</span> oGet<br />&nbsp; &nbsp; <span style="color: #00C800;">Local</span> oDlg<br />&nbsp; &nbsp; <span style="color: #00C800;">Local</span> cVar := Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">60</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #0000ff;">Define</span> <span style="color: #0000ff;">Dialog</span> oDlg <span style="color: #0000ff;">From</span> <span style="color: #000000;">100</span>, <span style="color: #000000;">100</span> <span style="color: #0000ff;">To</span> <span style="color: #000000;">400</span>, <span style="color: #000000;">500</span> <span style="color: #0000ff;">Pixel</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; @ <span style="color: #000000;">20</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">Get</span> oGet <span style="color: #0000ff;">Var</span> cVar <span style="color: #0000ff;">Of</span> oDlg <span style="color: #0000ff;">Size</span> <span style="color: #000000;">100</span>, <span style="color: #000000;">12</span> <span style="color: #0000ff;">Picture</span> <span style="color: #ff0000;">'@!'</span> <span style="color: #0000ff;">Action</span> AbreCaja<span style="color: #000000;">&#40;</span> oGet, oDlg <span style="color: #000000;">&#41;</span> Bitmap FWDArrow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">Pixel</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #0000ff;">Activate</span> <span style="color: #0000ff;">Dialog</span> oDlg<br />&nbsp; &nbsp; <span style="color: #00C800;">Return</span> <span style="color: #000000;">0</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><span style="color: #00C800;">Function</span> AbreCaja<span style="color: #000000;">&#40;</span> oGet, oDialogo <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">Local</span> oDlg<br />&nbsp; &nbsp; <span style="color: #00C800;">Local</span> aPoint := <span style="color: #000000;">&#123;</span> oGet : <span style="color: #000000;">nTop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> - <span style="color: #000000;">80</span>, oGet : <span style="color: #000000;">nLeft</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; ClientToScreen<span style="color: #000000;">&#40;</span> oDialogo : <span style="color: #000000;">hWnd</span>, aPoint <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">Define</span> <span style="color: #0000ff;">Dialog</span> oDlg <span style="color: #0000ff;">Of</span> oDialogo <span style="color: #0000ff;">From</span> aPoint<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> + <span style="color: #000000;">110</span>, aPoint<span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span> <span style="color: #0000ff;">To</span> aPoint<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> + <span style="color: #000000;">180</span>, aPoint<span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span> + <span style="color: #000000;">180</span> <span style="color: #0000ff;">Pixel</span> <span style="color: #0000ff;">Style</span> nOr<span style="color: #000000;">&#40;</span> WS_POPUP, WS_BORDER <span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">Color</span> <span style="color: #000000;">0</span>, CLR_WHITE<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; oDlg : <span style="color: #000000;">bLostFocus</span> := <span style="color: #000000;">&#123;</span> || oDlg : <span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #0000ff;">Activate</span> <span style="color: #0000ff;">Dialog</span> oDlg <span style="color: #0000ff;">On</span> <span style="color: #0000ff;">Init</span> oDlg : <span style="color: #000000;">SetFocus</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">NoWait</span><br />&nbsp; &nbsp; <span style="color: #00C800;">Return</span> <span style="color: #000000;">0</span> &nbsp; &nbsp;<br />&nbsp;</div>[/code:2c3jj6kg] Alguna solución para este problema ? Muchísimas gracias Saludos
Cerrar un dialogo
horacio, Si el problema es que no hay ningun control definido, yo definiria un get asi: @ 3000,3000 GET cValor // Workaround Esta solucion tambien es valida cuando hay que validar el ultimo get, pero no se valida porque no pierde el foco porque no hay control después. Saludos
Cerrar un dialogo
Antolín, aunque le ponga un control tampoco llega a hacer foco. Me he estado peleando con esto hace tiempo. Lo que noté es que no ocurre en una window con un dialog NoWait, con esa configuración si funciona. Saludos
Cerrar un dialogo
Un ejemplo con un control en el dialogo que quiero abrir [code=fw:3a6vneiy]<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: #B900B9;">//----------------------------------------------------------------------------//</span><br /><span style="color: #00C800;">Function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">Local</span> oGet<br />&nbsp; &nbsp; <span style="color: #00C800;">Local</span> oDlg<br />&nbsp; &nbsp; <span style="color: #00C800;">Local</span> cVar := Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">60</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #0000ff;">Define</span> <span style="color: #0000ff;">Dialog</span> oDlg <span style="color: #0000ff;">From</span> <span style="color: #000000;">100</span>, <span style="color: #000000;">100</span> <span style="color: #0000ff;">To</span> <span style="color: #000000;">400</span>, <span style="color: #000000;">500</span> <span style="color: #0000ff;">Pixel</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; @ <span style="color: #000000;">20</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">Get</span> oGet <span style="color: #0000ff;">Var</span> cVar <span style="color: #0000ff;">Of</span> oDlg <span style="color: #0000ff;">Size</span> <span style="color: #000000;">100</span>, <span style="color: #000000;">12</span> <span style="color: #0000ff;">Picture</span> <span style="color: #ff0000;">'@!'</span> <span style="color: #0000ff;">Action</span> AbreCaja<span style="color: #000000;">&#40;</span> oGet, oDlg <span style="color: #000000;">&#41;</span> Bitmap FWDArrow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">Pixel</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #0000ff;">Activate</span> <span style="color: #0000ff;">Dialog</span> oDlg<br />&nbsp; &nbsp; <span style="color: #00C800;">Return</span> <span style="color: #000000;">0</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><span style="color: #00C800;">Function</span> AbreCaja<span style="color: #000000;">&#40;</span> oGet, oDialogo <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">Local</span> oDlg<br />&nbsp; &nbsp; <span style="color: #00C800;">Local</span> aDatos := <span style="color: #000000;">&#123;</span> <span style="color: #ff0000;">'UNO'</span>, <span style="color: #ff0000;">'DOS'</span>, <span style="color: #ff0000;">'TRES'</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; <span style="color: #00C800;">Local</span> aPoint := <span style="color: #000000;">&#123;</span> oGet : <span style="color: #000000;">nTop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> - <span style="color: #000000;">80</span>, oGet : <span style="color: #000000;">nLeft</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; ClientToScreen<span style="color: #000000;">&#40;</span> oDialogo : <span style="color: #000000;">hWnd</span>, aPoint <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">Define</span> <span style="color: #0000ff;">Dialog</span> oDlg <span style="color: #0000ff;">Of</span> oDialogo <span style="color: #0000ff;">From</span> aPoint<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> + <span style="color: #000000;">110</span>, aPoint<span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span> <span style="color: #0000ff;">To</span> aPoint<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> + <span style="color: #000000;">180</span>, aPoint<span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span> + <span style="color: #000000;">180</span> <span style="color: #0000ff;">Pixel</span> <span style="color: #0000ff;">Style</span> nOr<span style="color: #000000;">&#40;</span> WS_POPUP, WS_BORDER <span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">Color</span> <span style="color: #000000;">0</span>, CLR_WHITE<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; @ <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #0000ff;">xBrowse</span> oBrw DataSource aDatos Columns <span style="color: #000000;">1</span> <span style="color: #0000ff;">Size</span> <span style="color: #000000;">92</span>, <span style="color: #000000;">35</span> <span style="color: #0000ff;">Pixel</span> NoBorder<br />&nbsp; &nbsp; &nbsp; &nbsp; oBrw : <span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>&nbsp;&nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; oDlg : <span style="color: #000000;">bLostFocus</span> := <span style="color: #000000;">&#123;</span> || oDlg : <span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #0000ff;">Activate</span> <span style="color: #0000ff;">Dialog</span> oDlg <span style="color: #0000ff;">On</span> <span style="color: #0000ff;">Init</span> oBrw : <span style="color: #000000;">SetFocus</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">NoWait</span><br />&nbsp; &nbsp; <span style="color: #00C800;">Return</span> <span style="color: #000000;">0</span> &nbsp; &nbsp;<br />&nbsp;</div>[/code:3a6vneiy] Saludos
Cerrar un dialogo
Horacio, si no hay controles, no pueden tomar o perder el foco... La única solución que a mi me funciona es la tercera vía que he explicado en mi post: 'bNcLost', significa modificar TDIALOG, pero merece la pena, funciona muy bien.
Cerrar un dialogo
En cuanto al xBrowse, Horacio, no sé, hace muchos años que no lo utilizo. Asegúrate de que tiene definido el WS_TABSTOP en su nStyle y que el dialogo permite que el xBrowse tome el foco. También asegúrate de que no le has definido el bLostFocus por otro lado. Pero primero, prueba a poner bLostFocus fuera de la estructura DEFINE DIALOG...ACTIVATE, es decir después del ACTIVATE, a veces me ha pasado. Si no, prueba con la segunda fórmula: oBrw:bLostFocus := { || IF(GetActiveWindow() # oDlg:hWnd,oDlg:End(),) } Espero te sirva. Un saludo
Cerrar un dialogo
Horacio, Yo lo hago asi: [code=fw:2eos0m0o]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">function</span> PopupBrowse<span style="color: #000000;">&#40;</span> aValue, oGet, bInit <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> oDlg, oBrw<br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> aPoint := <span style="color: #000000;">&#123;</span> oGet:<span style="color: #000000;">nTop</span> + oGet:<span style="color: #000000;">nHeight</span>, oGet:<span style="color: #000000;">nLeft</span> <span style="color: #000000;">&#125;</span>&nbsp;<br /><br />&nbsp; &nbsp;<span style="color: #00C800;">if</span> oGet:<span style="color: #000000;">Cargo</span> == <span style="color: #00C800;">nil</span><br />&nbsp; &nbsp; &nbsp; aPoint = ClientToScreen<span style="color: #000000;">&#40;</span> oGet:<span style="color: #000000;">oWnd</span>:<span style="color: #000000;">hWnd</span>, aPoint <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;&nbsp;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">OF</span> oGet:<span style="color: #000000;">oWnd</span> <span style="color: #0000ff;">STYLE</span> WS_POPUP ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">500</span>, <span style="color: #000000;">180</span>&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">NOWAIT</span> ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> oDlg:<span style="color: #000000;">SetPos</span><span style="color: #000000;">&#40;</span> aPoint<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span>, aPoint<span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;&nbsp;<br />&nbsp; &nbsp; &nbsp; @ <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #0000ff;">XBROWSE</span> oBrw ARRAY aValue AUTOSORT ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">SIZE</span> oDlg:<span style="color: #000000;">nWidth</span>, oDlg:<span style="color: #000000;">nHeight</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">PIXEL</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; oBrw:<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; Eval<span style="color: #000000;">&#40;</span> bInit, oBrw <span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /><br />&nbsp; &nbsp; &nbsp; oBrw:<span style="color: #000000;">PostMsg</span><span style="color: #000000;">&#40;</span> WM_SETFOCUS <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; oBrw:<span style="color: #000000;">bKeyDown</span> = <span style="color: #000000;">&#123;</span> | nKey | <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> nKey == VK_RETURN, oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span>&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; oBrw:<span style="color: #000000;">bChange</span> = <span style="color: #000000;">&#123;</span> || oGet:<span style="color: #000000;">VarPut</span><span style="color: #000000;">&#40;</span> oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span>:<span style="color: #000000;">Value</span> <span style="color: #000000;">&#41;</span>, oGet:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span>&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; oBrw:<span style="color: #000000;">bLButtonUp</span> = <span style="color: #000000;">&#123;</span> | nRow, nCol | <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> nRow > oBrw:<span style="color: #000000;">nHeaderHeight</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#40;</span> Eval<span style="color: #000000;">&#40;</span> oBrw:<span style="color: #000000;">bChange</span> <span style="color: #000000;">&#41;</span>, oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oGet:<span style="color: #000000;">oWnd</span>:<span style="color: #000000;">GoNextCtrl</span><span style="color: #000000;">&#40;</span> oGet:<span style="color: #000000;">hWnd</span> <span style="color: #000000;">&#41;</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oGet:<span style="color: #000000;">Cargo</span> := <span style="color: #00C800;">nil</span> <span style="color: #000000;">&#41;</span>,<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; oBrw:<span style="color: #000000;">Seek</span><span style="color: #000000;">&#40;</span> oGet:<span style="color: #000000;">GetText</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /><br />&nbsp; &nbsp; &nbsp; oGet:<span style="color: #000000;">Cargo</span> = oDlg&nbsp;&nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; oGet:<span style="color: #000000;">bKeyDown</span> = <span style="color: #000000;">&#123;</span> | nKey | <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> nKey == VK_DOWN, oBrw:<span style="color: #000000;">GoDown</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,<span style="color: #000000;">&#41;</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> nKey == VK_UP, oBrw:<span style="color: #000000;">GoUp</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,<span style="color: #000000;">&#41;</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> nKey == VK_RETURN, oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,<span style="color: #000000;">&#41;</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; oGet:<span style="color: #000000;">oWnd</span>:<span style="color: #000000;">bLClicked</span> = <span style="color: #000000;">&#123;</span> || oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, oGet:<span style="color: #000000;">Cargo</span> := <span style="color: #00C800;">nil</span> <span style="color: #000000;">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; oGet:<span style="color: #000000;">oWnd</span>:<span style="color: #000000;">bMouseWheel</span> = <span style="color: #000000;">&#123;</span> || oDlg:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">else</span><br />&nbsp; &nbsp; &nbsp; oGet:<span style="color: #000000;">Cargo</span>:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; oGet:<span style="color: #000000;">Cargo</span> = <span style="color: #00C800;">nil</span>&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp;<span style="color: #00C800;">endif</span> &nbsp; &nbsp;&nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span> &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>[/code:2eos0m0o]
Cerrar un dialogo
Exacto, Horacio, se trata de que tu xBrowse tome el foco para poder decirle que cierre el dialogo cuando lo pierda. Antonio lo solventa muy sabiamente con oBrw:PostMsg( WM_SETFOCUS ). Lo que no veo tan claro es: [code=fw:2gbx7exx]<div class="fw" id="{CB}" style="font-family: monospace;">      oGet:<span style="color: #000000;">oWnd</span>:<span style="color: #000000;">bLClicked</span> = <span style="color: #000000;">&#123;</span> || oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, oGet:<span style="color: #000000;">Cargo</span> := <span style="color: #00C800;">nil</span> <span style="color: #000000;">&#125;</span>                                                                    <br />      oGet:<span style="color: #000000;">oWnd</span>:<span style="color: #000000;">bMouseWheel</span> = <span style="color: #000000;">&#123;</span> || oDlg:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br /> </div>[/code:2gbx7exx] ¿Que pasa si pincho fuera del oGet:oWnd?, y por otro lado, porque hay que decirle al xBrowse que retome el foco a cada MouseWheel. No sería más efectivo que no pierda el foco con la rueda del ratón, porqué habría de perderlo? Todo desde el mayor de los respetos por el maestro claro.
Cerrar un dialogo
Perdón, he confundido oGet:oWnd:bMouseWheel con oBrw:bMouseWheel. Mejor será que me calle a ese rescpecto... Perdón de nuevo
Cerrar un indice Temporal (Solucionado)
Buenas Estoy enredado en este tema y no sé como solucionarlo: La cuestión es que tengo abiertas varias bases de datos: [code=fw:f59j78ye]<div class="fw" id="{CB}" style="font-family: monospace;">  dbUseArea<span style="color: #000000;">&#40;</span>.T.,,Publicas:<span style="color: #000000;">cUnidad</span>+Publicas:<span style="color: #000000;">cSubd</span>+<span style="color: #ff0000;">"<span style="color: #000000;">\F</span>actura"</span>,aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">22</span><span style="color: #000000;">&#93;</span>,.T.<span style="color: #000000;">&#41;</span><br />  <span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">22</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>OrdSetFocus<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Codigo"</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />  <span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">22</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> dbGotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />  dbUseArea<span style="color: #000000;">&#40;</span>.T.,,Publicas:<span style="color: #000000;">cUnidad</span>+Publicas:<span style="color: #000000;">cSubd</span>+<span style="color: #ff0000;">"<span style="color: #000000;">\I</span>nciden"</span>,aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">33</span><span style="color: #000000;">&#93;</span>,.T.<span style="color: #000000;">&#41;</span><br />  <span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">33</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>OrdSetFocus<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Orden"</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />  <span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">33</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> dbGotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />  <br />  dbUseArea<span style="color: #000000;">&#40;</span>.T.,,Publicas:<span style="color: #000000;">cUnidad</span>+Publicas:<span style="color: #000000;">cSubd</span>+<span style="color: #ff0000;">"<span style="color: #000000;">\A</span>LBARAN"</span>,aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">24</span><span style="color: #000000;">&#93;</span>,.T.<span style="color: #000000;">&#41;</span><br />  <span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">24</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>OrdSetFocus<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Albaran"</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />  <span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">24</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> dbGotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span></div>[/code:f59j78ye] Después llamo a una función para un informe: [code=fw:f59j78ye]<div class="fw" id="{CB}" style="font-family: monospace;">  <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"CAJAR"</span>    <span style="color: #0000ff;">OF</span> oBar NOBORDER <span style="color: #0000ff;">MESSAGE</span> <span style="color: #ff0000;">"Listado de Contados Pendientes de Cobro"</span>  <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span>nRegAct := <span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">24</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>RecNo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>,Contadopendiente<span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#41;</span>,,<span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">24</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> dbgoto<span style="color: #000000;">&#40;</span> nRegAct <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>,oLbx:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />            <span style="color: #0000ff;">WHEN</span> Publicas:<span style="color: #000000;">cAccesoL</span>;<br />                TOOLTIP <span style="color: #ff0000;">"Listado de Contados Pendiestes de Cobro"</span></div>[/code:f59j78ye] Y ya en la función, genero un índice temporal en memoria: [code=fw:f59j78ye]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> contadopendiente<span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#41;</span><br />********************************<br />     <span style="color: #00C800;">local</span> oFont1, oFont2<br />     <span style="color: #00C800;">local</span> oPrinter,oPrn<br />     <span style="color: #00C800;">local</span> ctitle:= <span style="color: #ff0000;">"LISTADO DE ALBARANES DE CONTADO PENDIENTES DE COBRO"</span><br />     <span style="color: #00C800;">local</span> nindex:=<span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">24</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>Ordsetfocus<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />     <span style="color: #0000ff;">index</span> <span style="color: #0000ff;">on</span> <span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">24</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>->Fecha <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"Tfecha1"</span> <span style="color: #00C800;">FOR</span> <span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">24</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>->tipo=<span style="color: #000000;">2</span> .and. <span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">24</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>->liqui=.F. ADDITIVE MEMORY</div>[/code:f59j78ye] y ahora viene el problema, cuando salgo de ésta función, elijo el orden que traía de la función principal. [code=fw:f59j78ye]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">24</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>Ordsetfocus<span style="color: #000000;">&#40;</span>nindex<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #000000;">&#40;</span>aAlias<span style="color: #000000;">&#91;</span><span style="color: #000000;">24</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>Dbgotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:f59j78ye] Pero ésto no funciona, sigue estando el índice que he creado en memoria, como puedo destruir éste índice y volver al que tenía anteriormente. He probado con Orddestroy('Tfecha1'), pero nada sigue éste índice, y quiero que vuelva al anterior. Un Saludo y gracias de antemano
Cerrar un indice Temporal (Solucionado)
Jose Luis, mira a ver si te sirve <!-- m --><a class="postlink" href="https://vivaclipper.wordpress.com/2014/01/18/orddestroy/">https://vivaclipper.wordpress.com/2014/ ... rddestroy/</a><!-- m -->
Cerrar un indice Temporal (Solucionado)
Cristóbal Muchas gracias por responder, pero como indicaba anteriormente, no responde a Orddestroy(). No sé si el problema estará en que de algún modo construyo mal el índice. Un saludo