topic
stringlengths
1
63
text
stringlengths
1
577k
clausole When...Hide a size of Dialog - strange - RESOLVED
Silvio, please ADD: [code=fw:1h5afpyn]<div class="fw" id="{CB}" style="font-family: monospace;"><br />&nbsp; &nbsp; &nbsp; &nbsp; <!-- Windows <span style="color: #000000;">10</span> --><br />&nbsp; &nbsp; &nbsp; &nbsp; <supportedOS <span style="color: #0000ff;">Id</span>=<span style="color: #ff0000;">"{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"</span>/><br />&nbsp;</div>[/code:1h5afpyn] look this: [url:1h5afpyn]https&#58;//github&#46;com/eladkarako/manifest/tree/master/example_manifests[/url:1h5afpyn] WOW!! Regards, saludos.
clausole When...Hide a size of Dialog - strange - RESOLVED
Dear Silvio, [url:mciz12iy]https&#58;//learn&#46;microsoft&#46;com/en-us/answers/questions/490947/windows-11-os-id&#46;html[/url:mciz12iy] Regards, saludos.
clausole When...Hide a size of Dialog - strange - RESOLVED
[b:8fhxm6q1]FOUND THE PROBLEM [/b:8fhxm6q1] DEFINE DIALOG oDlg ; SIZE nWidth, nHeight PIXEL ; TITLE cTitle ; COLOR CLR_BLACK,CLR_WHITE instead of DEFINE DIALOG oDlg ; SIZE nWidth, nHeight PIXEL ; TITLE cTitle ; COLOR CLR_BLACK,CLR_WHITE [b:8fhxm6q1]TRANSPARENT[/b:8fhxm6q1] it seems [b:8fhxm6q1]TRANSPARENT [/b:8fhxm6q1] give problem the resource I used that of Fwh folder ( my realease December 2021 to March 2022) [img:8fhxm6q1]https&#58;//i&#46;postimg&#46;cc/2596NL70/yes&#46;gif[/img:8fhxm6q1] I put [b:8fhxm6q1]TRANSPARENT[/b:8fhxm6q1] [b:8fhxm6q1]ONLY [/b:8fhxm6q1] on SAY CONTROLS and run ok [img:8fhxm6q1]https&#58;//i&#46;postimg&#46;cc/0ydc8Djd/yes&#46;gif[/img:8fhxm6q1]
clausole When...Hide a size of Dialog - strange - RESOLVED
Now run ok [img:18gt9hz5]https&#58;//i&#46;postimg&#46;cc/x1VkLGbw/NOW-RUN&#46;png[/img:18gt9hz5]
clausole When...Hide a size of Dialog - strange - RESOLVED
Dear Silvio, Congratulations. Even so, please test with this MANIFEST model using COLORS in the controls, please. Estimado Silvio, Felicitaciones. Aun así, prueba con este modelo MANIFEST usando COLORES en los controles, por favor. WINDOWS10.MANIFEST [code=fw:1425r2sq]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><?xml version=<span style="color: #ff0000;">"1.0"</span> encoding=<span style="color: #ff0000;">"UTF-8"</span> standalone=<span style="color: #ff0000;">"yes"</span>?> <br /><assembly xmlns=<span style="color: #ff0000;">"urn:schemas-microsoft-com:asm.v1"</span> manifestVersion=<span style="color: #ff0000;">"1.0"</span>> <br />&nbsp; <dependency optional=<span style="color: #ff0000;">"yes"</span>> <br />&nbsp; &nbsp; <dependentAssembly> <br />&nbsp; &nbsp; &nbsp; <assemblyIdentity <span style="color: #0000ff;">name</span>=<span style="color: #ff0000;">"Microsoft.Windows.Common-Controls"</span> <br />&nbsp; &nbsp; &nbsp; &nbsp; version=<span style="color: #ff0000;">"6.0.0.0"</span> publicKeyToken=<span style="color: #ff0000;">"6595b64144ccf1df"</span> <br />&nbsp; &nbsp; &nbsp; &nbsp; type=<span style="color: #ff0000;">"win32"</span> processorArchitecture=<span style="color: #ff0000;">"*"</span> language=<span style="color: #ff0000;">"*"</span> /> <br />&nbsp; &nbsp; </dependentAssembly> <br />&nbsp; </dependency> <br />&nbsp; <application xmlns=<span style="color: #ff0000;">"urn:schemas-microsoft-com:asm.v3"</span>> <br />&nbsp; &nbsp; &nbsp;<windowsSettings> <dpiAware &nbsp; &nbsp; &nbsp;xmlns=<span style="color: #ff0000;">"http://schemas.microsoft.com/SMI/2005/WindowsSettings"</span>>true/PM</dpiAware> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </windowsSettings> <br />&nbsp; &nbsp; &nbsp;<windowsSettings> <dpiAwareness &nbsp;xmlns=<span style="color: #ff0000;">"http://schemas.microsoft.com/SMI/2016/WindowsSettings"</span>>PerMonitorV2,PerMonitor</dpiAwareness> </windowsSettings> <br />&nbsp; &nbsp; &nbsp;<windowsSettings> <longPathAware xmlns=<span style="color: #ff0000;">"http://schemas.microsoft.com/SMI/2016/WindowsSettings"</span>>true</longPathAware> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </windowsSettings> <br />&nbsp; &nbsp; &nbsp;<windowsSettings> <heapType &nbsp; &nbsp; &nbsp;xmlns=<span style="color: #ff0000;">"http://schemas.microsoft.com/SMI/2020/WindowsSettings"</span>>SegmentHeap</heapType> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </windowsSettings> <br />&nbsp; </application> <br />&nbsp; <trustInfo xmlns=<span style="color: #ff0000;">"urn:schemas-microsoft-com:asm.v3"</span>> <br />&nbsp; &nbsp; <security> <br />&nbsp; &nbsp; &nbsp; <requestedPrivileges> <br />&nbsp; &nbsp; &nbsp; &nbsp; <requestedExecutionLevel level=<span style="color: #ff0000;">"asInvoker"</span> uiAccess=<span style="color: #ff0000;">"false"</span> /> <br />&nbsp; &nbsp; &nbsp; </requestedPrivileges> <br />&nbsp; &nbsp; </security> <br />&nbsp; </trustInfo> <br />&nbsp; <compatibility xmlns=<span style="color: #ff0000;">"urn:schemas-microsoft-com:compatibility.v1"</span>> <br />&nbsp; &nbsp; <application> <br />&nbsp; &nbsp; &nbsp; <supportedOS <span style="color: #0000ff;">Id</span>=<span style="color: #ff0000;">"{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"</span> /> <br />&nbsp; &nbsp; &nbsp; <supportedOS <span style="color: #0000ff;">Id</span>=<span style="color: #ff0000;">"{1f676c76-80e1-4239-95bb-83d0f6d0da78}"</span> /> <br />&nbsp; &nbsp; &nbsp; <supportedOS <span style="color: #0000ff;">Id</span>=<span style="color: #ff0000;">"{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"</span> /> <br />&nbsp; &nbsp; &nbsp; <supportedOS <span style="color: #0000ff;">Id</span>=<span style="color: #ff0000;">"{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"</span> /> <br />&nbsp; &nbsp; &nbsp; <supportedOS <span style="color: #0000ff;">Id</span>=<span style="color: #ff0000;">"{e2011457-1546-43c5-a5fe-008deee3d3f0}"</span> /> <br />&nbsp; &nbsp; </application> <br />&nbsp; </compatibility> <br /></assembly><br />&nbsp;</div>[/code:1425r2sq] Gracias, thanks. Regards, saludos.
clausole When...Hide a size of Dialog - strange - RESOLVED
Dear Silvio, complete download using WINDOWS10.MANIFEST. Test please. Estimado Silvio, descarga completa usando WINDOWS10.MANIFEST. prueba por favor. Link: [url:15vnxsbv]https&#58;//mega&#46;nz/file/cMkFwAQa#km42FPaVgu3ko93BuYTsdX9aJFtxkyWVGPmsQ4aSd38[/url:15vnxsbv] Gracias, thanks. Regards, saludos.
clausula transparent urllink no funciona
Buenas tardes para todos Como dice el encabezado parece que la clausula TRANSPARENT del control urlink no funciona correctamente, lo tengo definido en un dialogo el cual tiene un brush, pero se ve blanco. [img:2wbk1omz]https&#58;//www&#46;hymplus&#46;com/forofw/URLINK&#46;png[/img:2wbk1omz] [code=fw:2wbk1omz]<div class="fw" id="{CB}" style="font-family: monospace;"><br />    <span style="color: #0000ff;">REDEFINE</span> URLLINK <span style="color: #0000ff;">ID</span> <span style="color: #000000;">104</span> URL <span style="color: #ff0000;">"https://hymplus.com/"</span> <span style="color: #0000ff;">OF</span> oDlg TOOLTIP <span style="color: #ff0000;">"Visita nuestro sitio web "</span> ;<br />            TRANSPARENT CLRINIT CLR_BLUE CLROVER CLR_MAGENTA        <br /> </div>[/code:2wbk1omz]
clausula transparent urllink no funciona
Leandro, desde la versión FWH17.01 que no funciona. Puede usar BRUSH. Mas no TRANSPARENT en el DIALOG. Saludos.
clear IMAGE
Hello, I want to set a button (ID 102) to clear the Image: [code=fw:18lgnizq]<div class="fw" id="{CB}" style="font-family: monospace;"> &nbsp; <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">IMAGE</span> &nbsp;oBmpFoto1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ID</span> <span style="color: #000000;">103</span> <span style="color: #0000ff;">OF</span> oFld:<span style="color: #000000;">aDialogs</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> <span style="color: #0000ff;">UPDATE</span> ;<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; FILENAME oData:<span style="color: #000000;">FOTO</span> &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; <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CLICK</span> <span style="color: #000000;">&#40;</span> oData:<span style="color: #000000;">FOTO</span> := _CargaFoto <span style="color: #000000;">&#40;</span>oBmpFoto1, oDlg<span style="color: #000000;">&#41;</span> &nbsp;<span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">ADJUST</span> <br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ID</span> <span style="color: #000000;">101</span> <span style="color: #0000ff;">OF</span> oFld:<span style="color: #000000;">aDialogs</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> ;<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; <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> oData:<span style="color: #000000;">FOTO</span> := _CargaFoto <span style="color: #000000;">&#40;</span>oBmpFoto1, oDlg<span style="color: #000000;">&#41;</span> &nbsp;<span style="color: #000000;">&#41;</span> <br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ID</span> <span style="color: #000000;">102</span> <span style="color: #0000ff;">OF</span> oFld:<span style="color: #000000;">aDialogs</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> ;<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; <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> oData:<span style="color: #000000;">FOTO</span> := <span style="color: #ff0000;">""</span>, alert<span style="color: #000000;">&#40;</span>odata:<span style="color: #000000;">foto</span><span style="color: #000000;">&#41;</span>, oBmpFoto1:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, oFld:<span style="color: #0000ff;">Update</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, oFld:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, oDlg:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> &nbsp;<span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:18lgnizq] But despite I set oData:Foto to "" and I call refresh and update, the previous picture is still there, I need to remove it. Maybe I miss something or it is a bug. Thank you.
clear IMAGE
I had the same problem in my imaging product. I got around it by creating a blank image "blank,jpg" and using it when there is no image wanted.
clear IMAGE
Lucas Here is a snipit of code I use for Images with some help and advice from our good friend Uwe. Have a look at how the image is defined with oImage and bPainted then deleted with the function DelImage() Rick Lipkin [code=fw:xscojx5j]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// images</span><br /><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">IMAGE</span> oImage <span style="color: #0000ff;">ID</span> <span style="color: #000000;">701</span> FILENAME <span style="color: #00C800;">NIL</span> <span style="color: #0000ff;">of</span> oUsers ;<br />         <span style="color: #0000ff;">PIXEL</span>  <span style="color: #0000ff;">ADJUST</span> BORDER<br /><br />     oImage:<span style="color: #000000;">bPainted</span> := <span style="color: #000000;">&#123;</span> |hDC| DRAW_IMG<span style="color: #000000;">&#40;</span> oImage, hDC, cImage, cPicFileName <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br /><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">GET</span> oGET <span style="color: #0000ff;">var</span> cImage <span style="color: #0000ff;">ID</span> <span style="color: #000000;">706</span> <span style="color: #0000ff;">of</span> oUsers <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"@!"</span> READONLY <span style="color: #B900B9;">// displays the filename only</span><br /><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BTNBMP</span> oButt4 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">702</span> <span style="color: #0000ff;">of</span> oUsers ;<br />         <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"ADD16"</span>,<span style="color: #ff0000;">"DADD16"</span>,<span style="color: #ff0000;">"DADD16"</span> ;<br />         <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Import    "</span> <span style="color: #0000ff;">LEFT</span> <span style="color: #000000;">2007</span>;<br />         <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> GetImage<span style="color: #000000;">&#40;</span> @oImage,oRsPet,oUsers,@cImage,oGet,@cPicFileName <span style="color: #000000;">&#41;</span>,;<br />                  _ChkButtons<span style="color: #000000;">&#40;</span> cMode,oRsPet,oButt4,oButt5,oButt6,oButt7<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BTNBMP</span> oButt5 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">703</span> <span style="color: #0000ff;">of</span> oUsers ;<br />         <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"EDIT16"</span>,<span style="color: #ff0000;">"DEDIT16"</span>,<span style="color: #ff0000;">"DEDIT16"</span> ;<br />         <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Export    "</span> <span style="color: #0000ff;">LEFT</span> <span style="color: #000000;">2007</span>;<br />         <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> ExportImage<span style="color: #000000;">&#40;</span> oRsPet,<span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BTNBMP</span> oButt6 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">704</span> <span style="color: #0000ff;">of</span> oUsers ;<br />         <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"DELETE16"</span>,<span style="color: #ff0000;">"DDELETE16"</span>, <span style="color: #ff0000;">"DDELETE16"</span> ;<br />         <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Delete    "</span> <span style="color: #0000ff;">LEFT</span> <span style="color: #000000;">2007</span>;<br />         <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> DelImage<span style="color: #000000;">&#40;</span>@oImage,oRsPet,oUsers,oGet,@cImage,@cPicFileName <span style="color: #000000;">&#41;</span>,;<br />                  _ChkButtons<span style="color: #000000;">&#40;</span> cMode,oRsPet,oButt4,oButt5,oButt6,oButt7<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BTNBMP</span> oButt7 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">705</span> <span style="color: #0000ff;">of</span> oUsers ;<br />         <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"VIEW16"</span>,<span style="color: #ff0000;">"DVIEW16"</span>,<span style="color: #ff0000;">"DVIEW16"</span> ;<br />         <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Print      "</span> <span style="color: #0000ff;">LEFT</span> <span style="color: #000000;">2007</span>;<br />         <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> PrintImage<span style="color: #000000;">&#40;</span> oRsPet,<span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #B900B9;">// end images</span><br /><br /><span style="color: #B900B9;">//------------- Image-Brush from Uwe ----------</span><br /><span style="color: #00C800;">Static</span> FUNC Draw_Img<span style="color: #000000;">&#40;</span> oImage, hDC, cImage, cPicFileName  <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">LOCAL</span> oBrush,cDefa<br /><span style="color: #00C800;">LOCAL</span> aRect := GETCLIENTRECT<span style="color: #000000;">&#40;</span> oImage:<span style="color: #000000;">hWnd</span> <span style="color: #000000;">&#41;</span><br /><br />cDefa  := set<span style="color: #000000;">&#40;</span><span style="color: #000000;">7</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">If</span> cPicFileName = <span style="color: #ff0000;">" "</span> <span style="color: #B900B9;">// ad mode because blank .. cImage passed as is</span><br /><span style="color: #00C800;">Else</span><br />   cImage := cDefa+<span style="color: #ff0000;">"<span style="color: #000000;">\P</span>ictures<span style="color: #000000;">\"</span>+alltrim( cImage )<br />Endif<br /><br />// added for on paint<br />SysReFresh()<br /><br />IF FILE( cImage )<br />    DEFINE IMAGE oBrush FILENAME cImage<br />    PalBmpDraw( hDC, 0, 0, oBrush:hBitmap, , aRect[4], aRect[3] )<br />    oBrush:End()<br />ENDIF<br /><br />RETURN( NIL )<br /><br />//----------------------------------------------------------------------------//<br />Static Func DelImage( oImage,oRsPet,oDlg,oGet,cImage,cPicFileName )<br /><br />LOCAL Saying,cFILE,cDefa<br /><br />cDefa := set(7)<br />cFile := oRsPet:Fields("</span>PicFileName<span style="color: #ff0000;">"):Value<br /><br />If cFile = "</span> <span style="color: #ff0000;">" .or. empty( cFile )<br />   Saying := "</span>Sorry .. there is no <span style="color: #0000ff;">Image</span> <span style="color: #0000ff;">to</span> Delete<span style="color: #ff0000;">"<br />   MsgInfo( Saying )<br />   Return(.f.)<br />Endif<br /><br />Saying := "</span>Are you SURE you want <span style="color: #0000ff;">to</span> Delete this <span style="color: #0000ff;">Image</span> ?<span style="color: #ff0000;">"+chr(10)<br />Saying += cFile<br /><br />If MsgNoYes( Saying )<br /><br />   Ferase(cDefa+"</span>\Pictures\<span style="color: #ff0000;">"+alltrim(cFile))<br />   cImage := "</span> <span style="color: #ff0000;">"<br />   oGet:Refresh()<br />   oImage:Refresh()<br />   oDlg:ReFresh()<br />   SysReFresh()<br /><br />   cPicFileName := space(50)<br />   oRsPet:Fields("</span>PicFileName<span style="color: #ff0000;">"):Value := cPicFileName<br />   oRsPet:Update()<br /><br />   SysReFresh()<br /><br />Endif<br /><br />Return(nil)<br /></span></div>[/code:xscojx5j]
clear IMAGE
Mr Lucas Let me try to make it simple for you. #1. If you want to change the image with a new image file : ACTION ( oData:foto := <newfilename>, oImage:LoadBmp( oData:foto ) ) #2. If you want to clear image ACTION ( oData:foto := "", ClearImage( oImage ) ) I shall give you a function to ClearImage [code=fw:2bdiwwdo]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">function</span> ClearImage<span style="color: #000000;">&#40;</span> oBmp <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;WITH OBJECT oBmp<br />&nbsp; &nbsp; &nbsp; PalBmpFree<span style="color: #000000;">&#40;</span> :<span style="color: #000000;">hBitmap</span>, :<span style="color: #000000;">hPalette</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">hBitmap</span> := :<span style="color: #000000;">hPalette</span> &nbsp;:= <span style="color: #000000;">0</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">cBmpFile</span> := :<span style="color: #000000;">cResName</span> := <span style="color: #00C800;">nil</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;END<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br />&nbsp;</div>[/code:2bdiwwdo] We try to provide an appropriate method in the class in the next version.
clear IMAGE
Lucas; Try this oBmpFoto1:LoadImage("nada")
clear IMAGE
[quote="elvira":1cy2g8c2]Lucas; Try this oBmpFoto1:LoadImage("nada")[/quote:1cy2g8c2] This also works. Giving a non-empty name, which is not an existing image file also works. This is a work around.
clear IMAGE
From FWH 13.07, we can use oImg:Clear()
clear SAY? how?
Hello, How I make to clean some SAYS in a DIALOG? I am making this: @ 10,20 SAY OSAY VAR ' MY TEXT ' OF ODLG UPDATE . . . ODLG:UPDATE() This command is cleaning the GETs but the SAYs is not cleaning. Many thanks
clear SAY? how?
[quote="syda":3g7p0eys]Hello, How I make to clean some SAYS in a DIALOG? I am making this: @ 10,20 SAY OSAY VAR ' MY TEXT ' OF ODLG UPDATE . . . ODLG:UPDATE() This command is cleaning the GETs but the SAYs is not cleaning. Many thanks[/quote:3g7p0eys] Yo lo hago de l siguiente manera: @ 10,20 oSay PROMPT "Mi texto" OF oDlg UPDATE sin problemas.
clear SAY? how?
@ 10,20 SAY oSay PROMPT "Mi texto" OF oDlg UPDATE oSay:SetText( "" )
clear tImage
Hi all !I created image oIm:=tImage():New()oIm:LoadBmp(cFile) I want delete BMP from oIm. How do it ?
clear tImage
Natter,if you want to change the image just load load a new oneoIM:SetBmp(cResName) or oIM:ReLoad( cResName, cBmpFile )if you want to delete the bmp you can destroy the object, just write oIM := nil or you try to load an unexisting image (not tested)
clear tImage
... delete the bmp you can destroy the object, just write oIM := nil or you try to load an unexisting image (not tested)"I do it. It's not work
clear tImage
try this:oIm:hbitmap := 0oIm:Refresh()Ralph
clear tImage
It's not work
clear tImage
[quote="Natter":4786jswb]It's not work[/quote:4786jswb]May be:[code:4786jswb]PalBmpFree&#40; oIm&#58;hBitMap, oIm&#58;hPalette &#41;[/code:4786jswb]Regards.Manuel Mercado.
clear tImage
This is a sample:[code:3elmakxn]#include "Fivewin&#46;ch" FUNCTION MAIN&#40;&#41; LOCAL oDlg, oImg DEFINE DIALOG oDlg; SIZE 700, 500 @ 1, 1 IMAGE oImg; FILE "SFONDO&#46;JPG"; SIZE 200, 200; ADJUST @ 0, 1 BUTTON "Save"; ACTION MSGINFO&#40; oImg&#58;SaveImage&#40; "SAVED&#46;JPG", 2 &#41; &#41; @ 0, 7 BUTTON "Print"; ACTION PRINT&#40; oImg &#41; @ 0, 13 BUTTON "Paste"; ACTION &#40; oImg&#58;LoadFromClipboard&#40;&#41;,; oImg&#58;Refresh&#40;&#41; &#41; @ 0, 19 BUTTON "Load"; ACTION &#40; oImg&#58;LoadImage&#40; , "GRIGIO&#46;JPG" &#41;,; oImg&#58;Refresh&#40;&#41; &#41; @ 0, 25 BUTTON "Clear"; ACTION &#40; PalBmpFree&#40; oImg&#58;hBitMap, oImg&#58;hPalette &#41;,; oImg&#58;hBitmap &#58;= 0,; oImg&#58;hPalette &#58;= 0,; oImg&#58;cResName &#58;= NIL,; oImg&#58;cBmpFile &#58;= NIL,; oImg&#58;Refresh&#40;&#41; &#41; ACTIVATE DIALOG oDlg; CENTER RETURN NIL STATIC FUNCTION PRINT&#40; oImg &#41; LOCAL oPrn PRINT oPrn PREVIEW MODAL PAGE oPrn&#58;SayImage&#40; 0, 0, oImg, oPrn&#58;nHorzRes&#40;&#41;, oPrn&#58;nVertRes&#40;&#41; &#41; ENDPAGE ENDPRINT RETURN NIL[/code:3elmakxn]EMG
clear tImage
It looks like the TImage class needs an End() method.James
clear tImage
[quote="James Bott":3a94xwjj]It looks like the TImage class needs an End() method.[/quote:3a94xwjj]Hi James:It has. TImage is a TBitmap subclass, then inherits Destroy Method.Best regards.Manuel Mercado
clear tImage
Thank everybody !@ 0, 25 BUTTON "Clear"; ACTION oImg:hBitmap := 0, ; oImg:cBmpFile := NIL,; oImg:Refresh() ) It work right !
clear tImage
[quote:2ztgfdbs]It has. TImage is a TBitmap subclass, then inherits Destroy Method. [/quote:2ztgfdbs]It is not clear if we should call the Destroy() method or the End() method. I see that TBitmap inherits from TControl which inherits from TWindow, yet I do not see the Destroy() method being called by any of those classes' End() method.To be consistant with all the other classes, the End() method should be the one that ends the object.James
clear tImage
Natter,Try calling oImg:End() or oImg:Destroy() to see if one of those also works.James
clear tImage
1) calling oImg:End() - this method deleted control2) calling oImg:Destroy() - this method not work right.
clear tImage
[quote="Natter":1utfjt0o]Thank everybody ! @ 0, 25 BUTTON "Clear"; ACTION oImg:hBitmap := 0, ; oImg:cBmpFile := NIL,; oImg:Refresh() ) It work right ![/quote:1utfjt0o]It's not enough. Please use what I put in my sample if you don't want to have resource leak.EMG
clear the Clipboard
How to clear the Clipboard ( "Clipboard") of winxp, I am using __KEYBOARD (CHR (300)), to copy the screen, but when the Clipboard has no more space, the __KEYBOARD (CHR (300)) to working.
clear the Clipboard
Please review fwh\samples\TestClip.prg
clear the Clipboard
Antonio, if I open the area of transfer after using oClp:Clear(), this clean, but after a while the app not save the screen, this message: [b:3arpaf7e]Shut one or more application to free up more memory and try again.[/b:3arpaf7e]But if you leave the app, and return back to work.[code:3arpaf7e] DEFINE ICON oIcon FILE "IMG&#46;ICO" DEFINE WINDOW oApp ICON oIcon DEFINE CLIPBOARD oClp OF oApp DEFINE TIMER oTmrIdx INTERVAL 10000 ACTION &#40; waitIdx&#40; oTmrIdx,oTray,oIcon,oClp&#41; &#41; OF oApp ACTIVATE TIMER oTmrIdx ACTIVATE WINDOW oApp ; ON INIT oTray &#58;= TTrayIcon&#40;&#41;&#58;New&#40;oApp,oIcon,"",&#123;|nRow,nCol|MenuTray&#40;nRow,nCol,oTray,oIcon&#41;&#125;,&#123;|nRow,nCol|MenuTray&#40;nRow,nCol,oTray,oIcon&#41;&#125;&#41; ; VALID oTray&#58;End&#40;&#41; ; ON RIGHT CLICK oTray&#58;SetIcon&#40; oIcon, "Another" &#41; RETURN NIL FUNCTION WaitIdx&#40; oTmrIdx,oTray,oIcon,oClp&#41; local lFileExists &#58;= &#46;f&#46;, cDir &#58;= CurDrive&#40;&#41;+"&#58;\"+GetCurDir&#40;&#41;+'\' LOCAL Dir, vArq, vNum, nBytes oTmrIdx&#58;Deactivate&#40;&#41; __KEYBOARD&#40;CHR&#40;300&#41;&#41; SalvaTela&#40;"Tela",oIcon&#41; syswait&#40;1&#41; oClp&#58;Clear&#40;&#41; Release All RESALLFREE&#40;&#41; SYSREFRESH&#40;&#41; CLEAR MEMORY oTmrIdx&#58;Activate&#40;&#41; [/code:3arpaf7e][/b]
clear the Clipboard
Whats the source code for SalvaTela() ?
clear the Clipboard
[code:1kbx2yj2]static function SalvaTela&#40;cFileName,oIcon&#41; **************************************** LOCAL oTClip, hBitmap, fBit, Result &#58;= &#46;f&#46; LOCAL oBmpImage Default cFileName &#58;= "Tela&#46;JPG" cFileName &#58;= AllTrim&#40;cFileName&#41; if AT&#40;'&#46;jpg',lower&#40;cFilename&#41;&#41; == 0 cFileName += '&#46;JPG' end if file&#40;"Tela&#46;BMP"&#41; FERASE&#40;"Tela&#46;BMP"&#41; end oTClip &#58;= TClipBoard&#40;&#41;&#58;New&#40;&#41; //New&#40;WndMain&#40;&#41;&#41; syswait&#40;&#46;1&#41; hBitmap &#58;= oTClip&#58;GetBitMap&#40;&#41; syswait&#40;&#46;3&#41; oTClip&#58;Close&#40;&#41; oTClip&#58;End&#40;&#41; Result &#58;= &#40;hBitmap != 0&#41; if Result fBit&#58;=dibfrombitmap&#40;hBitmap&#41; SysWait&#40;&#46;1&#41; dibwrite&#40;"Tela&#46;BMP",fBit&#41; FISaveImg&#40; "Tela&#46;BMP", "Tela&#46;JPG", 2, 70 &#41; Ferase&#40;"Tela&#46;BMP"&#41; Result &#58;= File&#40;"Tela&#46;JPG"&#41; else ?"error&#58; not save" end Return Result [/code:1kbx2yj2]
clear the Clipboard
You have to release the bitmap and the dib, thats why you are consuming your sistem memory![code:3t0qkyxw] if Result fBit&#58;=dibfrombitmap&#40;hBitmap&#41; DeleteObject&#40; hBitmap &#41; SysWait&#40;&#46;1&#41; dibwrite&#40;"Tela&#46;BMP",fBit&#41; GlobalFree&#40; fBit &#41; FISaveImg&#40; "Tela&#46;BMP", "Tela&#46;JPG", 2, 70 &#41; Ferase&#40;"Tela&#46;BMP"&#41; Result &#58;= File&#40;"Tela&#46;JPG"&#41; else ?"error&#58; not save" end [/code:3t0qkyxw]
clear the Clipboard
Olá Antonio,No exemplo abaixo quando clico em "Salvar" a função "FISaveImg" sempre me retorna falso e o arquivo "TELA.JPG" é gerado com tamanho 0, porque ?[code:26m99243] #include "fivewin&#46;ch" ************* function Main ************* local oDlg, oIco, cTest &#58;= "Hello world! ", oClp DEFINE ICON oIco FILE "\fwh\icons\fivewin&#46;ico" DEFINE DIALOG oDlg TITLE "I am a DialogBox" COLOR "W+/B" ; ICON oIco @ 1, 3 GET cTest @ 3, 5 BUTTON "&Salvar" SIZE 40, 12 ; ACTION SALVA&#40; oDlg, oClp &#41; DEFAULT @ 3, 16 BUTTON "&Cancel" SIZE 40, 12 ACTION oDlg&#58;End&#40;&#41; DEFINE CLIPBOARD oClp OF oDlg ACTIVATE DIALOG oDlg CENTERED ; VALID MsgYesNo&#40; "Do you want to end ?" &#41; oCLp&#58;end&#40;&#41; return NIL ************** function SALVA&#40; oDlg, oClp &#41; ************** __KEYBOARD&#40;CHR&#40;300&#41;&#41; SalvaTela&#40; "Tela" &#41; syswait&#40;1&#41; oClp&#58;Clear&#40;&#41; * Release All * RESALLFREE&#40;&#41; SYSREFRESH&#40;&#41; * CLEAR MEMORY return NIL ************************* static function SalvaTela&#40; cFileName &#41; ************************* LOCAL oTClip, hBitmap, fBit, Result &#58;= &#46;f&#46; LOCAL oBmpImage Default cFileName &#58;= "Tela&#46;JPG" cFileName &#58;= AllTrim&#40;cFileName&#41; if AT&#40;'&#46;jpg',lower&#40;cFilename&#41;&#41; == 0 cFileName += '&#46;JPG' end if file&#40;"Tela&#46;BMP"&#41; FERASE&#40;"Tela&#46;BMP"&#41; end oTClip &#58;= TClipBoard&#40;&#41;&#58;New&#40;&#41; //New&#40;WndMain&#40;&#41;&#41; syswait&#40;&#46;1&#41; hBitmap &#58;= oTClip&#58;GetBitMap&#40;&#41; syswait&#40;&#46;3&#41; oTClip&#58;Close&#40;&#41; oTClip&#58;End&#40;&#41; Result &#58;= &#40;hBitmap != 0&#41; if Result fBit &#58;= dibfrombitmap&#40; hBitmap &#41; SysWait&#40;&#46;1&#41; dibwrite&#40; "Tela&#46;BMP", fBit &#41; GlobalFree&#40; fBit &#41; DeleteObject&#40; hBitmap &#41; msgstop&#40; FISaveImg&#40; "Tela&#46;BMP", "Tela&#46;JPG", 2, 70 &#41; &#41; Ferase&#40;"Tela&#46;BMP"&#41; Result &#58;= File&#40;"Tela&#46;JPG"&#41; else ?"error&#58; not save" end Return Result static function FISAVEIMG&#40; cSrcFile, cDstFile, nDstFormat, nQuality &#41; local nSrcFormat, hDib, hDib2, lOk DEFAULT nQuality &#58;= 0 hLib = LoadLibrary&#40; "freeimage&#46;dll" &#41; nSrcFormat = FIGETFILETYPE&#40; cSrcFile, 0 &#41; hDib = FILOAD&#40; nSrcFormat, cSrcFile, 0 &#41; hDib2 = FICNV24&#40; hDib &#41; lOk = FISAVE&#40; nDstFormat, hDib2, cDstFile, nQuality &#41; FIUNLOAD&#40; hDib &#41; FIUNLOAD&#40; hDib2 &#41; FreeLibrary&#40; hLib &#41; return lOk //----------------------------------------------------------------------------// DLL32 FUNCTION FIGETFILETYPE&#40; cFileName AS LPSTR, nSize AS LONG &#41; AS LONG ; PASCAL FROM "_FreeImage_GetFileType@8" LIB hLib DLL32 FUNCTION FILOAD&#40; nFormat AS LONG, cFileName AS LPSTR, nFlags AS LONG &#41; AS LONG ; PASCAL FROM "_FreeImage_Load@12" LIB hLib DLL32 FUNCTION FISAVE&#40; nFormat AS LONG, hDib AS LONG, cFileName AS LPSTR, nFlags AS LONG &#41; AS BOOL ; PASCAL FROM "_FreeImage_Save@16" LIB hLib DLL32 FUNCTION FIUNLOAD&#40; hDib AS LONG &#41; AS VOID ; PASCAL FROM "_FreeImage_Unload@4" LIB hLib DLL32 FUNCTION FICNV24&#40; hDib AS LONG &#41; AS LONG ; PASCAL FROM "_FreeImage_ConvertTo24Bits@4" LIB hLib //----------------------------------------------------------------------------// [/code:26m99243]
clear the Clipboard
Rossine,Has comprobado que Tela.bmp esté correcto ?
clear the Clipboard
Antonio,É gerado o arquivo TELA.BMP no tamanho de 1.920.054, mas não consigo abrí-lo com o ms-paint (paint). O paint me retorna a seguinte mensagem:"O Paint não pode ler este arquivo. Este não é um arquivo de bitmap válido ou não há suporte para o formato atualmente."Saludos,Rossine.
clear the Clipboard
Rossine,has comprobado que despues de hacer:__KEYBOARD(CHR(300))haya una copia correcta de la imagen en el clipboard ?Por lo que comentas parece que el bitmap esta corrupto...
clear the Clipboard
Antonio,[quote:1e8ljld8] has comprobado que despues de hacer: __KEYBOARD(CHR(300)) haya una copia correcta de la imagen en el clipboard ? [/quote:1e8ljld8]Sim, após: __KEYBOARD(CHR(300)) ... executei o "PAINT" e colei a imagem que estava no clipboard.Este exemplo roda bem aí com você ?Saludos,
clear the Clipboard
[quote="Rossine":231vord4]Antonio, [quote:231vord4] has comprobado que despues de hacer: __KEYBOARD(CHR(300)) haya una copia correcta de la imagen en el clipboard ? [/quote:231vord4][/quote:231vord4]Sim, após: __KEYBOARD(CHR(300)) ... executei o "PAINT" e colei a imagem que estava no clipboard.Baixe o arquivo TELA.BMP aqui: [url:231vord4]http&#58;//geocities&#46;yahoo&#46;com&#46;br/qiinformatica2000/TELA&#46;ZIP[/url:231vord4]Este exemplo roda bem aí com você ?Saludos,
clear the Clipboard
Antonio,[quote:e3npfpn8] has comprobado que despues de hacer: __KEYBOARD(CHR(300)) haya una copia correcta de la imagen en el clipboard ? [/quote:e3npfpn8]Sim, após: __KEYBOARD(CHR(300)) ... executei o "PAINT" e colei a imagem que estava no clipboard normalmente.Baixe o arquivo TELA.BMP aqui: [url:e3npfpn8]http&#58;//geocities&#46;yahoo&#46;com&#46;br/qiinformatica2000/TELA&#46;ZIP[/url:e3npfpn8]Este exemplo roda bem aí com você ?Saludos,
clear the Clipboard
Olá,É possível fazer isto funcionar ? <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( --> Gracias,Rossine.
clearing of archives
In a conversion procedure I have to clear all the archives and then populate them during the conversion. The archives were all opened with Tdatabase and therefore in share Archives are indexed with the! Deleted () clause I don't know how to do the zeroing of archives and the dbpack since it cannot be done in Tdatabase I don't know if it is better to delete all the archives and create them again or there is another solution
clearing of archives
Are the new archives also changed in structures ? ntx to cdx ? or also the same ?
clearing of archives
The application that I am putting in place serves to make the substitutions of teachers every morning, I am changing it because we have decided to transform it into a network with user management. Initially to use the procedure it was necessary to insert the data in all the archives (teachers, classes, classrooms, lessons etc.), to avoid entering everything from scratch because it is unnerving, I created a conversion procedure from an Excel archive that is generally used in all schools that automatically and in a short time extracts the data and puts them in the archives. Then I proceed to convert from Excel to an import.dbf (oImport) archive Then from this oImport archive I have to populate a series of archives (classes, classrooms, teachers, timetables, lessons, subjects, groups) through a procedure created by me, but the archives must be empty., And then the indexes must be recreated. Probably this operation must be done by only one and not the shares, so before loading the conversion procedure I have to check if the users have logged out of the system. and only then can I call up the procedure and open the archives exclusively. how should i check if a user is inside the system? I have to check the user archive and the TAbations archive to see if there is a user who has entered the system If there is someone I send a message "You must exit the system" through a procedure of messages between users of the same program and then I have to proceed and then I can use the archives in exclusive mode and use pack and zap. Are there any other solutions?
clearing of archives
I would concider Make a conversion folder (for putting temporary dbf) from the program folder copy the needed dbf's with the copy structure command to conversion folder (dbf's will be empty but have all fields) fill the dbf in the conversion folder and generate the index file's see if you have all users logged out and copy the files back to program folder. This process will be quick This process could also be done timed ex. at 04.00 am so there is no one on the system. The same can also be done in the program directory but there you can use the ZAP command or function.
clearing of archives
hi, i do create DBF / Index if not exist ... you can open a DBF EXCLUSIVE when NO User is Connect ... than you can Ferase() it to find out "who" is Connect to DBF is another Question
clearing of archives
[quote:cv61jrjz]I don't know how to do the zeroing of archives and the dbpack since it cannot be done in Tdatabase [/quote:cv61jrjz] if the table is open exclusively, oDbf:Zap() oDbf:Pack()
click a area of Tpanel control ( Creating a Piano)
I'm trying to create a small piano and I have this ( made with Tpanel control ) [img:20zontc1]http&#58;//www&#46;eoeo&#46;it/wp-content/uploads/2014/12/key&#46;jpg[/img:20zontc1] the problem... when I click the first tPanel white ( first white key) control it sound the note C when I click the first tPanel black ( first black key) control it sound the same the note C because this black control is over the first tpanel white the problem is when I click the first black key I click the white first key and not the black key ... I hope you understood How I can reslve it ?
click a area of Tpanel control ( Creating a Piano)
Silvio, You could check when the mouse is over the black key and disable the white ones
click a area of Tpanel control ( Creating a Piano)
where i can see a sample for make it ?
click a area of Tpanel control ( Creating a Piano)
Silvio, Try this: oBlackPanel:bMMoved = { | nRow, nCol | oWhitePanel:Disable() } If that works, next we will see how to enable an array of oWhitePanels again
click a area of Tpanel control ( Creating a Piano)
no ..not work good... this sample : [code=fw:ajdgk2r0]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"constant.ch"</span><br /><br />REQUEST HB_GT_GUI_DEFAULT<br /><br /><span style="color: #00C800;">function</span> Test<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">Local</span> oDlgPiano<br /><span style="color: #00C800;">Local</span> nBottom &nbsp; := <span style="color: #000000;">20</span><br /><span style="color: #00C800;">Local</span> nRight &nbsp; &nbsp;:= <span style="color: #000000;">55</span><br /><span style="color: #00C800;">Local</span> nWidth := &nbsp;<span style="color: #0000ff;">Max</span><span style="color: #000000;">&#40;</span> nRight * DLG_CHARPIX_W, <span style="color: #000000;">180</span> <span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">Local</span> nHeight := nBottom * DLG_CHARPIX_H<br /><span style="color: #00C800;">Local</span> oBianco,oNero<br /><span style="color: #00C800;">Local</span> oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">7</span><span style="color: #000000;">&#93;</span><br /><span style="color: #00C800;">Local</span> oBtnNero<span style="color: #000000;">&#91;</span><span style="color: #000000;">5</span><span style="color: #000000;">&#93;</span><br /><span style="color: #00C800;">Local</span> oCursorBtn :=TCursor<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;">'HAND'</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">Local</span> mTime:= <span style="color: #000000;">23</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BRUSH</span> oBianco <span style="color: #0000ff;">COLOR</span> CLR_WHITE<br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BRUSH</span> oNero <span style="color: #0000ff;">COLOR</span> CLR_BLACK<br /><br /><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlgPiano &nbsp; ;<br />&nbsp; &nbsp;<span style="color: #0000ff;">TITLE</span> i18n<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Virtual Piano"</span><span style="color: #000000;">&#41;</span> &nbsp; &nbsp;;<br />&nbsp; &nbsp;<span style="color: #0000ff;">SIZE</span> nWidth, nHeight &nbsp; <span style="color: #0000ff;">PIXEL</span><br /><br /><br /><br /><br />&nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">//tasti bianchi</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp;nRowTastoBianco:=<span style="color: #000000;">10</span><br />&nbsp; &nbsp; &nbsp; &nbsp;nHeightTastoBianco:=<span style="color: #000000;">100</span><br />&nbsp; &nbsp; &nbsp; &nbsp;ncolTastoBianco:= <span style="color: #000000;">2</span><br />&nbsp; &nbsp; &nbsp; &nbsp;nwidthTastoBianco:= <span style="color: #000000;">20</span><br /><br />&nbsp;oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:=Tpanel<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span>nRowTastoBianco,ncolTastoBianco,nHeightTastoBianco,nwidthTastoBianco,oDlgPiano<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">oBrush</span>:= oBianco<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">bLClicked</span> &nbsp;:= <span style="color: #000000;">&#123;</span> | x, y, z | Note<span style="color: #000000;">&#40;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">oCursor</span>:=oCursorBtn<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">bMMoved</span> = <span style="color: #000000;">&#123;</span> | nRow, nCol | oBtnNero<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">Disable</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ncolTastoBianco:=oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">nRight</span><span style="color: #000000;">+2</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nwidthTastoBianco+= <span style="color: #000000;">20</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>:=Tpanel<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span>nRowTastoBianco,ncolTastoBianco,nHeightTastoBianco,nwidthTastoBianco,oDlgPiano<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">oBrush</span>:= oBianco<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">bLClicked</span> &nbsp;:= <span style="color: #000000;">&#123;</span> | x, y, z | Note<span style="color: #000000;">&#40;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">oCursor</span>:=oCursorBtn<br /><br />&nbsp;nRowTastoNero:=<span style="color: #000000;">10</span><br />&nbsp; &nbsp; &nbsp; &nbsp;nHeightTastoNero:=<span style="color: #000000;">60</span><br />&nbsp; &nbsp; &nbsp; &nbsp;ncolTastoNero:= <span style="color: #000000;">15</span><br />&nbsp; &nbsp; &nbsp; &nbsp;nwidthTastoNero:= <span style="color: #000000;">25</span><br /><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnNero<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:=Tpanel<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span>nRowTastoNero,ncolTastoNero,nHeightTastoNero,nwidthTastoNero,oDlgPiano<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnNero<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">bLClicked</span> &nbsp;:= <span style="color: #000000;">&#123;</span> | x, y, z | Note<span style="color: #000000;">&#40;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnNero<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">oCursor</span>:=oCursorBtn<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnNero<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">bMMoved</span> = <span style="color: #000000;">&#123;</span> | nRow, nCol | oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">Disable</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">Disable</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">for</span> k= <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> <span style="color: #000000;">1</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oBtnNero<span style="color: #000000;">&#91;</span>k<span style="color: #000000;">&#93;</span>:<span style="color: #000000;">oBrush</span>:= oNero<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">next</span><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlgPiano<br />&nbsp; &nbsp;RETUR <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">Function</span> note<span style="color: #000000;">&#40;</span>mchoice<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">Local</span> mtone<br />&nbsp; &nbsp;<span style="color: #00C800;">Local</span> mTime:= <span style="color: #000000;">23</span><br />&nbsp; &nbsp;<span style="color: #00C800;">Do</span> <span style="color: #00C800;">case</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">1</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">130.8</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">2</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">138.6</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">3</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">146.8</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">4</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">155.6</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">5</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">164.8</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">6</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">174.6</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">7</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">185</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">8</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">196</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">9</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">207.7</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">10</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">220</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">11</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">233.1</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">12</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">246.9</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">Endcase</span><br /><br /><br />&nbsp; &nbsp; &nbsp; tone<span style="color: #000000;">&#40;</span>mtone,mTime<span style="color: #000000;">&#41;</span><br /><br /><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br />&nbsp;</div>[/code:ajdgk2r0]
click a area of Tpanel control ( Creating a Piano)
Silvio No entiendo lo que quieres decir Esto funciona bien para mi I do not understand what you mean This works fine for me [code=fw:1aie8qvs]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"constant.ch"</span><br /><br />REQUEST HB_GT_GUI_DEFAULT<br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> &nbsp;<span style="color: #B900B9;">//Test()</span><br /><span style="color: #00C800;">Local</span> oDlgPiano<br /><span style="color: #00C800;">Local</span> nBottom &nbsp; := <span style="color: #000000;">40</span> <span style="color: #B900B9;">//20</span><br /><span style="color: #00C800;">Local</span> nRight &nbsp; &nbsp;:= <span style="color: #000000;">75</span> <span style="color: #B900B9;">//55</span><br /><span style="color: #00C800;">Local</span> nWidth := &nbsp;<span style="color: #0000ff;">Max</span><span style="color: #000000;">&#40;</span> nRight * DLG_CHARPIX_W, <span style="color: #000000;">180</span> <span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">Local</span> nHeight := nBottom * DLG_CHARPIX_H<br /><span style="color: #00C800;">Local</span> oBianco,oNero<br /><span style="color: #00C800;">Local</span> oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">7</span><span style="color: #000000;">&#93;</span><br /><span style="color: #00C800;">Local</span> oBtnNero<span style="color: #000000;">&#91;</span><span style="color: #000000;">5</span><span style="color: #000000;">&#93;</span><br /><span style="color: #00C800;">Local</span> oCursorBtn :=TCursor<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;">'HAND'</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">Local</span> &nbsp; &nbsp; &nbsp; nRowTastoBianco:=<span style="color: #000000;">10</span><br /><span style="color: #00C800;">Local</span> &nbsp; &nbsp; &nbsp; nHeightTastoBianco:=<span style="color: #000000;">100</span><br /><span style="color: #00C800;">Local</span> &nbsp; &nbsp; &nbsp; ncolTastoBianco:= <span style="color: #000000;">2</span><br /><span style="color: #00C800;">Local</span> &nbsp; &nbsp; &nbsp; nwidthTastoBianco:= <span style="color: #000000;">20</span><br /><span style="color: #00C800;">Local</span> &nbsp; k<br /><span style="color: #00C800;">Local</span> &nbsp; &nbsp; &nbsp; nHeightTastoNero:=<span style="color: #000000;">60</span><br /><span style="color: #00C800;">Local</span> &nbsp; &nbsp; &nbsp; ncolTastoNero:= <span style="color: #000000;">15</span><br /><span style="color: #00C800;">Local</span> &nbsp; &nbsp; &nbsp; nwidthTastoNero:= <span style="color: #000000;">25</span><br /><span style="color: #00C800;">Local</span> &nbsp; &nbsp; &nbsp; nrowTastoNero<br /><br /><br /><span style="color: #00C800;">Local</span> mTime:= <span style="color: #000000;">23</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BRUSH</span> oBianco <span style="color: #0000ff;">COLOR</span> CLR_WHITE<br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BRUSH</span> oNero <span style="color: #0000ff;">COLOR</span> CLR_BLACK<br /><br /><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlgPiano &nbsp; ;<br />&nbsp; &nbsp;<span style="color: #0000ff;">TITLE</span> i18n<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Virtual Piano"</span><span style="color: #000000;">&#41;</span> &nbsp; &nbsp;;<br />&nbsp; &nbsp;<span style="color: #0000ff;">SIZE</span> nWidth, nHeight &nbsp; <span style="color: #0000ff;">PIXEL</span><br /><br /><br /><br /><br />&nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">//tasti bianchi</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp;nRowTastoBianco:=<span style="color: #000000;">10</span><br />&nbsp; &nbsp; &nbsp; &nbsp;nHeightTastoBianco:=<span style="color: #000000;">100</span><br />&nbsp; &nbsp; &nbsp; &nbsp;ncolTastoBianco:= <span style="color: #000000;">2</span><br />&nbsp; &nbsp; &nbsp; &nbsp;nwidthTastoBianco:= <span style="color: #000000;">20</span><br /><br />&nbsp;oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:=Tpanel<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span>nRowTastoBianco,ncolTastoBianco,nHeightTastoBianco,nwidthTastoBianco,oDlgPiano<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">oBrush</span>:= oBianco<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">bLClicked</span> &nbsp;:= <span style="color: #000000;">&#123;</span> | x, y, z | Note<span style="color: #000000;">&#40;</span>x,y,z,<span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">//oBtnBianco[1]:oCursor:=oCursorBtn</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">//oBtnBianco[1]:bMMoved = { | nRow, nCol | oBtnNero[1]:Disable() }</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ncolTastoBianco:=oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">nRight</span><span style="color: #000000;">+2</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nwidthTastoBianco+= <span style="color: #000000;">20</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>:=Tpanel<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span>nRowTastoBianco,ncolTastoBianco,nHeightTastoBianco,nwidthTastoBianco,oDlgPiano<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">oBrush</span>:= oBianco<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnBianco<span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">bLClicked</span> &nbsp;:= <span style="color: #000000;">&#123;</span> | x, y, z | Note<span style="color: #000000;">&#40;</span>x,y,z,<span style="color: #000000;">3</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">//oBtnBianco[2]:oCursor:=oCursorBtn</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp;nRowTastoNero:=<span style="color: #000000;">10</span><br />&nbsp; &nbsp; &nbsp; &nbsp;nHeightTastoNero:=<span style="color: #000000;">60</span><br />&nbsp; &nbsp; &nbsp; &nbsp;ncolTastoNero:= <span style="color: #000000;">15</span><br />&nbsp; &nbsp; &nbsp; &nbsp;nwidthTastoNero:= <span style="color: #000000;">25</span><br /><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnNero<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:=Tpanel<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span>nRowTastoNero,ncolTastoNero,nHeightTastoNero,nwidthTastoNero,oDlgPiano<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBtnNero<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">bLClicked</span> &nbsp;:= <span style="color: #000000;">&#123;</span> | x, y, z | Note<span style="color: #000000;">&#40;</span>x,y,z,<span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">//oBtnNero[1]:oCursor:=oCursorBtn</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">//oBtnNero[1]:bMMoved = { | nRow, nCol | oBtnBianco[1]:Disable(),oBtnBianco[2]:Disable() }</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">for</span> k= <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> <span style="color: #000000;">1</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oBtnNero<span style="color: #000000;">&#91;</span>k<span style="color: #000000;">&#93;</span>:<span style="color: #000000;">oBrush</span>:= oNero<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">next</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlgPiano<br />&nbsp; &nbsp;RETUR <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">Function</span> note<span style="color: #000000;">&#40;</span>x,y,z,mchoice<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">Local</span> mtone<br />&nbsp; &nbsp;<span style="color: #00C800;">Local</span> mTime:= <span style="color: #000000;">0.23</span><br />&nbsp; &nbsp;<span style="color: #00C800;">Do</span> <span style="color: #00C800;">case</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">1</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">130.8</span><br />&nbsp; &nbsp; &nbsp; ? <span style="color: #000000;">1</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">2</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">138.6</span><br />&nbsp; &nbsp; &nbsp; ? <span style="color: #000000;">2</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">3</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">146.8</span><br />&nbsp; &nbsp; &nbsp; ? <span style="color: #000000;">3</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">4</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">155.6</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">5</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">164.8</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">6</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">174.6</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">7</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">185</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">8</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">196</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">9</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">207.7</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">10</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">220</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">11</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">233.1</span><br />&nbsp; &nbsp; <span style="color: #00C800;">CASE</span> mchoice = <span style="color: #000000;">12</span><br />&nbsp; &nbsp; &nbsp; mtone = <span style="color: #000000;">246.9</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">Endcase</span><br /><br /><br />&nbsp; &nbsp; &nbsp; tone<span style="color: #000000;">&#40;</span>mtone, mTime<span style="color: #000000;">&#41;</span><br /><br /><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br />&nbsp;<br />&nbsp;</div>[/code:1aie8qvs]
click a area of Tpanel control ( Creating a Piano)
Dear cNavarro, If you press the first white panel it play the note C and the msginfo is 1 If you press the black panel on area is on first white panel it play the note C and the msginfo is 1 but it is wrong because it must play c# and the msginfo must be = 2 If you press the black panel on area is on second white panel it play the note D and the msginfo is 3 but it is wrong because it must play c# and the msginfo must be = 2 Dear Antonio, I saw there is a function [b:7996ifas]PtInRect( )[/b:7996ifas] , it could be usefull to click on right coordinates ... can you make a sample or where I can see a small sample with this function ?
click a area of Tpanel control ( Creating a Piano)
Silvio, In FWH\source\classes\vistamnu.prg there is an example of use
click a area of Tpanel control ( Creating a Piano)
Silvio Please try this Piano.Prg [code=fw:zjibu3rx]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">/*<br />*<br />* &nbsp;Piano.prg<br />* &nbsp;G.N.Rao<br />*<br />*/</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fiveWin.Ch"</span><br /><br /><span style="color: #00C800;">Static</span> aTone &nbsp; := <span style="color: #000000;">&#123;</span> <span style="color: #000000;">130.8</span>, <span style="color: #000000;">138.6</span>, <span style="color: #000000;">146.8</span>, <span style="color: #000000;">155.6</span>, <span style="color: #000000;">164.8</span>, <span style="color: #000000;">174.6</span>, <span style="color: #000000;">185</span>, <span style="color: #000000;">196</span>, <span style="color: #000000;">207.7</span>, <span style="color: #000000;">220</span>, <span style="color: #000000;">233.1</span>, <span style="color: #000000;">246.9</span> <span style="color: #000000;">&#125;</span><br /><span style="color: #00C800;">static</span> aWhite, aBlack<br /><br /><span style="color: #B900B9;">// Configuration Parameters</span><br /><span style="color: #00C800;">static</span> aDlgMargin := <span style="color: #000000;">&#123;</span> <span style="color: #000000;">20</span>, <span style="color: #000000;">20</span>, <span style="color: #000000;">20</span>, <span style="color: #000000;">20</span> <span style="color: #000000;">&#125;</span> &nbsp;<span style="color: #B900B9;">// top, left, bottom, right</span><br /><span style="color: #00C800;">static</span> nHtWhite &nbsp; := <span style="color: #000000;">200</span><br /><span style="color: #00C800;">static</span> nWdWhite &nbsp; := <span style="color: #000000;">40</span><br /><span style="color: #00C800;">static</span> nHtBlack &nbsp; := <span style="color: #000000;">120</span><br /><span style="color: #00C800;">static</span> nWdBlack &nbsp; := <span style="color: #000000;">20</span><br /><span style="color: #00C800;">static</span> nDuration &nbsp;:= <span style="color: #000000;">23</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> oDlg<br /><br />&nbsp; &nbsp;PrepareKeys<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;">SIZE</span> ;<br />&nbsp; &nbsp; &nbsp; aWhite<span style="color: #000000;">&#91;</span><span style="color: #000000;">7</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">4</span><span style="color: #000000;">&#93;</span>+aDlgMargin<span style="color: #000000;">&#91;</span> <span style="color: #000000;">4</span> <span style="color: #000000;">&#93;</span>, aWhite<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span>+aDlgMargin<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">COLOR</span> CLR_BLACK, CLR_HGRAY <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"PIANO"</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 />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">PAINT</span> PaintPiano<span style="color: #000000;">&#40;</span> hDC, oDlg <span style="color: #000000;">&#41;</span> ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CLICK</span> PlayPiano<span style="color: #000000;">&#40;</span> nRow, nCol <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> PaintPiano<span style="color: #000000;">&#40;</span> hDC, oDlg <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> hBrush<br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> aKey<br /><br />&nbsp; &nbsp;hBrush &nbsp; &nbsp; &nbsp;:= CreateSolidBrush<span style="color: #000000;">&#40;</span> CLR_WHITE <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">for</span> each aKey in aWhite<br />&nbsp; &nbsp; &nbsp; FillRect<span style="color: #000000;">&#40;</span> hDC, aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span>, hBrush <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">next</span><br />&nbsp; &nbsp;DeleteObject<span style="color: #000000;">&#40;</span> hBrush <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;hBrush &nbsp; := CreateSolidBrush<span style="color: #000000;">&#40;</span> CLR_BLACK <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">for</span> each aKey in aBlack<br />&nbsp; &nbsp; &nbsp; FillRect<span style="color: #000000;">&#40;</span> hDC, aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span>, hBrush <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">next</span><br />&nbsp; &nbsp;DeleteObject<span style="color: #000000;">&#40;</span> hBrush <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> PlayPiano<span style="color: #000000;">&#40;</span> nRow, nCol <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> n, aKey<br /><br />&nbsp; &nbsp;<span style="color: #00C800;">for</span> each aKey in <span style="color: #000000;">&#123;</span> aBlack, aWhite <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> nRow >= aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> .and. nRow < aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">for</span> n := <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> Len<span style="color: #000000;">&#40;</span> aKey <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> nCol >= aKey<span style="color: #000000;">&#91;</span> n <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">if</span> nCol < aKey<span style="color: #000000;">&#91;</span> n <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">4</span> <span style="color: #000000;">&#93;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TONE<span style="color: #000000;">&#40;</span> aKey<span style="color: #000000;">&#91;</span> n <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span>, <span style="color: #000000;">23</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">endif</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">else</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;EXIT<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">endif</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">next</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">endif</span><br />&nbsp; &nbsp;<span style="color: #00C800;">next</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> PrepareKeys<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> nGap &nbsp; &nbsp; &nbsp; &nbsp;:= &nbsp; <span style="color: #000000;">4</span><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> n, nTop, nLeft, nBottom<br /><br />&nbsp; &nbsp;aWhite &nbsp; &nbsp; &nbsp;:= <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp;nTop &nbsp; &nbsp; &nbsp; &nbsp;:= aDlgMargin<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span><br />&nbsp; &nbsp;nLeft &nbsp; &nbsp; &nbsp; := aDlgMargin<span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span><br />&nbsp; &nbsp;nBottom &nbsp; &nbsp; := nTop + nHtWhite<br /><br />&nbsp; &nbsp;<span style="color: #00C800;">for</span> each n in <span style="color: #000000;">&#123;</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">3</span>, <span style="color: #000000;">5</span>, <span style="color: #000000;">6</span>, <span style="color: #000000;">8</span>, <span style="color: #000000;">10</span>, <span style="color: #000000;">12</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; AAdd<span style="color: #000000;">&#40;</span> aWhite, <span style="color: #000000;">&#123;</span> n, aTone<span style="color: #000000;">&#91;</span> n <span style="color: #000000;">&#93;</span>, <span style="color: #000000;">&#123;</span> nTop, nLeft, nBottom, nLeft + nWdWhite <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; nLeft &nbsp; &nbsp;+= <span style="color: #000000;">&#40;</span> nWdWhite + nGap <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">next</span><br /><br />&nbsp; &nbsp;aBlack &nbsp; &nbsp; &nbsp;:= <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp;nLeft &nbsp; &nbsp; &nbsp; := aDlgMargin<span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span> + nWdWhite - Int<span style="color: #000000;">&#40;</span> nWdBlack / <span style="color: #000000;">2</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;nBottom &nbsp; &nbsp; := nTop + nHtBlack<br /><br />&nbsp; &nbsp;<span style="color: #00C800;">for</span> each n in <span style="color: #000000;">&#123;</span> <span style="color: #000000;">2</span>, <span style="color: #000000;">4</span>, <span style="color: #000000;">7</span>, <span style="color: #000000;">9</span>, <span style="color: #000000;">11</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; AAdd<span style="color: #000000;">&#40;</span> aBlack, <span style="color: #000000;">&#123;</span> n, aTone<span style="color: #000000;">&#91;</span> n <span style="color: #000000;">&#93;</span>, <span style="color: #000000;">&#123;</span> nTop, nLeft, nBottom, nLeft + nWdBlack <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; nLeft &nbsp; &nbsp;+= <span style="color: #000000;">&#40;</span> nWdWhite + nGap <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> n == <span style="color: #000000;">4</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nLeft &nbsp; &nbsp;+= <span style="color: #000000;">&#40;</span> nWdWhite + nGap <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">endif</span><br />&nbsp; &nbsp;<span style="color: #00C800;">next</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br />&nbsp;</div>[/code:zjibu3rx]
click a area of Tpanel control ( Creating a Piano)
,.
click a area of Tpanel control ( Creating a Piano)
for write the note ...I'm trying with [code=fw:1clatkar]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00D7D7;">#define</span> SRCCOPY &nbsp;<span style="color: #000000;">13369376</span><br /><span style="color: #00D7D7;">#define</span> DT_TOP &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000000<br /><span style="color: #00D7D7;">#define</span> DT_LEFT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00000000<br /><span style="color: #00D7D7;">#define</span> DT_CENTER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00000001<br /><span style="color: #00D7D7;">#define</span> DT_RIGHT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000002<br /><span style="color: #00D7D7;">#define</span> DT_VCENTER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000004<br /><span style="color: #00D7D7;">#define</span> DT_BOTTOM &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00000008<br /><span style="color: #00D7D7;">#define</span> DT_WORDBREAK &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000010<br /><span style="color: #00D7D7;">#define</span> DT_SINGLELINE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00000020<br /><span style="color: #00D7D7;">#define</span> DT_EXPANDTABS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00000040<br /><span style="color: #00D7D7;">#define</span> DT_TABSTOP &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000080<br /><span style="color: #00D7D7;">#define</span> DT_NOCLIP &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00000100<br /><span style="color: #00D7D7;">#define</span> DT_EXTERNALLEADING &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000200<br /><span style="color: #00D7D7;">#define</span> DT_CALCRECT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00000400<br /><span style="color: #00D7D7;">#define</span> DT_NOPREFIX &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00000800<br /><span style="color: #00D7D7;">#define</span> DT_INTERNAL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x00001000<br /><br />&nbsp; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> GetSysFont<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">-9</span> bold<br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> ;<br />&nbsp; &nbsp; &nbsp; aWhite<span style="color: #000000;">&#91;</span><span style="color: #000000;">7</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">4</span><span style="color: #000000;">&#93;</span>+aDlgMargin<span style="color: #000000;">&#91;</span> <span style="color: #000000;">4</span> <span style="color: #000000;">&#93;</span>, aWhite<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span>+aDlgMargin<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">COLOR</span> CLR_BLACK, CLR_HGRAY <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"PIANO"</span> &nbsp;<span style="color: #000000;">&#91;</span>b<span style="color: #000000;">&#93;</span><span style="color: #0000ff;">FONT</span> oFont<span style="color: #000000;">&#91;</span>/b<span style="color: #000000;">&#93;</span><br /><br /><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> PaintPiano<span style="color: #000000;">&#40;</span> hDC, oDlg <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> hBrush<br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> aKey<br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> aWhite_Text &nbsp; := <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"C"</span>,<span style="color: #ff0000;">"D"</span>,<span style="color: #ff0000;">"E"</span>,<span style="color: #ff0000;">"F"</span>,<span style="color: #ff0000;">"G"</span>,<span style="color: #ff0000;">"A"</span>,<span style="color: #ff0000;">"B"</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> aBlack_Text &nbsp; := <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"C#"</span>,<span style="color: #ff0000;">"D#"</span>,<span style="color: #ff0000;">"F#"</span>,<span style="color: #ff0000;">"G#"</span>,<span style="color: #ff0000;">"A#"</span><span style="color: #000000;">&#125;</span><br /><br /><br />&nbsp; &nbsp; n:= <span style="color: #000000;">1</span><br />&nbsp; &nbsp;hBrush &nbsp; &nbsp; &nbsp;:= CreateSolidBrush<span style="color: #000000;">&#40;</span> CLR_WHITE <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">for</span> each aKey in aWhite<br />&nbsp; &nbsp; &nbsp; FillRect<span style="color: #000000;">&#40;</span> hDC, aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span>, hBrush <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;nMode &nbsp; &nbsp; := SetBkMode<span style="color: #000000;">&#40;</span> hDC, <span style="color: #000000;">1</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;nColor := SetTextColor<span style="color: #000000;">&#40;</span> hDC, CLR_BLACK <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;hFont &nbsp; &nbsp; := <span style="color: #00C800;">if</span><span style="color: #000000;">&#40;</span>oDlg:<span style="color: #000000;">oFont</span> != <span style="color: #00C800;">nil</span>,oDlg:<span style="color: #000000;">oFont</span>:<span style="color: #000000;">hFont</span>, GetDefFont<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;hOldFont &nbsp;:= SelectObject<span style="color: #000000;">&#40;</span> hDC, hFont <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;DrawText<span style="color: #000000;">&#40;</span> hDC, aWhite_Text<span style="color: #000000;">&#91;</span>n<span style="color: #000000;">&#93;</span> ,aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> , nOr<span style="color: #000000;">&#40;</span> DT_SINGLELINE, DT_VCENTER, DT_RIGHT <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;SetBkMode<span style="color: #000000;">&#40;</span> hDC, nMode <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;n:= n<span style="color: #000000;">+1</span><br />&nbsp; &nbsp;<span style="color: #00C800;">next</span><br />&nbsp; &nbsp;DeleteObject<span style="color: #000000;">&#40;</span> hBrush <span style="color: #000000;">&#41;</span><br /><br /><br />&nbsp; &nbsp;n:= <span style="color: #000000;">1</span><br />&nbsp; &nbsp;hBrush &nbsp; := CreateSolidBrush<span style="color: #000000;">&#40;</span> CLR_BLACK <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">for</span> each aKey in aBlack<br />&nbsp; &nbsp; &nbsp; FillRect<span style="color: #000000;">&#40;</span> hDC, aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span>, hBrush <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;nMode &nbsp; &nbsp; := SetBkMode<span style="color: #000000;">&#40;</span> hDC, <span style="color: #000000;">1</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;nColor := SetTextColor<span style="color: #000000;">&#40;</span> hDC, CLR_YELLOW <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;hFont &nbsp; &nbsp; := <span style="color: #00C800;">if</span><span style="color: #000000;">&#40;</span>oDlg:<span style="color: #000000;">oFont</span> != <span style="color: #00C800;">nil</span>,oDlg:<span style="color: #000000;">oFont</span>:<span style="color: #000000;">hFont</span>, GetDefFont<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;hOldFont &nbsp;:= SelectObject<span style="color: #000000;">&#40;</span> hDC, hFont <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;DrawText<span style="color: #000000;">&#40;</span> hDC, aBlack_Text<span style="color: #000000;">&#91;</span>n<span style="color: #000000;">&#93;</span> ,aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> , nOr<span style="color: #000000;">&#40;</span> DT_SINGLELINE, DT_VCENTER, DT_RIGHT <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;SetBkMode<span style="color: #000000;">&#40;</span> hDC, nMode <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;n:= n<span style="color: #000000;">+1</span><br />&nbsp; &nbsp;<span style="color: #00C800;">next</span><br />&nbsp; &nbsp;DeleteObject<span style="color: #000000;">&#40;</span> hBrush <span style="color: #000000;">&#41;</span><br /><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br />&nbsp;</div>[/code:1clatkar] [b:1clatkar]the result [/b:1clatkar] [img:1clatkar]http&#58;//www&#46;eoeo&#46;it/wp-content/uploads/2014/12/piano&#46;jpg[/img:1clatkar] How I can move the text on white keys ?
click a area of Tpanel control ( Creating a Piano)
Found !!!! aKey[ 3 ][1]+= 80 aKey[ 3 ][2]+= 20 [b:35xj18ye]the result [/b:35xj18ye] [img:35xj18ye]http&#58;//www&#46;eoeo&#46;it/wp-content/uploads/2014/12/piano2&#46;jpg[/img:35xj18ye] [code=fw:35xj18ye]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> PaintPiano<span style="color: #000000;">&#40;</span> hDC, oDlg <span style="color: #000000;">&#41;</span><br /><br />   <span style="color: #00C800;">local</span> hBrush<br />   <span style="color: #00C800;">local</span> aKey<br />   <span style="color: #00C800;">local</span> aWhite_Text   := <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"C"</span>,<span style="color: #ff0000;">"D"</span>,<span style="color: #ff0000;">"E"</span>,<span style="color: #ff0000;">"F"</span>,<span style="color: #ff0000;">"G"</span>,<span style="color: #ff0000;">"A"</span>,<span style="color: #ff0000;">"B"</span> <span style="color: #000000;">&#125;</span><br />   <span style="color: #00C800;">local</span> aBlack_Text   := <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"C#"</span>,<span style="color: #ff0000;">"D#"</span>,<span style="color: #ff0000;">"F#"</span>,<span style="color: #ff0000;">"G#"</span>,<span style="color: #ff0000;">"A#"</span><span style="color: #000000;">&#125;</span><br /><br /><br />   n:= <span style="color: #000000;">1</span><br />   hBrush      := CreateSolidBrush<span style="color: #000000;">&#40;</span> CLR_WHITE <span style="color: #000000;">&#41;</span><br />   <span style="color: #00C800;">for</span> each aKey in aWhite<br />      FillRect<span style="color: #000000;">&#40;</span> hDC, aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span>, hBrush <span style="color: #000000;">&#41;</span><br />   nMode     := SetBkMode<span style="color: #000000;">&#40;</span> hDC, <span style="color: #000000;">1</span> <span style="color: #000000;">&#41;</span><br />   nColor := SetTextColor<span style="color: #000000;">&#40;</span> hDC, CLR_BLACK <span style="color: #000000;">&#41;</span><br />   hFont     := <span style="color: #00C800;">if</span><span style="color: #000000;">&#40;</span>oDlg:<span style="color: #000000;">oFont</span> != <span style="color: #00C800;">nil</span>,oDlg:<span style="color: #000000;">oFont</span>:<span style="color: #000000;">hFont</span>, GetDefFont<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />   hOldFont  := SelectObject<span style="color: #000000;">&#40;</span> hDC, hFont <span style="color: #000000;">&#41;</span><br />   aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>+= <span style="color: #000000;">80</span><br />   aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>+= <span style="color: #000000;">20</span><br />   DrawText<span style="color: #000000;">&#40;</span> hDC, aWhite_Text<span style="color: #000000;">&#91;</span>n<span style="color: #000000;">&#93;</span> ,aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> , nOr<span style="color: #000000;">&#40;</span> DT_SINGLELINE,DT_VCENTER,DT_VCENTER <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />   SetBkMode<span style="color: #000000;">&#40;</span> hDC, nMode <span style="color: #000000;">&#41;</span><br />   n:= n<span style="color: #000000;">+1</span><br />  &nbsp;aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>-= <span style="color: #000000;">80</span><br />   aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>-= <span style="color: #000000;">20</span><br />   <span style="color: #00C800;">next</span><br />   DeleteObject<span style="color: #000000;">&#40;</span> hBrush <span style="color: #000000;">&#41;</span><br /><br /><br />   n:= <span style="color: #000000;">1</span><br />   hBrush   := CreateSolidBrush<span style="color: #000000;">&#40;</span> CLR_BLACK <span style="color: #000000;">&#41;</span><br />   <span style="color: #00C800;">for</span> each aKey in aBlack<br />      FillRect<span style="color: #000000;">&#40;</span> hDC, aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span>, hBrush <span style="color: #000000;">&#41;</span><br />   nMode     := SetBkMode<span style="color: #000000;">&#40;</span> hDC, <span style="color: #000000;">1</span> <span style="color: #000000;">&#41;</span><br />   nColor := SetTextColor<span style="color: #000000;">&#40;</span> hDC, CLR_YELLOW <span style="color: #000000;">&#41;</span><br />   hFont     := <span style="color: #00C800;">if</span><span style="color: #000000;">&#40;</span>oDlg:<span style="color: #000000;">oFont</span> != <span style="color: #00C800;">nil</span>,oDlg:<span style="color: #000000;">oFont</span>:<span style="color: #000000;">hFont</span>, GetDefFont<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />   hOldFont  := SelectObject<span style="color: #000000;">&#40;</span> hDC, hFont <span style="color: #000000;">&#41;</span><br />   DrawText<span style="color: #000000;">&#40;</span> hDC, aBlack_Text<span style="color: #000000;">&#91;</span>n<span style="color: #000000;">&#93;</span> ,aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> , nOr<span style="color: #000000;">&#40;</span> DT_SINGLELINE, DT_VCENTER, DT_RIGHT <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />   SetBkMode<span style="color: #000000;">&#40;</span> hDC, nMode <span style="color: #000000;">&#41;</span><br />   n:= n<span style="color: #000000;">+1</span><br /><br /><br />   <span style="color: #00C800;">next</span><br />   DeleteObject<span style="color: #000000;">&#40;</span> hBrush <span style="color: #000000;">&#41;</span><br /><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span></div>[/code:35xj18ye]
click a area of Tpanel control ( Creating a Piano)
.
click a area of Tpanel control ( Creating a Piano)
Rao, Silvio, Very nice <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
click a area of Tpanel control ( Creating a Piano)
Please try this with #define METHOD1 and also commenting out //#define METHOD1. Are you sure the frequencies are right? Is it possible to stop the Tone when the user presses another key? [code=fw:3itj5sj7]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">/*<br />*<br />* &nbsp;Piano.prg<br />* &nbsp;G.N.Rao<br />*<br />*/</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fiveWin.Ch"</span><br /><br /><span style="color: #00D7D7;">#define</span> METHOD1<br /><br />#ifdef METHOD1<br /><span style="color: #00C800;">static</span> aTone &nbsp; &nbsp; &nbsp; &nbsp;:= <span style="color: #000000;">&#123;</span> <span style="color: #000000;">130.8</span>, <span style="color: #000000;">138.6</span>, <span style="color: #000000;">146.8</span>, <span style="color: #000000;">155.6</span>, <span style="color: #000000;">164.8</span>, <span style="color: #000000;">174.6</span>, <span style="color: #000000;">185</span>, <span style="color: #000000;">196</span>, <span style="color: #000000;">207.7</span>, <span style="color: #000000;">220</span>, <span style="color: #000000;">233.1</span>, <span style="color: #000000;">246.9</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">261.7</span>, <span style="color: #000000;">277.2</span>, <span style="color: #000000;">293.7</span>, <span style="color: #000000;">311.1</span>, <span style="color: #000000;">329.6</span>,<span style="color: #000000;">349.2</span>,<span style="color: #000000;">370</span>, <span style="color: #000000;">415.3</span>, <span style="color: #000000;">440</span>, <span style="color: #000000;">466.2</span>, <span style="color: #000000;">493.9</span>, <span style="color: #000000;">523.3</span> <span style="color: #000000;">&#125;</span><br />#else<br /><span style="color: #00C800;">static</span> aTone := <span style="color: #000000;">&#123;</span> &nbsp;<span style="color: #000000;">262</span>, <span style="color: #000000;">277</span>, <span style="color: #000000;">294</span>, <span style="color: #000000;">311</span>, <span style="color: #000000;">330</span>, <span style="color: #000000;">349</span>, <span style="color: #000000;">370</span>, <span style="color: #000000;">392</span>, <span style="color: #000000;">415</span>, <span style="color: #000000;">440</span>, <span style="color: #000000;">460</span>, <span style="color: #000000;">494</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">523</span>, <span style="color: #000000;">554</span>, <span style="color: #000000;">587</span>, <span style="color: #000000;">622</span>, <span style="color: #000000;">659</span>, <span style="color: #000000;">698</span>, <span style="color: #000000;">740</span>, <span style="color: #000000;">784</span>, <span style="color: #000000;">831</span>, <span style="color: #000000;">880</span>, <span style="color: #000000;">932</span>, <span style="color: #000000;">988</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">1047</span>,<span style="color: #000000;">1109</span>,<span style="color: #000000;">1175</span>,<span style="color: #000000;">1244</span>,<span style="color: #000000;">1318</span>,<span style="color: #000000;">1397</span>,<span style="color: #000000;">1480</span>,<span style="color: #000000;">1568</span>,<span style="color: #000000;">1661</span>,<span style="color: #000000;">1760</span>,<span style="color: #000000;">1865</span>,<span style="color: #000000;">1976</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">2094</span>,<span style="color: #000000;">2218</span>,<span style="color: #000000;">2350</span>,<span style="color: #000000;">2489</span>,<span style="color: #000000;">2637</span>,<span style="color: #000000;">2794</span>,<span style="color: #000000;">2960</span>,<span style="color: #000000;">3136</span>,<span style="color: #000000;">3322</span>,<span style="color: #000000;">3520</span>,<span style="color: #000000;">3730</span>,<span style="color: #000000;">3951</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">4187</span> <span style="color: #000000;">&#125;</span><br />#endif<br /><br /><span style="color: #00C800;">static</span> aWhite, aBlack<br /><br /><span style="color: #B900B9;">// Configuration Parameters</span><br /><span style="color: #00C800;">static</span> aDlgMargin := <span style="color: #000000;">&#123;</span> <span style="color: #000000;">20</span>, <span style="color: #000000;">20</span>, <span style="color: #000000;">20</span>, <span style="color: #000000;">20</span> <span style="color: #000000;">&#125;</span> &nbsp;<span style="color: #B900B9;">// top, left, bottom, right</span><br /><span style="color: #00C800;">static</span> nHtWhite &nbsp; := <span style="color: #000000;">200</span><br /><span style="color: #00C800;">static</span> nWdWhite &nbsp; := <span style="color: #000000;">40</span><br /><span style="color: #00C800;">static</span> nHtBlack &nbsp; := <span style="color: #000000;">120</span><br /><span style="color: #00C800;">static</span> nWdBlack &nbsp; := <span style="color: #000000;">20</span><br /><span style="color: #00C800;">static</span> nDuration &nbsp;:= <span style="color: #000000;">23</span><br /><span style="color: #00C800;">static</span> nKeyPress &nbsp;:= <span style="color: #000000;">0</span><br /><span style="color: #00C800;">static</span> nOctaves &nbsp; := <span style="color: #000000;">4</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> oDlg, oFont<br /><br />&nbsp; &nbsp;nOctaves &nbsp; &nbsp; &nbsp; := <span style="color: #0000ff;">Min</span><span style="color: #000000;">&#40;</span> nOctaves, Int<span style="color: #000000;">&#40;</span> Len<span style="color: #000000;">&#40;</span> aTone <span style="color: #000000;">&#41;</span> / <span style="color: #000000;">12</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;PrepareKeys<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;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"TAHOMA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-10</span> BOLD<br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">SIZE</span> ;<br />&nbsp; &nbsp; &nbsp; ATail<span style="color: #000000;">&#40;</span> aWhite <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">4</span><span style="color: #000000;">&#93;</span>+aDlgMargin<span style="color: #000000;">&#91;</span> <span style="color: #000000;">4</span> <span style="color: #000000;">&#93;</span>, aWhite<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span>+aDlgMargin<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">COLOR</span> CLR_BLACK, CLR_HGRAY <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"PIANO"</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 />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">PAINT</span> PaintPiano<span style="color: #000000;">&#40;</span> hDC, oDlg <span style="color: #000000;">&#41;</span> ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CLICK</span> PlayPiano<span style="color: #000000;">&#40;</span> nRow, nCol, oDlg <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> PaintPiano<span style="color: #000000;">&#40;</span> hDC, oDlg <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> hBrush, hBrush2<br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> aKey<br /><br />&nbsp; &nbsp;hBrush &nbsp; &nbsp; &nbsp;:= CreateSolidBrush<span style="color: #000000;">&#40;</span> CLR_WHITE <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">for</span> each aKey in aWhite<br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> == nKeyPress<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hBrush2 := CreateSolidBrush<span style="color: #000000;">&#40;</span> RGB<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> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FillRect<span style="color: #000000;">&#40;</span> hDC, aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span>, hBrush2 <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DeleteObject<span style="color: #000000;">&#40;</span> hBrush2 <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">else</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FillRect<span style="color: #000000;">&#40;</span> hDC, aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span>, hBrush <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">endif</span><br />&nbsp; &nbsp; &nbsp; PaintLabel<span style="color: #000000;">&#40;</span> hDC, aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">4</span> <span style="color: #000000;">&#93;</span>, aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span>, oDlg:<span style="color: #000000;">oFont</span>, CLR_BLACK <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">next</span><br />&nbsp; &nbsp;DeleteObject<span style="color: #000000;">&#40;</span> hBrush <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;hBrush &nbsp; := CreateSolidBrush<span style="color: #000000;">&#40;</span> CLR_BLACK <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">for</span> each aKey in aBlack<br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> == nKeyPress<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hBrush2 := CreateSolidBrush<span style="color: #000000;">&#40;</span> CLR_GRAY <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FillRect<span style="color: #000000;">&#40;</span> hDC, aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span>, hBrush2 <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DeleteObject<span style="color: #000000;">&#40;</span> hBrush2 <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">else</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FillRect<span style="color: #000000;">&#40;</span> hDC, aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span>, hBrush <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">endif</span><br />&nbsp; &nbsp; &nbsp; PaintLabel<span style="color: #000000;">&#40;</span> hDC, aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">4</span> <span style="color: #000000;">&#93;</span>, aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span>, oDlg:<span style="color: #000000;">oFont</span>, CLR_YELLOW <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">next</span><br />&nbsp; &nbsp;DeleteObject<span style="color: #000000;">&#40;</span> hBrush <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> PaintLabel<span style="color: #000000;">&#40;</span> hDC, cLabel, aRect, oFont, nColor <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> nMode<br /><br />&nbsp; &nbsp;<span style="color: #00C800;">if</span> Len<span style="color: #000000;">&#40;</span> cLabel <span style="color: #000000;">&#41;</span> == <span style="color: #000000;">1</span> &nbsp;<span style="color: #B900B9;">// White Key</span><br />&nbsp; &nbsp; &nbsp; aRect &nbsp; &nbsp;:= AClone<span style="color: #000000;">&#40;</span> aRect <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; aRect<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> &nbsp;+= nHtBlack<br />&nbsp; &nbsp;<span style="color: #00C800;">endif</span><br /><br />&nbsp; &nbsp;nMode &nbsp; &nbsp; &nbsp; := SetBkMode<span style="color: #000000;">&#40;</span> hDC, <span style="color: #000000;">1</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;SetTextColor<span style="color: #000000;">&#40;</span> hDC, nColor <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oFont:<span style="color: #0000ff;">Activate</span><span style="color: #000000;">&#40;</span> hDC <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;DrawText<span style="color: #000000;">&#40;</span> hDC, cLabel ,aRect , 0x25 <span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">// DT_SINGLELINE + DT_VCENTER + DT_CENTER</span><br />&nbsp; &nbsp;oFont:<span style="color: #000000;">DeActivate</span><span style="color: #000000;">&#40;</span> hDC <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;SetBkMode<span style="color: #000000;">&#40;</span> hDC, nMode <span style="color: #000000;">&#41;</span><br /><br /><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> PlayPiano<span style="color: #000000;">&#40;</span> nRow, nCol, oDlg <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> n, aKey<br /><br />&nbsp; &nbsp;<span style="color: #00C800;">for</span> each aKey in <span style="color: #000000;">&#123;</span> aBlack, aWhite <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> nRow >= aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> .and. nRow < aKey<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">for</span> n := <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> Len<span style="color: #000000;">&#40;</span> aKey <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> nCol >= aKey<span style="color: #000000;">&#91;</span> n <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">if</span> nCol < aKey<span style="color: #000000;">&#91;</span> n <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">4</span> <span style="color: #000000;">&#93;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nKeyPress &nbsp; := aKey<span style="color: #000000;">&#91;</span> n <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oDlg:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SysRefresh<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />#ifdef METHOD1<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TONE<span style="color: #000000;">&#40;</span> aKey<span style="color: #000000;">&#91;</span> n <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span>, nDuration <span style="color: #000000;">&#41;</span><br />#else<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TONE_2<span style="color: #000000;">&#40;</span> aKey<span style="color: #000000;">&#91;</span> n <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span>, <span style="color: #ff0000;">"1/2"</span> <span style="color: #000000;">&#41;</span><br />#endif<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nKeyPress &nbsp; := <span style="color: #000000;">0</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oDlg:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SysRefresh<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">endif</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">else</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;EXIT<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">endif</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">next</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">endif</span><br />&nbsp; &nbsp;<span style="color: #00C800;">next</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> PrepareKeys<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> nGap &nbsp; &nbsp; &nbsp; &nbsp;:= &nbsp; <span style="color: #000000;">4</span><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> n, x, nTop, nLeft, nBottom<br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> nOctave<br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> aLabel &nbsp; &nbsp;:= <span style="color: #000000;">&#123;</span> <span style="color: #ff0000;">"C"</span>, <span style="color: #ff0000;">"C#"</span>, <span style="color: #ff0000;">"D"</span>, <span style="color: #ff0000;">"D#"</span>, <span style="color: #ff0000;">"E"</span>, <span style="color: #ff0000;">"F"</span>, <span style="color: #ff0000;">"F#"</span>, <span style="color: #ff0000;">"G"</span>, <span style="color: #ff0000;">"G#"</span>, <span style="color: #ff0000;">"A"</span>, <span style="color: #ff0000;">"A#"</span>, <span style="color: #ff0000;">"B"</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp;aWhite &nbsp; &nbsp; &nbsp;:= <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp;nTop &nbsp; &nbsp; &nbsp; &nbsp;:= aDlgMargin<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span><br />&nbsp; &nbsp;nLeft &nbsp; &nbsp; &nbsp; := aDlgMargin<span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span><br />&nbsp; &nbsp;nBottom &nbsp; &nbsp; := nTop + nHtWhite<br /><br />&nbsp; &nbsp;x &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; := <span style="color: #000000;">0</span><br />&nbsp; &nbsp;<span style="color: #00C800;">for</span> nOctave := <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> nOctaves<br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">for</span> each n in <span style="color: #000000;">&#123;</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">3</span>, <span style="color: #000000;">5</span>, <span style="color: #000000;">6</span>, <span style="color: #000000;">8</span>, <span style="color: #000000;">10</span>, <span style="color: #000000;">12</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AAdd<span style="color: #000000;">&#40;</span> aWhite, <span style="color: #000000;">&#123;</span> x + n, aTone<span style="color: #000000;">&#91;</span> x + n <span style="color: #000000;">&#93;</span>, <span style="color: #000000;">&#123;</span> nTop, nLeft, nBottom, nLeft + nWdWhite <span style="color: #000000;">&#125;</span>, aLabel<span style="color: #000000;">&#91;</span> n <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nLeft &nbsp; &nbsp;+= <span style="color: #000000;">&#40;</span> nWdWhite + nGap <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">next</span><br />&nbsp; &nbsp; &nbsp; x &nbsp; &nbsp; &nbsp; &nbsp;+= <span style="color: #000000;">12</span><br />&nbsp; &nbsp;<span style="color: #00C800;">next</span><br /><br />&nbsp; &nbsp;aBlack &nbsp; &nbsp; &nbsp;:= <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp;nLeft &nbsp; &nbsp; &nbsp; := aDlgMargin<span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span> + nWdWhite - Int<span style="color: #000000;">&#40;</span> nWdBlack / <span style="color: #000000;">2</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;nBottom &nbsp; &nbsp; := nTop + nHtBlack<br /><br />&nbsp; &nbsp;x &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; := <span style="color: #000000;">0</span><br />&nbsp; &nbsp;<span style="color: #00C800;">for</span> nOctave := <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> nOctaves<br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">for</span> each n in <span style="color: #000000;">&#123;</span> <span style="color: #000000;">2</span>, <span style="color: #000000;">4</span>, <span style="color: #000000;">7</span>, <span style="color: #000000;">9</span>, <span style="color: #000000;">11</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AAdd<span style="color: #000000;">&#40;</span> aBlack, <span style="color: #000000;">&#123;</span> x + n, aTone<span style="color: #000000;">&#91;</span> x + n <span style="color: #000000;">&#93;</span>, <span style="color: #000000;">&#123;</span> nTop, nLeft, nBottom, nLeft + nWdBlack <span style="color: #000000;">&#125;</span>, aLabel<span style="color: #000000;">&#91;</span> n <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nLeft &nbsp; &nbsp;+= <span style="color: #000000;">&#40;</span> nWdWhite + nGap <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">if</span> n == <span style="color: #000000;">4</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nLeft &nbsp; &nbsp;+= <span style="color: #000000;">&#40;</span> nWdWhite + nGap <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">endif</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">next</span><br />&nbsp; &nbsp; &nbsp; nLeft &nbsp; &nbsp;+= <span style="color: #000000;">&#40;</span> nWdWhite + nGap <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; x &nbsp; &nbsp; &nbsp; &nbsp;+= <span style="color: #000000;">12</span><br />&nbsp; &nbsp;<span style="color: #00C800;">next</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> TONE_2<span style="color: #000000;">&#40;</span> nFreq, cTempo <span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">// cTempo can be "1/2", "1/4", "1/8"</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> nTime<br /><br />&nbsp; &nbsp;<span style="color: #00C800;">DEFAULT</span> cTempo := <span style="color: #ff0000;">"1/2"</span><br /><br />&nbsp; &nbsp;nTime &nbsp; &nbsp;:= &cTempo<br />&nbsp; &nbsp;nTime &nbsp; &nbsp;*= <span style="color: #000000;">24</span><br /><br /><span style="color: #00C800;">return</span> TONE<span style="color: #000000;">&#40;</span> nFreq, nTime <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00D7D7;">#pragma</span> BEGINDUMP<br /><br /><span style="color: #B900B9;">/*<br />&nbsp; &nbsp;Author: Andi Jahja <harbour@cbn.net.id><br /><br />&nbsp; &nbsp;TONE() for Windows to replace the ugly-heard GT Tone :-)<br />&nbsp; &nbsp;Mono approach. Duration has been roughly estimated to be Cli**per-like,<br />&nbsp; &nbsp;please refer to tests/sound.prg.<br />&nbsp; &nbsp;Using Windows MMsystem, sound card is a must in order to make<br />&nbsp; &nbsp;this function work.<br /><br />&nbsp; &nbsp;Syntax: TONE( nFreq, nDuration, [ lSmooth ], [ nVol ] ) -> NIL<br /><br />&nbsp; &nbsp;nFreq &nbsp; &nbsp; = INTEGER, Tone frequency<br />&nbsp; &nbsp;nDuration = NUMERIC, Duration Time, as in Cl**per<br />&nbsp; &nbsp;lSmooth &nbsp; = LOGICAL, pass .F. to disable sound smoothing, default is .T.<br />&nbsp; &nbsp;nVol &nbsp; &nbsp; &nbsp;= INTEGER, Sound Intensity/Volume, value 0 - 127, Default 127 ( Max )<br /><br />*/</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"hbapi.h"</span><br /><span style="color: #00D7D7;">#include</span> <windows.h><br /><span style="color: #00D7D7;">#include</span> <mmsystem.h><br /><span style="color: #00D7D7;">#include</span> <math.h><br /><br />#ifndef __XHARBOUR__<br />&nbsp; &nbsp;<span style="color: #00D7D7;">#define</span> ISLOG<span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;HB_ISLOG<span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00D7D7;">#define</span> ISNUM<span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;HB_ISNUM<span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span><br />#endif<br /><br /><span style="color: #00D7D7;">#define</span> SAMPLING_RATE <span style="color: #000000;">44100</span><br /><br />void HB_EXPORT hb_winTone<span style="color: #000000;">&#40;</span> UINT, double, BOOL, UINT <span style="color: #000000;">&#41;</span>;<br /><br /><span style="color: #00C800;">HB_FUNC</span><span style="color: #000000;">&#40;</span> TONE <span style="color: #000000;">&#41;</span><br /><span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">if</span> ISNUM<span style="color: #000000;">&#40;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; hb_winTone<span style="color: #000000;">&#40;</span> hb_parni<span style="color: #000000;">&#40;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#41;</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#40;</span> ISNUM<span style="color: #000000;">&#40;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#41;</span> ? hb_parnd<span style="color: #000000;">&#40;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#41;</span> : <span style="color: #000000;">1.0</span> <span style="color: #000000;">&#41;</span> * <span style="color: #000000;">2100</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ISLOG<span style="color: #000000;">&#40;</span> <span style="color: #000000;">3</span><span style="color: #000000;">&#41;</span> ? hb_parl<span style="color: #000000;">&#40;</span> <span style="color: #000000;">3</span> <span style="color: #000000;">&#41;</span> : <span style="color: #00C800;">TRUE</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ISNUM<span style="color: #000000;">&#40;</span> <span style="color: #000000;">4</span> <span style="color: #000000;">&#41;</span> ? hb_parni<span style="color: #000000;">&#40;</span> <span style="color: #000000;">4</span> <span style="color: #000000;">&#41;</span> : <span style="color: #000000;">127</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp;<span style="color: #000000;">&#125;</span><br /><span style="color: #000000;">&#125;</span><br /><br /><span style="color: #B900B9;">/* Keep it here for access from C programs */</span><br />void HB_EXPORT hb_winTone<span style="color: #000000;">&#40;</span> UINT uFrequency, double dwDuration, BOOL bSmoothing, UINT uVolume <span style="color: #000000;">&#41;</span><br /><span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp;WAVEFORMATEX wfx;<br />&nbsp; &nbsp;HWAVEOUT hWaveOut = <span style="color: #00C800;">NULL</span>;<br /><br />&nbsp; &nbsp;wfx.wFormatTag = WAVE_FORMAT_PCM;<br />&nbsp; &nbsp;wfx.nChannels = <span style="color: #000000;">1</span>;<br />&nbsp; &nbsp;wfx.nSamplesPerSec = SAMPLING_RATE;<br />&nbsp; &nbsp;wfx.nAvgBytesPerSec = SAMPLING_RATE;<br />&nbsp; &nbsp;wfx.nBlockAlign = <span style="color: #000000;">1</span>;<br />&nbsp; &nbsp;wfx.wBitsPerSample = <span style="color: #000000;">8</span>;<br />&nbsp; &nbsp;wfx.cbSize = <span style="color: #000000;">0</span>;<br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">/*<br />&nbsp; &nbsp;WAVE_MAPPER is the most commonly used device<br />&nbsp; &nbsp;CallBack is unnecessary since we only play simple tone<br />&nbsp; &nbsp;*/</span><br />&nbsp; &nbsp;<span style="color: #00C800;">if</span><span style="color: #000000;">&#40;</span> waveOutOpen<span style="color: #000000;">&#40;</span> &hWaveOut, WAVE_MAPPER, &wfx, <span style="color: #00C800;">NULL</span>, <span style="color: #00C800;">NULL</span>, CALLBACK_NULL <span style="color: #000000;">&#41;</span> == MMSYSERR_NOERROR <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; char amp = uVolume;<br />&nbsp; &nbsp; &nbsp; int i;<br />&nbsp; &nbsp; &nbsp; unsigned char* buffer = <span style="color: #000000;">&#40;</span>unsigned char*<span style="color: #000000;">&#41;</span> hb_xgrab<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span>ULONG<span style="color: #000000;">&#41;</span> dwDuration <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; double dKoef = uFrequency * <span style="color: #000000;">2</span> * <span style="color: #000000;">3.14159</span> / SAMPLING_RATE;<br />&nbsp; &nbsp; &nbsp; WAVEHDR wh;<br /><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> <span style="color: #000000;">&#40;</span> buffer <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;wh.lpData = <span style="color: #000000;">&#40;</span>LPSTR<span style="color: #000000;">&#41;</span> buffer;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;wh.dwBufferLength = <span style="color: #000000;">&#40;</span>DWORD<span style="color: #000000;">&#41;</span> dwDuration;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;wh.dwFlags = WHDR_BEGINLOOP;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;wh.dwLoops = <span style="color: #000000;">1</span>;<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">if</span><span style="color: #000000;">&#40;</span> waveOutPrepareHeader<span style="color: #000000;">&#40;</span> hWaveOut, &wh, sizeof<span style="color: #000000;">&#40;</span> wh <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> == MMSYSERR_NOERROR <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wh.dwFlags = WHDR_BEGINLOOP | WHDR_ENDLOOP | WHDR_PREPARED;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wh.dwLoops = <span style="color: #000000;">1</span>;<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> <span style="color: #000000;">&#40;</span> bSmoothing <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">/*<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Manipulating data to smooth sound from clicks at the start<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;and end (particularly noted when we call TONE() many times<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;in a row). This is a simulation of increasing volume gradually<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;before it reaches the peak, and decreasing volume gradually<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;before it reaches the end.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">for</span><span style="color: #000000;">&#40;</span> i = <span style="color: #000000;">0</span>; i < dwDuration; i++ <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> <span style="color: #000000;">&#40;</span> i < amp <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;buffer<span style="color: #000000;">&#91;</span> i <span style="color: #000000;">&#93;</span> = <span style="color: #000000;">&#40;</span>unsigned char<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">cos</span><span style="color: #000000;">&#40;</span> i * dKoef <span style="color: #000000;">&#41;</span> * i + <span style="color: #000000;">127</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">else</span> <span style="color: #00C800;">if</span> <span style="color: #000000;">&#40;</span> dwDuration - i <= amp - <span style="color: #000000;">1</span> &nbsp;<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;amp = <span style="color: #0000ff;">max</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span>, --amp <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;buffer<span style="color: #000000;">&#91;</span> i <span style="color: #000000;">&#93;</span> = <span style="color: #000000;">&#40;</span>unsigned char<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">cos</span><span style="color: #000000;">&#40;</span> i * dKoef <span style="color: #000000;">&#41;</span> * amp + <span style="color: #000000;">127</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">else</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;buffer<span style="color: #000000;">&#91;</span> i <span style="color: #000000;">&#93;</span> = <span style="color: #000000;">&#40;</span>unsigned char<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">cos</span><span style="color: #000000;">&#40;</span> i * dKoef <span style="color: #000000;">&#41;</span> * amp + <span style="color: #000000;">127</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">else</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">/*<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Raw sound, may cause annoying clicks when some tones are played<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;in a row.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">for</span><span style="color: #000000;">&#40;</span> i = <span style="color: #000000;">0</span>; i < <span style="color: #000000;">&#40;</span>int<span style="color: #000000;">&#41;</span> dwDuration; i++ <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buffer<span style="color: #000000;">&#91;</span> i <span style="color: #000000;">&#93;</span> = <span style="color: #000000;">&#40;</span>unsigned char<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">cos</span><span style="color: #000000;">&#40;</span> i * dKoef <span style="color: #000000;">&#41;</span> * amp + <span style="color: #000000;">127</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">/*<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Play the sound here<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> <span style="color: #000000;">&#40;</span> waveOutWrite<span style="color: #000000;">&#40;</span> hWaveOut, &wh, sizeof<span style="color: #000000;">&#40;</span>WAVEHDR<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> == MMSYSERR_NOERROR <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">/*<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Wait until the sound is finished<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">while</span> <span style="color: #000000;">&#40;</span>!<span style="color: #000000;">&#40;</span>wh.dwFlags & WHDR_DONE<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">Sleep</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;waveOutUnprepareHeader<span style="color: #000000;">&#40;</span>hWaveOut, &wh, sizeof<span style="color: #000000;">&#40;</span>WAVEHDR<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hb_xfree<span style="color: #000000;">&#40;</span> buffer <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp;<span style="color: #000000;">&#125;</span><br /><span style="color: #000000;">&#125;</span><br /><br /><span style="color: #00D7D7;">#pragma</span> ENDDUMP<br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br />&nbsp;</div>[/code:3itj5sj7]
click a area of Tpanel control ( Creating a Piano)
Rao, [img:1m4kxwcr]http&#58;//www&#46;eoeo&#46;it/wp-content/uploads/2014/12/Tabella-di-correlazione-tra-notazione-musicale-e-relative-frequenze-per-ottava&#46;png[/img:1m4kxwcr] We Initiated from 3 octave because a C with 130,8 is a good listen --- I'll like Know How make instrument path ( piano, guitar, drum) Static aTone := { 130.8, 138.6, 146.8, 155.6, 164.8, 174.6, 185.0, 196.0, 207.7, 220.0, 233.1, 246.9,; // 3 octave 261.7, 277.2, 293.7, 311.1, 329.6, 349.2, 370.0, 392.0, 415.3, 440.0, 466.2, 493.9,; // 4 octave 523.3, 554.4, 587.3, 622.3, 659.3, 698.5, 740.0, 784.0, 830.6, 880.0, 932.3, 987.8,; // 5 octave 1047 , 1109, 1175, 1245, 1319, 1397, 1480, 1568, 1661, 1760, 1865, 1976 ,; // 6 octave 2093 , 2217, 2349, 2489, 2637, 2794, 2960, 3136, 3322, 3520, 3729, 3951 } // 7 octave I arrive on 4 octave ( 48 keys) .. I insert your modifies and the post the new sources I add also the possibility to save the music on a file and load music from this file
click a area of Tpanel control ( Creating a Piano)
After finalizing the frequencies for all octaves, please share the final values with me. How can we make the duration controlled by the user? That is the tone should start playing when the user presses the key and stop when he releases the key.( ofcourse that is not piano). I like to have this variation also.
click a area of Tpanel control ( Creating a Piano)
Mr. Rao, on tone function of Andy try to wrote #define SAMPLING_RATE 126100 instead of #define SAMPLING_RATE 44100 it change the duration of note Perhaps we can found a function to control it !!! See it please I add : now the Piano have [b:23fkesmw]60[/b:23fkesmw] keys !!!!! ( use with METHOD1 active) [b:23fkesmw]Border and Background[/b:23fkesmw] [b:23fkesmw]Save music on ini file [/b:23fkesmw] [b:23fkesmw]Load music from inifile [/b:23fkesmw] ( it play the music but the keys not are light) [b:23fkesmw]From menu you can create a new song file or load one saved!!!!![/b:23fkesmw]
click a area of Tpanel control ( Creating a Piano)
a Demo song to try with new sources Save with :[b:230slutu] Birthday.ini [/b:230slutu] [code=fw:230slutu]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #000000;">&#91;</span>Music<span style="color: #000000;">&#93;</span><br />Note=<span style="color: #000000;">42</span><br /><span style="color: #000000;">1</span>=G2T1/<span style="color: #000000;">4</span><br /><span style="color: #000000;">2</span>=G2T1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">3</span>=A2T1/<span style="color: #000000;">4</span><br /><span style="color: #000000;">4</span>=PT1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">5</span>=G2T1/<span style="color: #000000;">4</span><br /><span style="color: #000000;">6</span>=PT1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">7</span>=C3T1/<span style="color: #000000;">4</span><br /><span style="color: #000000;">8</span>=PT1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">9</span>=H2T1/<span style="color: #000000;">4</span><br /><span style="color: #000000;">10</span>=PT1/<span style="color: #000000;">2</span><br /><span style="color: #000000;">11</span>=G2T1/<span style="color: #000000;">4</span><br /><span style="color: #000000;">12</span>=G2T1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">13</span>=A2T1/<span style="color: #000000;">4</span><br /><span style="color: #000000;">14</span>=PT1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">15</span>=G2T1/<span style="color: #000000;">4</span><br /><span style="color: #000000;">16</span>=PT1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">17</span>=D3T1/<span style="color: #000000;">4</span><br /><span style="color: #000000;">18</span>=PT1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">19</span>=C3T1/<span style="color: #000000;">4</span><br /><span style="color: #000000;">20</span>=PT1/<span style="color: #000000;">2</span><br /><span style="color: #000000;">21</span>=G2T1/<span style="color: #000000;">4</span><br /><span style="color: #000000;">22</span>=G2T1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">23</span>=G3T1/<span style="color: #000000;">4</span> &nbsp; <br /><span style="color: #000000;">24</span>=PT1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">25</span>=E3T1/<span style="color: #000000;">4</span> &nbsp; <br /><span style="color: #000000;">26</span>=PT1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">27</span>=C3T1/<span style="color: #000000;">4</span> &nbsp; <br /><span style="color: #000000;">28</span>=C3T1/<span style="color: #000000;">8</span> &nbsp; &nbsp;<br /><span style="color: #000000;">29</span>=H2T1/<span style="color: #000000;">4</span><br /><span style="color: #000000;">30</span>=PT1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">31</span>=A2T1/<span style="color: #000000;">4</span><br /><span style="color: #000000;">32</span>=PT1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">33</span>=F3T1/<span style="color: #000000;">4</span> &nbsp; <br /><span style="color: #000000;">34</span>=F3T1/<span style="color: #000000;">8</span> &nbsp; <br /><span style="color: #000000;">35</span>=E3T1/<span style="color: #000000;">4</span> &nbsp; <br /><span style="color: #000000;">36</span>=PT1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">37</span>=C3T1/<span style="color: #000000;">4</span> &nbsp; <br /><span style="color: #000000;">38</span>=PT1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">39</span>=D3T1/<span style="color: #000000;">4</span> &nbsp; <br /><span style="color: #000000;">40</span>=PT1/<span style="color: #000000;">8</span><br /><span style="color: #000000;">41</span>=C3T1/<span style="color: #000000;">4</span> &nbsp; <br /><span style="color: #000000;">42</span>=PT1/<span style="color: #000000;">2</span><br />&nbsp;</div>[/code:230slutu]
click derecho en area de notificación
Hola a todos, me gustaría saber si alguien conoce la manera de hacer click derecho sobre un icono en el área de notificación. Me explico: tengo un programa que se comparte entre varias personas a través de una cuenta de google drive, cuando el programa arranca se descargan los ficheros y el programa espera a que todos los ficheros que se necesitan se descarguen correctamente, esto lo hace drive solito. Al acabar me gustaría que antes des salir se mostrara el proceso de sincronizacion de cambios de los archivos haciendo click derecho sobre el icono de drive en el área de notificación, pero no sé cómo hacer esto. Saludos,
click derecho en area de notificación
Do you mean this? [code=fw:2c7qarnv]<div class="fw" id="{CB}" style="font-family: monospace;"> &nbsp; <span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> oWnd, oIcon, cTip, uLClick, uRClick, uMMoved, uLDblClick, uLButtonUp,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;uRButtonUp <span style="color: #000000;">&#41;</span> CONSTRUCTOR</div>[/code:2c7qarnv] Please look at the fifth parameter (uRClick). EMG
click derecho en area de notificación
No, I mean right-click on the Google Drive icon and show the pop-ip window. Regards, [img:2yv0t1m6]http&#58;//alanit&#46;com/wp-content/uploads/2022/05/Captura-de-pantalla-2022-05-31-195308&#46;png[/img:2yv0t1m6]
click derecho en area de notificación
Sorry, I don't understand. EMG
click derecho en area de notificación
Estimado Jose Luis, Aqui tienes detallado el proceso para hacerlo: [url:30p3zv3u]https&#58;//stackoverflow&#46;com/questions/21335917/simulating-right-click-on-system-tray-icon-and-clicking-on-context-menu-in-c[/url:30p3zv3u]
click sobre tree con checkbox
Hola a Todos: Tengo un Treeview , quiero que haga algo al marcar el check y que se grabe o sea al almar de nuevo el tree debe estar marcado o marcados los que ya clickiee. Tengo el evento al darle click sobre la rama mas no sobre el checkbox. ¿Alguien ya ha resuelto esto? desde ya muchas gracias. atte Miguel Salas México
click sobre tree con checkbox
Miguel, Con ayuda del buen amigo William Morales, hace tiempo hice lo que necesitas, armar un tree y al seleccionar algunas opciones, estas se graben y despues cuando lo vuelvas a mostrar, salgan ya activas. Sin embargo, quiero comentarte algo : Cuando son muchas las opciones del tree y mandas un Expand, tarda unos 5-7 segundos para que salgan los datos. Hace poco actualize el xHarbour y me empezo a encimar los nombres de las opciones quedando totalmente ilegible, Por lo que opte por implementar el tree en un xBrowse y los resultados fueron muy satisfactorios : mucho mas rapido y sin problemas de pintado. Deja busco un respaldo del codigo por si te interesa. Saludos
click sobre tree con checkbox
te agradezco la respuesta y en espera de tu valiosa ayuda saludos
click sobre tree con checkbox
Miguel, [color=#FF0000:2fkngpe3]En alguna tabla o dbf debes tener uno o varios campos para guardar las claves de los items seleccionados, yo los separo usando ':'[/color:2fkngpe3] [code=fw:2fkngpe3]<div class="fw" id="{CB}" style="font-family: monospace;">oTree := TTreeView<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #0000ff;">ReDefine</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">101</span>, oCatUsrFldr:<span style="color: #000000;">aDialogs</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>, CLR_BLACK, CLR_WHITE, .f. ,<span style="color: #ff0000;">"RSTree"</span> <span style="color: #000000;">&#41;</span><br />oTree:<span style="color: #000000;">oFont</span> := aSysFnts<span style="color: #000000;">&#91;</span><span style="color: #000000;">9</span><span style="color: #000000;">&#93;</span></div>[/code:2fkngpe3] // Elementos del tree[code=fw:2fkngpe3]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #000000;">&#123;</span><span style="color: #ff0000;">'1101021'</span> ,<span style="color: #ff0000;">' Notas De Mostrador'</span>                                            ,<span style="color: #ff0000;">'K003'</span><span style="color: #000000;">&#125;</span>, ;<br /><span style="color: #000000;">&#123;</span><span style="color: #ff0000;">'1101022'</span> ,<span style="color: #ff0000;">' Facturas'</span>                                                      ,<span style="color: #ff0000;">'K004'</span><span style="color: #000000;">&#125;</span>, ;<br /><span style="color: #000000;">&#123;</span><span style="color: #ff0000;">'1101023'</span> ,<span style="color: #ff0000;">' Cotizaciones'</span>                                                  ,<span style="color: #ff0000;">'K005'</span><span style="color: #000000;">&#125;</span>, ;<br /><span style="color: #000000;">&#123;</span><span style="color: #ff0000;">'1101024'</span> ,<span style="color: #ff0000;">' Ventas Express'</span>                                                ,<span style="color: #ff0000;">'K006'</span><span style="color: #000000;">&#125;</span>, ;<br /><span style="color: #000000;">&#123;</span><span style="color: #ff0000;">'1101025'</span> ,<span style="color: #ff0000;">' Preventas/Pedidos'</span>                                             ,<span style="color: #ff0000;">'K007'</span><span style="color: #000000;">&#125;</span>, ;</div>[/code:2fkngpe3] // Obtener items seleccionados[code=fw:2fkngpe3]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> GetUOptsSld<span style="color: #000000;">&#40;</span> oTree, aItems <span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">local</span> n, nCargo<br /><br /><span style="color: #00C800;">for</span> n = <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> len<span style="color: #000000;">&#40;</span> aItems <span style="color: #000000;">&#41;</span><br />  <span style="color: #00C800;">if</span> oTree:<span style="color: #000000;">GetCheck</span><span style="color: #000000;">&#40;</span> aItems<span style="color: #000000;">&#91;</span>n<span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span><br />     nCargo := aItems<span style="color: #000000;">&#91;</span> n <span style="color: #000000;">&#93;</span>:<span style="color: #000000;">cargo</span><br />     <span style="color: #00C800;">if</span> ascan<span style="color: #000000;">&#40;</span> aUsrOptsSld, <span style="color: #000000;">&#123;</span>|n| n == nCargo<span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span> == <span style="color: #000000;">0</span><br />        aadd<span style="color: #000000;">&#40;</span> aUsrOptsSld, aItems<span style="color: #000000;">&#91;</span>n<span style="color: #000000;">&#93;</span>:<span style="color: #000000;">cargo</span> <span style="color: #000000;">&#41;</span>              <span style="color: #B900B9;">// Aqui guardo la clave de los items seleccionados : K003, K004, etc</span><br />     <span style="color: #00C800;">endif</span><br />  <span style="color: #00C800;">endif</span><br />  GetUOptsSld<span style="color: #000000;">&#40;</span> oTree, aItems<span style="color: #000000;">&#91;</span>n<span style="color: #000000;">&#93;</span>:<span style="color: #000000;">aItems</span> <span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">next</span><br />   <br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br />*-----*</div>[/code:2fkngpe3] // Actualizar items seleccionados[code=fw:2fkngpe3]<div class="fw" id="{CB}" style="font-family: monospace;"><br />aOpts2Apl := HB_ATokens<span style="color: #000000;">&#40;</span> aDmXDts<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span>,<span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>, <span style="color: #ff0000;">":"</span>, .f., .f. <span style="color: #000000;">&#41;</span><br /><br />SrcOptsValues<span style="color: #000000;">&#40;</span> oTree, aItems, aOpts2Apl <span style="color: #000000;">&#41;</span><br />oTree:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> SrcOptsValues<span style="color: #000000;">&#40;</span> oTree, aItems, aOptsGrntd <span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">local</span> nQ<br /><br /><span style="color: #00C800;">for</span> nQ := <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> len<span style="color: #000000;">&#40;</span> aItems <span style="color: #000000;">&#41;</span><br />    oTree:<span style="color: #000000;">SetCheck</span><span style="color: #000000;">&#40;</span> aItems<span style="color: #000000;">&#91;</span>nQ<span style="color: #000000;">&#93;</span>, .f. <span style="color: #000000;">&#41;</span><br />    <span style="color: #00C800;">if</span> ascan<span style="color: #000000;">&#40;</span> aOptsGrntd, aItems<span style="color: #000000;">&#91;</span>nQ<span style="color: #000000;">&#93;</span>:<span style="color: #000000;">cargo</span> <span style="color: #000000;">&#41;</span> > <span style="color: #000000;">0</span><br />        oTree:<span style="color: #000000;">SetCheck</span><span style="color: #000000;">&#40;</span> aItems<span style="color: #000000;">&#91;</span>nQ<span style="color: #000000;">&#93;</span>, .t. <span style="color: #000000;">&#41;</span><br />    <span style="color: #00C800;">endif</span><br />    SrcOptsValues<span style="color: #000000;">&#40;</span> oTree, aItems<span style="color: #000000;">&#91;</span>nQ<span style="color: #000000;">&#93;</span>:<span style="color: #000000;">aItems</span>, aOptsGrntd <span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">next</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br />*-----*</div>[/code:2fkngpe3] Cualquier dudad estamos a la orden. Saludos
click sobre tree con checkbox
Te agradezco infinitamente Raymundo... dejame probarlo y te comento
click sobre tree con checkbox
unas dudas,: 1- No veo en el codigo que uses la funcion "GetUOptsSld" (solo dentro de si misma ¿?) 2- El array aDmXDts ¿con que lo llenas? 3.- SrcOptsValues() la llamas al llenar el Tree? como ves ando perdido en esto saludos
click sobre tree con checkbox
Miguel, 1- No veo en el codigo que uses la funcion "GetUOptsSld" (solo dentro de si misma ¿?) [code=fw:2g2evi2x]<div class="fw" id="{CB}" style="font-family: monospace;">Cuando termino de seleccionar las opciones deseadas, mando llamar esta funcion para que recorra el tree y mando a un a un arreglo el cargo del elemento, que en este caso es la clave de la opcion. Y son las que se van a grabar en un campo.</div>[/code:2g2evi2x] 2- El array aDmXDts ¿con que lo llenas? [code=fw:2g2evi2x]<div class="fw" id="{CB}" style="font-family: monospace;">En mi caso, lo lleno desde un query del campo donde grabe las opciones previamente seleccionadas y grabadas, asi que, primero armas tu tree con tus opciones y enseguida le indicas cuales fueron seleccionadas previamente para que se muestren con tal atributo.</div>[/code:2g2evi2x] 3.- SrcOptsValues() la llamas al llenar el Tree? [code=fw:2g2evi2x]<div class="fw" id="{CB}" style="font-family: monospace;">Igual al punto anterior, se arma el tree, y despues le aplicas las opciones seleccionadas previamente.</div>[/code:2g2evi2x] Y sip, en efecto, las funciones SrcOptsValues() y GetUOptsSld() se llaman recursivamente para recorrer todos los branches del tree. ya tienes la rutina para armar tu tree ? ya que ahi es donde esta el asunto para armar los "niveles" de tu tree. Saludos
click sobre tree con checkbox
Amigo Raymundo, tiene un ejemplo mas didactico con array Saludos
clickable image
Hello, I have a window with 4 tabs. On tab 3 I want to show 1 to 10 images (depending on how much images I have) and when I click on that image I want to show it in a new window on real size. I have looked in the examples, but not all of them are working correctly. The example testsimage gives errors while compiling. For now I use the ON WINDOW CLICK command, but when tab 4 is active I get to see the result of tab 3. Is there a function that I can check which tab is active/shown, or is there a way to make the image clickable. Also I want to determine the size of the image to show in the new window, so I can make the window as big as the image. How can I find the sizes of the image? [code=fw:zukxn7oj]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Detailscherm"</span> + STR<span style="color: #000000;">&#40;</span>nPlantnum<span style="color: #000000;">&#41;</span> ;<br />    <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">500</span>, <span style="color: #000000;">720</span><br /><br />    @ <span style="color: #000000;">450</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">GET</span> oGetNaam <span style="color: #0000ff;">VAR</span> cLatijnNaam <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">700</span>, <span style="color: #000000;">40</span><br />    <br />    oGetNaam:<span style="color: #000000;">SetFont</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Geneva"</span>, <span style="color: #000000;">24</span> <span style="color: #000000;">&#41;</span><br />    oGetNaam:<span style="color: #000000;">SetColor</span><span style="color: #000000;">&#40;</span> OwnClrGreen, OwnClrYellow <span style="color: #000000;">&#41;</span><br />    <br />    @ <span style="color: #000000;">40</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">FOLDER</span> oFld <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">700</span>, <span style="color: #000000;">400</span> <span style="color: #0000ff;">OF</span> oDlg ;<br />        PAGES <span style="color: #ff0000;">"Gegevens"</span>, <span style="color: #ff0000;">"Kenmerken"</span>, <span style="color: #ff0000;">"Fotos"</span>, <span style="color: #ff0000;">"Combinaties"</span> ;<br />            <br />*first tabblad, gegevens<br />    @ <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> BROWSE oBrw1 FIELDS <span style="color: #ff0000;">""</span>, <span style="color: #ff0000;">""</span> ;<br />        HEADERS <span style="color: #ff0000;">""</span>, <span style="color: #ff0000;">""</span> ;<br />        <span style="color: #0000ff;">OF</span> oFld:<span style="color: #000000;">aControls</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">680</span>, <span style="color: #000000;">350</span><br /><br />    oBrw1:<span style="color: #000000;">SetArray</span><span style="color: #000000;">&#40;</span> aGegevens <span style="color: #000000;">&#41;</span><br />    oBrw1:<span style="color: #000000;">bLine</span> = <span style="color: #000000;">&#123;</span> | nRow | <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> nRow <= Len<span style="color: #000000;">&#40;</span> aGegevens <span style="color: #000000;">&#41;</span>, aGegevens<span style="color: #000000;">&#91;</span> nRow <span style="color: #000000;">&#93;</span>, <span style="color: #000000;">&#123;</span> <span style="color: #ff0000;">""</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />    oBrw1:<span style="color: #000000;">SetColWidth</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">150</span> <span style="color: #000000;">&#41;</span><br />    oBrw1:<span style="color: #000000;">SetColWidth</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">2</span>, <span style="color: #000000;">500</span> <span style="color: #000000;">&#41;</span><br />    oBrw1:<span style="color: #000000;">SetColor</span><span style="color: #000000;">&#40;</span> OwnClrGreen, OwnClrYellow <span style="color: #000000;">&#41;</span><br />    oBrw1:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />    <br />*second tabblad, kenmerken<br />    @ <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> BROWSE oBrw2 FIELDS <span style="color: #ff0000;">""</span>, <span style="color: #ff0000;">""</span> ;<br />        HEADERS <span style="color: #ff0000;">""</span>, <span style="color: #ff0000;">""</span> ;<br />        <span style="color: #0000ff;">OF</span> oFld:<span style="color: #000000;">aControls</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">680</span>, <span style="color: #000000;">350</span><br /><br />    oBrw2:<span style="color: #000000;">SetArray</span><span style="color: #000000;">&#40;</span> aKenmerken <span style="color: #000000;">&#41;</span><br />    oBrw2:<span style="color: #000000;">bLine</span> = <span style="color: #000000;">&#123;</span> | nRow | <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> nRow <= Len<span style="color: #000000;">&#40;</span> aKenmerken <span style="color: #000000;">&#41;</span>, aKenmerken<span style="color: #000000;">&#91;</span> nRow <span style="color: #000000;">&#93;</span>, <span style="color: #000000;">&#123;</span> <span style="color: #ff0000;">""</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />    oBrw2:<span style="color: #000000;">SetColWidth</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">150</span> <span style="color: #000000;">&#41;</span><br />    oBrw2:<span style="color: #000000;">SetColWidth</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">2</span>, <span style="color: #000000;">500</span> <span style="color: #000000;">&#41;</span><br />    oBrw2:<span style="color: #000000;">SetColor</span><span style="color: #000000;">&#40;</span> OwnClrGreen, OwnClrYellow <span style="color: #000000;">&#41;</span><br />    oBrw2:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />*third tabblad, foto<span style="color: #ff0000;">'s<br />    FOR r = 1 TO 3<br />        FOR k = 1 TO 5<br />            cImage := aFotoNaam[nFoto]<br />            IF FILE(cImage)<br />                @ nRow, nColumn IMAGE oImg FILENAME cImage OF oFld:aControls[ 3 ] SIZE 110, 110<br />            ENDIF<br />            nColumn := nColumn + 120<br />            nFoto++<br />        NEXT<br />        nColumn := 10<br />        nRow := nRow - 120<br />    NEXT<br /><br />*fourth tabblad, combinaties<br /><br />    @ 10, 10 BUTTON "OK" OF oDlg ACTION oDlg:End()<br />    <br />    <br />    <br />ACTIVATE DIALOG oDlg CENTERED;<br />ON CLICK RK_FotoGroot( nRow , nCol )[<br /><br />FUNCTION RK_FotoGroot(nRow, nCol)<br />*to show a big picture<br /><br />LOCAL nFoto := 1<br />LOCAL oWndFoto<br />LOCAL oFoto<br /><br />MsgInfo(STR(nTab))<br /><br />IF nRow < 400 .AND. nRow > 290<br />    IF nCol > 30 .AND. nCol < 140<br />        nFoto := 1<br />    ELSEIF nCol > 150 .AND. nCol < 260<br />        nFoto := 2<br />    ELSEIF nCol > 270 .AND. nCol < 380<br />        nFoto := 3<br />    ELSEIF nCol > 390 .AND. nCol < 500<br />        nFoto := 4<br />    ELSEIF nCol > 510 .AND. nCol < 620<br />        nFoto := 5<br />    ENDIF<br />ELSEIF nRow < 280 .AND. nrow > 170<br />    IF nCol > 30 .AND. nCol < 140<br />        nFoto := 6<br />    ELSEIF nCol > 150 .AND. nCol < 260<br />        nFoto := 7<br />    ELSEIF nCol > 270 .AND. nCol < 380<br />        nFoto := 8<br />    ELSEIF nCol > 390 .AND. nCol < 500<br />        nFoto := 9<br />    ELSEIF nCol > 510 .AND. nCol < 620<br />        nFoto := 10<br />    ENDIF<br />ELSEIF nRow < 160 .AND. nRow > 50<br />    IF nCol > 30 .AND. nCol < 140<br />        nFoto := 11<br />    ELSEIF nCol > 150 .AND. nCol < 260<br />        nFoto := 12<br />    ELSEIF nCol > 270 .AND. nCol < 380<br />        nFoto := 13<br />    ELSEIF nCol > 390 .AND. nCol < 500<br />        nFoto := 14<br />    ELSEIF nCol > 510 .AND. nCol < 620<br />        nFoto := 15<br />    ENDIF<br />ENDIF<br /><br />IF FILE(aFotoNaam[nFoto])<br /><br />    DEFINE DIALOG oWndFoto TITLE "grote foto" ;<br />        FROM 0, 0 TO 800, 1000<br />        <br />        @ 10, 10 IMAGE oFoto FILENAME aFotoNaam[nFoto] OF oWndFoto SIZE 710, 950<br />        <br />    ACTIVATE DIALOG oWndFoto<br />    <br />ENDIF<br /><br />RETURN NIL</span></div>[/code:zukxn7oj]
clickable image
Rene, > Is there a function that I can check which tab is active/shown oTabs:nTab > is there a way to make the image clickable oImage:bLButtonUp = { | nRow, nCol | ImageClick() } > How can I find the sizes of the image? oImage:nWidth and oImage:nHeight
clickable image
Rene, This is not working yet: oImage:bLButtonUp = { | nRow, nCol | ImageClick() } I am implementing it
clickable image
Rene, Already implemented. Here you have a working example: [code=fw:1a3dfg3u]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveMac.ch"</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> oWnd, oImg<br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">444</span>, <span style="color: #000000;">89</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">689</span>, <span style="color: #000000;">500</span><br />&nbsp; &nbsp;<br />&nbsp; &nbsp;oWnd:<span style="color: #0000ff;">center</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<br />&nbsp; &nbsp;@ <span style="color: #000000;">100</span>, <span style="color: #000000;">139</span> <span style="color: #0000ff;">IMAGE</span> oImg <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">107</span>, <span style="color: #000000;">91</span> FILENAME ImgPath<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"fivetech.gif"</span><br /><br />&nbsp; &nbsp;oImg:<span style="color: #000000;">bLButtonDown</span> = <span style="color: #000000;">&#123;</span> || <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> oImg:<span style="color: #000000;">nWidth</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp;@ <span style="color: #000000;">69</span>, <span style="color: #000000;">95</span> <span style="color: #0000ff;">SAY</span> <span style="color: #ff0000;">"(c) FiveTech Software 2007-2012"</span> <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">210</span>, <span style="color: #000000;">14</span><br />&nbsp; &nbsp;<br />&nbsp; &nbsp;@ <span style="color: #000000;">22</span>, <span style="color: #000000;">150</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Ok"</span> <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">ACTION</span> oWnd:<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: #000000;">22</span>, <span style="color: #000000;">250</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Frame"</span> <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> oImg:<span style="color: #000000;">nWidth</span> <span style="color: #000000;">&#41;</span>, oImg:<span style="color: #000000;">setFrame</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<br />&nbsp; &nbsp;<span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd<br />&nbsp; &nbsp;<br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span></div>[/code:1a3dfg3u] You can use bLButtonDown or LButtonUp, as you prefer. I have emailed you the new FiveMac libs already. Many thanks for your feedback
clickable image
Hello Antonio, Thanks for the reply and new libs. The oImg:bLButtonDown and the oTabs:nTab works perfect. Only the oImg:nWidth gives the width (and height) of the control, not the width of the real picture. I want to know the real sizes of the image. When i make an image size 110, 110 and place a picture of 640x480 px on it, the image is shown cropped on the image control. When I click on that control I want to make a window of nWidht+20 and nHeight+60 to show the picture.
clickable image
This seems to be the right way to get the image dimensions: [code=fw:fcjkeuvp]<div class="fw" id="{CB}" style="font-family: monospace;">NSImageRep *rep = <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#91;</span><span style="color: #0000ff;">image</span> representations<span style="color: #000000;">&#93;</span> objectAtIndex:<span style="color: #000000;">0</span><span style="color: #000000;">&#93;</span>;<br />NSSize imageSize = NSMakeSize<span style="color: #000000;">&#40;</span>rep.pixelsWide, rep.pixelsHigh<span style="color: #000000;">&#41;</span>;</div>[/code:fcjkeuvp] [url:fcjkeuvp]http&#58;//stackoverflow&#46;com/questions/11876963/get-the-correct-image-width-and-height-of-an-nsimage[/url:fcjkeuvp] I am going to test it
clickable image
Rene, Already implemented and working fine. I have sent you the modifed libs already. Simply do: MsgInfo( oImage:GetWidth() ) and MsgInfo( oImage:GetHeight() ) many thanks for your feedback
clickable image
Hello Antonio, The nWidth and nHeight gives the sizes of the defined object, not of the picture. I have a picture of 480 px height and 640 px width. When I place this on my BigPhoto window the sizes given are the sizes I have dementioned. See code: [code=fw:10n5nz75]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">FUNCTION</span> RK_BigPhoto<span style="color: #000000;">&#40;</span>cImage<span style="color: #000000;">&#41;</span><br />*<span style="color: #0000ff;">to</span> show a big <span style="color: #0000ff;">picture</span><br />*the cImage is 480x640 px<br /><span style="color: #00C800;">LOCAL</span> oWndFoto<br /><span style="color: #00C800;">LOCAL</span> oFoto<br /><br />    <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oWndFoto <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"big picture"</span> ;<br />        <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">800</span>, <span style="color: #000000;">1000</span><br />        <br />        @ <span style="color: #000000;">30</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">IMAGE</span> oFoto FILENAME cImage <span style="color: #0000ff;">OF</span> oWndFoto <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">710</span>, <span style="color: #000000;">950</span><br />                oFoto:<span style="color: #000000;">bLButtonDown</span> = <span style="color: #000000;">&#123;</span> || <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> oFoto:<span style="color: #000000;">nWidth</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br /><br />        @ <span style="color: #000000;">10</span>, <span style="color: #000000;">250</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Frame"</span> <span style="color: #0000ff;">OF</span> oWndFoto <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> oFoto:<span style="color: #000000;">nHeight</span> <span style="color: #000000;">&#41;</span>, oFoto:<span style="color: #000000;">setFrame</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />        <br />    <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oWndFoto<br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:10n5nz75] Now when I click on the oFoto the width 710 is given( picture is 640 px, when I click on the button the height 950 is given picture is 480px Can I do this another way?
clickable image
Rene, You have to use oFoto:GetWidth() and oFoto:GetHeight()
clickable image
Hello Antonio, Sorry, yes that was the trick. I was forgotten to put the newest lib in the lib-folder. thats why I got an error. I have to work more exact. Tomorrow I will put my newest code on Git, so you can see the progress.
clickable image
Rene, ok, thanks, I will pull and test it
clickable image
Hello Antonio, I have put the latest version on git I have put some comments in the source, so its easier to understand Rene
clickable image
Rene, I already reviewed it and I sent you an email
client RDP info
hi all, I need to know a unique value of the remote client from the server rdp. is possible? Thank you for your reponse.
client RDP info
Hello, What I do is to take the user name with which the user entered. [code=fw:1p9fohq8]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">Function</span> ListUsersTs<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">local</span> oLoc := CreateObject<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"wbemScripting.SwbemLocator"</span> <span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">local</span> oSrv := oLoc:<span style="color: #000000;">ConnectServer</span><span style="color: #000000;">&#40;</span>,<span style="color: #ff0000;">"root<span style="color: #000000;">\c</span>imv2"</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">local</span> aDat := oSrv:<span style="color: #000000;">ExecQuery</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"SELECT * FROM Win32_UserAccount"</span> <span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">Local</span> oDat<br /><span style="color: #00C800;">Local</span> aRet := <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">""</span><span style="color: #000000;">&#125;</span><br /><br />&nbsp;<span style="color: #00C800;">For</span> each oDat in aDat<br />&nbsp; AADD<span style="color: #000000;">&#40;</span>aRet, AllTrim<span style="color: #000000;">&#40;</span> Upper<span style="color: #000000;">&#40;</span> oDat:<span style="color: #0000ff;">Name</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp;<span style="color: #00C800;">Next</span><br /><br /><span style="color: #00C800;">Return</span><span style="color: #000000;">&#40;</span> aRet <span style="color: #000000;">&#41;</span></div>[/code:1p9fohq8]
client_multi_queries
I want to set option after my TMySqlServer(.....) connection is set to enable execution of multiple queries separated by ';' each. Please help.