topic
stringlengths
1
63
text
stringlengths
1
577k
A problem with GradientBrush()
Ok, thank you. EMG
A problem with GradientBrush()
Mr EMG >> One more problem. How can I get transparent controls (ie. the SAY in the following sample) and not transparent image control at the same time? >> Please try this modified code: [quote:164vnqec]#include "Fivewin.ch" FUNCTION MAIN() LOCAL oDlg, oBrush LOCAL cPath := 'c:\fwh\bitmaps\' // change to your path DEFINE BRUSH oBrush DEFINE DIALOG oDlg SIZE 240,200 PIXEL BRUSH oBrush TRANSPARENT @ 10, 10 SAY 'Say on Transparent Dialog' SIZE 100,10 PIXEL OF oDlg @ 25, 25 IMAGE FILE cPath + "select.bmp" SIZE 20,20 PIXEL NOBORDER ADJUST @ 50, 25 IMAGE FILE cPath + "AlphaBmp\ichat.bmp" SIZE 50,50 PIXEL NOBORDER ADJUST ACTIVATE DIALOG oDlg; ON INIT GRADIENTBRUSH( oDlg, { { 1, RGB( 216, 230, 238 ), RGB( 103, 154, 194 ) } } ); CENTER RELEASE BRUSH oBrush RETURN NIL [/quote:164vnqec] function GradientBrush will be the same as in the code posted by me already. Result: [url=http://img51.imageshack.us/my.php?image=grad2o.jpg:164vnqec][img:164vnqec]http://img51.imageshack.us/img51/6458/grad2o.jpg[/img:164vnqec][/url:164vnqec]
A problem with GradientBrush()
Enrico, Please try this example which provides a good understanding about how brushes reuse works. The problem with your examples is that you were modifying a brush that was already in use by the previous dialog. The solution is to end() its use and create a new one, so we don't interfere with the original one. [code=fw:sx8hmhcp]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Fivewin.ch"</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> MAIN<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #00C800;">LOCAL</span> oDlg<br /><br />    <span style="color: #00C800;">LOCAL</span> lVar := .F.<br /><br />    <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />           TRANSPARENT<br /><br />    @ <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Test"</span>;<br />           <span style="color: #0000ff;">ACTION</span> TEST<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />    @ <span style="color: #000000;">3</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">CHECKBOX</span> lVar<br /><br />    <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />             <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">1</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">216</span>, <span style="color: #000000;">230</span>, <span style="color: #000000;">238</span> <span style="color: #000000;">&#41;</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">103</span>, <span style="color: #000000;">154</span>, <span style="color: #000000;">194</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span>;<br />             <span style="color: #0000ff;">CENTER</span><br /><br />    oDlg:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />    <br />    <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">nCount</span> <span style="color: #000000;">&#41;</span>         <br />    <br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> TEST<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #00C800;">LOCAL</span> oDlg<br /><br />    <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />           TRANSPARENT<br /><br />    <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />             <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">1</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">216</span>, <span style="color: #000000;">230</span>, <span style="color: #000000;">238</span> <span style="color: #000000;">&#41;</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">103</span>, <span style="color: #000000;">154</span>, <span style="color: #000000;">194</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span>;<br />             <span style="color: #0000ff;">CENTER</span><br /><br />    oDlg:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />             <br />    <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">nCount</span> <span style="color: #000000;">&#41;</span>         <br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, aColors <span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #00C800;">LOCAL</span> hDC, hBmp, hBmpOld<br /><br />    hDC = CREATECOMPATIBLEDC<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">GetDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />    hBmp = CREATECOMPATIBLEBITMAP<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">hDC</span>, oDlg:<span style="color: #000000;">nWidth</span>, oDlg:<span style="color: #000000;">nHeight</span> <span style="color: #000000;">&#41;</span><br /><br />    hBmpOld = SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmp <span style="color: #000000;">&#41;</span><br /><br />    GRADIENTFILL<span style="color: #000000;">&#40;</span> hDC, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, oDlg:<span style="color: #000000;">nHeight</span>, oDlg:<span style="color: #000000;">nWidth</span>, aColors <span style="color: #000000;">&#41;</span><br /><br />    oDlg:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />    oDlg:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> TBrush<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> ,,,, hBmp <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />    AEval<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">aControls</span>, <span style="color: #000000;">&#123;</span> | o | o:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">oBrush</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br /><br />    SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmpOld <span style="color: #000000;">&#41;</span><br />    DELETEDC<span style="color: #000000;">&#40;</span> hDC <span style="color: #000000;">&#41;</span><br /><br />    oDlg:<span style="color: #000000;">ReleaseDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:sx8hmhcp]
A problem with GradientBrush()
In this example, lets asume that we want to use the same gradient colors for all our dialogs, so we can create just one brush and reuse it in all dialogs: [code=fw:152s7bot]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Fivewin.ch"</span><br /><br /><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; <span style="color: #00C800;">LOCAL</span> lVar := .F.<br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TRANSPARENT<br /><br />&nbsp; &nbsp; @ <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Test"</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ACTION</span> TEST<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">oBrush</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; @ <span style="color: #000000;">3</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">CHECKBOX</span> lVar<br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">1</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">216</span>, <span style="color: #000000;">230</span>, <span style="color: #000000;">238</span> <span style="color: #000000;">&#41;</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">103</span>, <span style="color: #000000;">154</span>, <span style="color: #000000;">194</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">CENTER</span><br /><br />&nbsp; &nbsp; oDlg:<span style="color: #000000;">oBrush</span>:<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: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">nCount</span> <span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; <br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> TEST<span style="color: #000000;">&#40;</span> oBrush <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">LOCAL</span> oDlg<br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> oBrush:<span style="color: #000000;">nCount</span> <span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; <br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TRANSPARENT <span style="color: #0000ff;">BRUSH</span> oBrush<br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">CENTER</span><br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">nCount</span> <span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; <br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, aColors <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">LOCAL</span> hDC, hBmp, hBmpOld<br /><br />&nbsp; &nbsp; hDC = CREATECOMPATIBLEDC<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">GetDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; hBmp = CREATECOMPATIBLEBITMAP<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">hDC</span>, oDlg:<span style="color: #000000;">nWidth</span>, oDlg:<span style="color: #000000;">nHeight</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; hBmpOld = SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmp <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; GRADIENTFILL<span style="color: #000000;">&#40;</span> hDC, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, oDlg:<span style="color: #000000;">nHeight</span>, oDlg:<span style="color: #000000;">nWidth</span>, aColors <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oDlg:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; oDlg:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> TBrush<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> ,,,, hBmp <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; AEval<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">aControls</span>, <span style="color: #000000;">&#123;</span> | o | o:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">oBrush</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmpOld <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; DELETEDC<span style="color: #000000;">&#40;</span> hDC <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oDlg:<span style="color: #000000;">ReleaseDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br />&nbsp;</div>[/code:152s7bot]
A problem with GradientBrush()
[quote="Antonio Linares":yokz9bqq][code=fw:yokz9bqq]<div class="fw" id="{CB}" style="font-family: monospace;">oDlg:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />oDlg:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> TBrush<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> ,,,, hBmp <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span></div>[/code:yokz9bqq][/quote:yokz9bqq] If I understand correctly, SetBrush() method already ends the previous brush, if assigned: [code=fw:yokz9bqq]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">METHOD</span> SetBrush<span style="color: #000000;">&#40;</span> oBrush <span style="color: #000000;">&#41;</span> <span style="color: #00C800;">INLINE</span> <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> ::<span style="color: #000000;">oBrush</span> != <span style="color: #00C800;">nil</span>, ::<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,<span style="color: #000000;">&#41;</span>,;</div>[/code:yokz9bqq] EMG
A problem with GradientBrush()
[quote="Antonio Linares":3fkes72q][code=fw:3fkes72q]<div class="fw" id="{CB}" style="font-family: monospace;">oDlg:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">nCount</span> <span style="color: #000000;">&#41;</span></div>[/code:3fkes72q][/quote:3fkes72q] Why we need to explicitly release the brush? The dialog already release it on close. But if this is true then I don't understand why the message shows 1 if I comment out the first line... ? EMG
A problem with GradientBrush()
Enrico, We need to explicity release it because we have created a new brush. It is not the original brush that was created by FWH. We have created a new one so we have to End() it. Keep in mind that End()s simply decrease the use counter and if it reaches zero, then it is finally destroyed calling DeleteObject(). This way we can share the same brush to be used from different controls, dialogs, windows.
A problem with GradientBrush()
Ok. And what do you say about [code=fw:37g4cvg0]<div class="fw" id="{CB}" style="font-family: monospace;">oDlg:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />oDlg:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> TBrush<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> ,,,, hBmp <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span></div>[/code:37g4cvg0] Do we need to release the brush here? EMG
A problem with GradientBrush()
>> oDlg:SetBrush( TBrush():New( ,,,, hBmp ) ) >> TBrush():new() creates a brush object and sets the count to 1. oWnd/oDlg:SetBrush( oBrush ) increments count to 2. When the window/dialog is closed, the count of oBrush is decremented to 1. The program that first creates the brush is responsible to finally release the brush. In the above usage the brush is never released. Therefore it is not desirable to create brush inline while setting brush. What is to be done is : Create brush ( count : 1 ) setbrush --> count 2 close window --> count 1 brush:end --> count 0 and released Examining the code for SetBrush makes it clear: [code=fw:2j6bc6nr]<div class="fw" id="{CB}" style="font-family: monospace;"> &nbsp; <span style="color: #00C800;">METHOD</span> SetBrush<span style="color: #000000;">&#40;</span> oBrush <span style="color: #000000;">&#41;</span> <span style="color: #00C800;">INLINE</span> <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> ::<span style="color: #000000;">oBrush</span> != <span style="color: #00C800;">nil</span>, ::<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,<span style="color: #000000;">&#41;</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ::<span style="color: #000000;">oBrush</span> := oBrush,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> oBrush:<span style="color: #000000;">nCount</span> == <span style="color: #00C800;">nil</span>, oBrush:<span style="color: #000000;">nCount</span> := <span style="color: #000000;">1</span>, oBrush:<span style="color: #000000;">nCount</span>++<span style="color: #000000;">&#41;</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ::<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:2j6bc6nr]
A problem with GradientBrush()
Ok, thank you. Maybe it's slightly unexpected that SetBrush() increments the brush counter, isn't it? EMG
A problem with GradientBrush()
Enrico, Method SetBrush() has to increase the counter. Thats its main utility <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> We need to increase it when it is assigned to a new object, that will use it, and it will be automatically decreased from Method Destroy() when the container object is destroyed. Its the same technique that Windows uses internally with LoadLibrary() and FreeLibrary(). It uses counters, to know how many "users" a library has, and only when there is just one which calls FreeLibrary() again, then the library will be really freed.
A problem with GradientBrush()
>> Ok, thank you. Maybe it's slightly unexpected that SetBrush() increments the brush counter, isn't it? >> This is Mr. Antonio's well thought of ingenious way of reusing resources like fonts, brushes, etc. Once we understand the architecture, we know what to do. Simple rule we are asked to remember is that (1) we create font / brush (2) use them anywhere in any number of windows and / or inherited classes and finally (3) release the fonts/brushes we created "after" closing all windows/inherited classes.
A problem with GradientBrush()
Dear Rao, We learned this technique from Windows itself. It does it the same way <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
A problem with GradientBrush()
Maybe it's a matter of naming. One doesn't expect that a method called SetBrush() creates a brush but merely assigns an existing one. So, why does it have to increase the brush counter as if it's creating one? EMG
A problem with GradientBrush()
Enrico, The counter is not to count the created brushes. The counter counts the number of users <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> When you assign a brush to an object, the number of users of the brush increases.
A problem with GradientBrush()
Mr Antonio Let me put Mr. Enrico's question in a different way. If the programmer creates a brush/font and uses it in as many windows ( and derivatives ) as he wants and releases the brush/font after all such windows are closed by him, there is no harm even if the FWH library does not keep count of the number of users of the resource. Application still works fine. Only thing is the user should not release the resource while it is still being used by a window ( or derivative ). Whats wrong with it? I do agree that the present system of incrementing and decrementing the number of windows using the resource has some additional benefits. For example: CREATE BRUSH oBrush FILE cFile // nCount is 1 CREATE WINDOW oWnd BRUSH oBrush // nCount is 2 RELEASE BRUSH oBrush // nCount is 1 and so hBrush is not destroyed ACTIVATE WINDOW ownd // here nCount becomes zero and the hBrush is released return nil Even this code works well with the present implementation.
A problem with GradientBrush()
[quote="Antonio Linares":3gas9qqu]Enrico, The counter is not to count the created brushes. The counter counts the number of users <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> When you assign a brush to an object, the number of users of the brush increases.[/quote:3gas9qqu] Ok, it is the well known "reference counting" technique. But this still not explains why we have to explicitly release the old brush: [code=fw:3gas9qqu]<div class="fw" id="{CB}" style="font-family: monospace;">oDlg:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />oDlg:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> TBrush<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> ,,,, hBmp <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span></div>[/code:3gas9qqu] SetBrush() method already releases the old brush and increments the counter of the new brush. Or am I still missing something? EMG
A problem with GradientBrush()
Enrico, You are right, Method SetBrush() already End()s (and decreases) the previous used brush counter, so there is no need to call oBrush:End() as I have done in my examle <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
A problem with GradientBrush()
Ok, please review this revised version: [code=fw:3em5yudx]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Fivewin.ch"</span><br /><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; <span style="color: #00C800;">LOCAL</span> lVar := .F.<br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TRANSPARENT<br /><br />&nbsp; &nbsp; @ <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Test"</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ACTION</span> TEST<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; @ <span style="color: #000000;">3</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">CHECKBOX</span> lVar<br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">1</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">216</span>, <span style="color: #000000;">230</span>, <span style="color: #000000;">238</span> <span style="color: #000000;">&#41;</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">103</span>, <span style="color: #000000;">154</span>, <span style="color: #000000;">194</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">CENTER</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, aColors <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">LOCAL</span> hDC, hBmp, hBmpOld, oBrush<br /><br />&nbsp; &nbsp; hDC = CREATECOMPATIBLEDC<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">GetDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; hBmp = CREATECOMPATIBLEBITMAP<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">hDC</span>, oDlg:<span style="color: #000000;">nWidth</span>, oDlg:<span style="color: #000000;">nHeight</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; hBmpOld = SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmp <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; GRADIENTFILL<span style="color: #000000;">&#40;</span> hDC, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, oDlg:<span style="color: #000000;">nHeight</span>, oDlg:<span style="color: #000000;">nWidth</span>, aColors <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oBrush = TBrush<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> ,,,, hBmp <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oDlg:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> oBrush <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; AEval<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">aControls</span>, <span style="color: #000000;">&#123;</span> | o | o:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">oBrush</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">BRUSH</span> oBrush<br /><br />&nbsp; &nbsp; SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmpOld <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; DELETEDC<span style="color: #000000;">&#40;</span> hDC <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oDlg:<span style="color: #000000;">ReleaseDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span></div>[/code:3em5yudx] EMG
A problem with GradientBrush()
Enrico, It seems as the source code for function Test() is missing in your example
A problem with GradientBrush()
Ok, this is even better: [code=fw:3bg9gi9a]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Fivewin.ch"</span><br /><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; <span style="color: #00C800;">LOCAL</span> lVar := .F.<br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TRANSPARENT<br /><br />&nbsp; &nbsp; @ <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Test"</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ACTION</span> TEST<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; @ <span style="color: #000000;">3</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">CHECKBOX</span> lVar<br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">1</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">216</span>, <span style="color: #000000;">230</span>, <span style="color: #000000;">238</span> <span style="color: #000000;">&#41;</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">103</span>, <span style="color: #000000;">154</span>, <span style="color: #000000;">194</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">CENTER</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> TEST<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; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TRANSPARENT<br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">1</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">216</span>, <span style="color: #000000;">230</span>, <span style="color: #000000;">238</span> <span style="color: #000000;">&#41;</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">103</span>, <span style="color: #000000;">154</span>, <span style="color: #000000;">194</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">CENTER</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, aColors <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">LOCAL</span> hDC, hBmp, hBmpOld, oBrush<br /><br />&nbsp; &nbsp; hDC = CREATECOMPATIBLEDC<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">GetDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; hBmp = CREATECOMPATIBLEBITMAP<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">hDC</span>, oDlg:<span style="color: #000000;">nWidth</span>, oDlg:<span style="color: #000000;">nHeight</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; hBmpOld = SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmp <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; GRADIENTFILL<span style="color: #000000;">&#40;</span> hDC, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, oDlg:<span style="color: #000000;">nHeight</span>, oDlg:<span style="color: #000000;">nWidth</span>, aColors <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oBrush = TBrush<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> ,,,, hBmp <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oDlg:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> oBrush <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; AEVAL<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">aControls</span>, <span style="color: #000000;">&#123;</span> | oCtl | <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> oCtl:<span style="color: #000000;">lTransparent</span>, oCtl:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">oBrush</span> <span style="color: #000000;">&#41;</span>, <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">BRUSH</span> oBrush<br /><br />&nbsp; &nbsp; SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmpOld <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; DELETEDC<span style="color: #000000;">&#40;</span> hDC <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oDlg:<span style="color: #000000;">ReleaseDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span></div>[/code:3bg9gi9a] EMG
A problem with GradientBrush()
Now the image can be set to not-transparent: [code=fw:ugm9wee6]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Image.ch"</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> MAIN<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #00C800;">LOCAL</span> oDlg, oImg<br /><br />    <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />           TRANSPARENT<br /><br />    @ <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #0000ff;">SAY</span> <span style="color: #ff0000;">"This is a test"</span><br /><br />    @ <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">IMAGE</span> oImg;<br />           <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">50</span>, <span style="color: #000000;">50</span>;<br />           FILE <span style="color: #ff0000;">"e:<span style="color: #000000;">\f</span>wharbour<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\s</span>elect.bmp"</span>;<br />           NOBORDER <span style="color: #0000ff;">ADJUST</span><br /><br />    <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />             <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> <span style="color: #000000;">&#40;</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">1</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">216</span>, <span style="color: #000000;">230</span>, <span style="color: #000000;">238</span> <span style="color: #000000;">&#41;</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">103</span>, <span style="color: #000000;">154</span>, <span style="color: #000000;">194</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span>,;<br />                       oImg:<span style="color: #000000;">lTransparent</span> := .F. <span style="color: #000000;">&#41;</span>;<br />             <span style="color: #0000ff;">CENTER</span><br /><br />    <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, aColors <span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #00C800;">LOCAL</span> hDC, hBmp, hBmpOld, oBrush<br /><br />    hDC = CREATECOMPATIBLEDC<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">GetDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />    hBmp = CREATECOMPATIBLEBITMAP<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">hDC</span>, oDlg:<span style="color: #000000;">nWidth</span>, oDlg:<span style="color: #000000;">nHeight</span> <span style="color: #000000;">&#41;</span><br /><br />    hBmpOld = SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmp <span style="color: #000000;">&#41;</span><br /><br />    GRADIENTFILL<span style="color: #000000;">&#40;</span> hDC, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, oDlg:<span style="color: #000000;">nHeight</span>, oDlg:<span style="color: #000000;">nWidth</span>, aColors <span style="color: #000000;">&#41;</span><br /><br />    oBrush = TBrush<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> ,,,, hBmp <span style="color: #000000;">&#41;</span><br /><br />    oDlg:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> oBrush <span style="color: #000000;">&#41;</span><br /><br />    AEVAL<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">aControls</span>, <span style="color: #000000;">&#123;</span> | oCtl | <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> oCtl:<span style="color: #000000;">lTransparent</span>, oCtl:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">oBrush</span> <span style="color: #000000;">&#41;</span>, <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">BRUSH</span> oBrush<br /><br />    SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmpOld <span style="color: #000000;">&#41;</span><br /><br />    DELETEDC<span style="color: #000000;">&#40;</span> hDC <span style="color: #000000;">&#41;</span><br /><br />    oDlg:<span style="color: #000000;">ReleaseDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span></div>[/code:ugm9wee6] EMG
A problem with GradientBrush()
I don't understand. Please explain what your generalization is suppose to do. EMG
A problem with GradientBrush()
There is a problem in the bEraseBkGnd of TSay. The following sample doesn't show a colored SAY if the theme is activated: [code=fw:22zqgzva]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Image.ch"</span><br /><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, oSay<br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TRANSPARENT<br /><br />&nbsp; &nbsp; @ <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Test"</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> oSay:<span style="color: #000000;">SetColor</span><span style="color: #000000;">&#40;</span> , CLR_HGREEN <span style="color: #000000;">&#41;</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oSay:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; @ <span style="color: #000000;">3</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">SAY</span> oSay <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"This is a test"</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">COLOR</span> <span style="color: #00C800;">NIL</span>, CLR_HRED<br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> <span style="color: #000000;">&#40;</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">1</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">216</span>, <span style="color: #000000;">230</span>, <span style="color: #000000;">238</span> <span style="color: #000000;">&#41;</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">103</span>, <span style="color: #000000;">154</span>, <span style="color: #000000;">194</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oSay:<span style="color: #000000;">lTransparent</span> := .F.,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oSay:<span style="color: #000000;">SetColor</span><span style="color: #000000;">&#40;</span> , CLR_HRED <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">CENTER</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, aColors <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">LOCAL</span> hDC, hBmp, hBmpOld, oBrush<br /><br />&nbsp; &nbsp; hDC = CREATECOMPATIBLEDC<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">GetDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; hBmp = CREATECOMPATIBLEBITMAP<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">hDC</span>, oDlg:<span style="color: #000000;">nWidth</span>, oDlg:<span style="color: #000000;">nHeight</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; hBmpOld = SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmp <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; GRADIENTFILL<span style="color: #000000;">&#40;</span> hDC, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, oDlg:<span style="color: #000000;">nHeight</span>, oDlg:<span style="color: #000000;">nWidth</span>, aColors <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oBrush = TBrush<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> ,,,, hBmp <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oDlg:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> oBrush <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; AEVAL<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">aControls</span>, <span style="color: #000000;">&#123;</span> | oCtl | <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> oCtl:<span style="color: #000000;">lTransparent</span>, oCtl:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">oBrush</span> <span style="color: #000000;">&#41;</span>, <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">BRUSH</span> oBrush<br /><br />&nbsp; &nbsp; SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmpOld <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; DELETEDC<span style="color: #000000;">&#40;</span> hDC <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oDlg:<span style="color: #000000;">ReleaseDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span></div>[/code:22zqgzva] EMG
A problem with GradientBrush()
[quote:2g2uysit] AEVAL( oDlg:aControls, { | oCtl | If( oCtl:lTransparent, oCtl:SetBrush( oDlg:oBrush ), ) } ) [/quote:2g2uysit] Code given below is more generic [code=fw:2g2uysit]<div class="fw" id="{CB}" style="font-family: monospace;"> &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">if</span> ValType<span style="color: #000000;">&#40;</span> ::<span style="color: #000000;">oWnd</span>:<span style="color: #000000;">aControls</span> <span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">'A'</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">if</span> oWnd:<span style="color: #000000;">IsKindOf</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">'TDIALOG'</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> IsAppThemed<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AEval<span style="color: #000000;">&#40;</span> ::<span style="color: #000000;">oWnd</span>:<span style="color: #000000;">aControls</span>, <span style="color: #000000;">&#123;</span> |o| <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> o:<span style="color: #000000;">ClassName</span> $ <span style="color: #ff0000;">'TCHECKBOX'</span>, o:<span style="color: #000000;">oBrush</span> := <span style="color: #00C800;">Self</span>, <span style="color: #00C800;">nil</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">else</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AEval<span style="color: #000000;">&#40;</span> ::<span style="color: #000000;">oWnd</span>:<span style="color: #000000;">aControls</span>, <span style="color: #000000;">&#123;</span> |o| <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> o:<span style="color: #000000;">ClassName</span> $ <span style="color: #ff0000;">'TCHECKBOX,TRADIO'</span>, o:<span style="color: #000000;">oBrush</span> := <span style="color: #00C800;">Self</span>, <span style="color: #00C800;">nil</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">endif</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;elseif ownd:<span style="color: #000000;">ClassName</span> $ <span style="color: #ff0000;">'TWINDOW,TPANEL,TMDICHILD'</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AEval<span style="color: #000000;">&#40;</span> ::<span style="color: #000000;">oWnd</span>:<span style="color: #000000;">aControls</span>, <span style="color: #000000;">&#123;</span> |o| <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> o:<span style="color: #000000;">ClassName</span> $ <span style="color: #ff0000;">'TCHECKBOX,TRADIO,TSAY'</span>, o:<span style="color: #000000;">oBrush</span> := <span style="color: #00C800;">Self</span>, <span style="color: #00C800;">nil</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <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;">endif</span><br />&nbsp;</div>[/code:2g2uysit]
A problem with GradientBrush()
This is a possible fix: [code=fw:37utvfn2]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">METHOD</span> EraseBkGnd<span style="color: #000000;">&#40;</span> hDC <span style="color: #000000;">&#41;</span> <span style="color: #00C800;">CLASS</span> TSay <br /><br />&nbsp; &nbsp;<span style="color: #00C800;">DEFAULT</span> ::<span style="color: #000000;">lTransparent</span> := .f. <br /><br />&nbsp; &nbsp;<span style="color: #00C800;">if</span> ::<span style="color: #000000;">lTransparent</span> <br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">return</span> <span style="color: #000000;">1</span> <br />&nbsp; &nbsp;<span style="color: #00C800;">endif</span> <br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">Super</span>:<span style="color: #000000;">EraseBkGnd</span><span style="color: #000000;">&#40;</span> hDC <span style="color: #000000;">&#41;</span></div>[/code:37utvfn2] Antonio, please review. EMG
A problem with GradientBrush()
But that not fixes the initial color problem (ie. the COLOR clause doesn't work with themes activated). EMG
A problem with GradientBrush()
Enrico, Are those examples working fine for you ? Here they are working fine on both Windows 7 and XP.
A problem with GradientBrush()
Please try this sample. The SAY doesn't get the background color. When I click on the button it gets the background color (using XP): [code=fw:243altm3]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Fivewin.ch"</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> MAIN<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #00C800;">LOCAL</span> oDlg, oSay<br /><br />    <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />           TRANSPARENT<br /><br />    @ <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Test"</span>;<br />           <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> oSay:<span style="color: #000000;">SetColor</span><span style="color: #000000;">&#40;</span> CLR_HGREEN, CLR_HRED <span style="color: #000000;">&#41;</span>,;<br />                    oSay:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />    @ <span style="color: #000000;">3</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">SAY</span> oSay <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"This is a test"</span>;<br />           <span style="color: #0000ff;">COLOR</span> CLR_HGREEN, CLR_HRED<br /><br />    <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />             <span style="color: #0000ff;">CENTER</span><br /><br />    <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span></div>[/code:243altm3] EMG
A problem with GradientBrush()
Enrico, In my opinion it is a right behavior, I explain you why <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> clause TRANSPARENT on the dialog means that we want to use the "background" of the dialog, thats why the dialog overrides the SAY background color (the SAY brush is replaced). Later on, if you want to change it, then you can do it. But before, FWH changes all the backgrounds as the clause TRANSPARENT is instructing. We could change this behavior if we all decide to make it work on a different way <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
A problem with GradientBrush()
>In my opinion it is a right behavior I agree. Regards, James
A problem with GradientBrush()
Ok, I given up to use colored labels. EMG
A problem with GradientBrush()
Enrico, Well I would also like to see folders with colored tabs. [quote:2wfrs88m]clause TRANSPARENT on the dialog means that we want to use the "background" of the dialog, thats why the dialog overrides the SAY background color (the SAY brush is replaced).[/quote:2wfrs88m] Actually, I am not sure this is the best way. I have been saying for quite some time that I thought all contols should be transparent. That way they will always show the color of their parent (window, dialog, panel, folder, toolbar, or whatever). Setting the dialog to transparent seems backward. If the dialog was transparent then one would expect whatever is behind the dialog to show through--which is not what we want. I am guessing that what it does mean is that all the controls on the dialog are made transparent by the dialog. But, if the controls were all transparent by default, then this wouldn't be needed. Perhaps I am missing something. Regards, James
A problem with GradientBrush()
Enrico, [quote:1k07oo54]But that not fixes the initial color problem (ie. the COLOR clause doesn't work with themes activated).[/quote:1k07oo54] I'm not sure how this is supposed to work. Are themes supposed to override all defined colors in the application, or only certain colors? It does seem that it would be useful to be able to override certain colors when using themes. It does also seem that it could get complicated since you may want some colors defined when not using themes and defined by the theme when using themes. Or, you may want some colors always defined with or without themes. I guess you would need an isThemed() function to use when defining colors. Regards, James
A problem with GradientBrush()
Enrico, As far as I understand you, it seems as you want to have dialogs that use the clause TRANSPARENT but have SAYs with colored backgrounds (instead of using "transparent" ones). Is that what you mean ? thanks I guess we can easily implement it <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
A problem with GradientBrush()
[quote="Antonio Linares":2i3ldziu]Enrico, As far as I understand you, it seems as you want to have dialogs that use the clause TRANSPARENT but have SAYs with colored backgrounds (instead of using "transparent" ones). Is that what you mean ? thanks I guess we can easily implement it <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->[/quote:2i3ldziu] Exactly. Actually I need to make non-transparent only one or two controls in a dialog and the rest all transparent. That's why I wrote [code=fw:2i3ldziu]<div class="fw" id="{CB}" style="font-family: monospace;">AEVAL<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">aControls</span>, <span style="color: #000000;">&#123;</span> | oCtl | <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> oCtl:<span style="color: #000000;">lTransparent</span>, oCtl:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">oBrush</span> <span style="color: #000000;">&#41;</span>, <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span></div>[/code:2i3ldziu] that seems to work for TImage but not for TSay. EMG
A problem with GradientBrush()
The following sample seems to work at first but if you cover the dialog and then uncover it you will see that the colored background of the SAY is gone: [code=fw:25m9d214]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Fivewin.ch"</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> MAIN<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #00C800;">LOCAL</span> oDlg, oSay<br /><br />    <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />           TRANSPARENT<br /><br />    @ <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Test"</span>;<br />           <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> oSay:<span style="color: #000000;">SetColor</span><span style="color: #000000;">&#40;</span> CLR_HGREEN, CLR_HRED <span style="color: #000000;">&#41;</span>,;<br />                    oSay:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />    @ <span style="color: #000000;">3</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">SAY</span> oSay <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"This is a test"</span><br /><br />&nbsp; &nbsp; oSay:<span style="color: #000000;">lTransparent</span> = .F.<br /><br />    oDlg:<span style="color: #000000;">bStart</span> = <span style="color: #000000;">&#123;</span> || oSay:<span style="color: #000000;">SetColor</span><span style="color: #000000;">&#40;</span> CLR_HRED, CLR_HGREEN <span style="color: #000000;">&#41;</span>, oSay:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br /><br />    <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />             <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">1</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">216</span>, <span style="color: #000000;">230</span>, <span style="color: #000000;">238</span> <span style="color: #000000;">&#41;</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">103</span>, <span style="color: #000000;">154</span>, <span style="color: #000000;">194</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span>;<br />             <span style="color: #0000ff;">CENTER</span><br /><br />    <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, aColors <span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #00C800;">LOCAL</span> hDC, hBmp, hBmpOld, oBrush<br /><br />    hDC = CREATECOMPATIBLEDC<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">GetDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />    hBmp = CREATECOMPATIBLEBITMAP<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">hDC</span>, oDlg:<span style="color: #000000;">nWidth</span>, oDlg:<span style="color: #000000;">nHeight</span> <span style="color: #000000;">&#41;</span><br /><br />    hBmpOld = SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmp <span style="color: #000000;">&#41;</span><br /><br />    GRADIENTFILL<span style="color: #000000;">&#40;</span> hDC, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, oDlg:<span style="color: #000000;">nHeight</span>, oDlg:<span style="color: #000000;">nWidth</span>, aColors <span style="color: #000000;">&#41;</span><br /><br />    oBrush = TBrush<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> ,,,, hBmp <span style="color: #000000;">&#41;</span><br /><br />    oDlg:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> oBrush <span style="color: #000000;">&#41;</span><br /><br />    AEVAL<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">aControls</span>, <span style="color: #000000;">&#123;</span> | oCtl | <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> oCtl:<span style="color: #000000;">lTransparent</span>, oCtl:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">oBrush</span> <span style="color: #000000;">&#41;</span>, <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">BRUSH</span> oBrush<br /><br />    SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmpOld <span style="color: #000000;">&#41;</span><br /><br />    DELETEDC<span style="color: #000000;">&#40;</span> hDC <span style="color: #000000;">&#41;</span><br /><br />    oDlg:<span style="color: #000000;">ReleaseDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span></div>[/code:25m9d214] EMG
A problem with GradientBrush()
[code=fw:352u0or3]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Fivewin.ch"</span><br /><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, oSay<br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TRANSPARENT<br /><br /><span style="color: #B900B9;">// &nbsp; &nbsp;@ 1, 1 BUTTON "Test";</span><br /><span style="color: #B900B9;">// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ACTION ( oSay:SetColor( CLR_HGREEN, CLR_HRED ),;</span><br /><span style="color: #B900B9;">// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oSay:Refresh() )</span><br /><br />&nbsp; &nbsp; @ <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Test"</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">bPainted</span>:=<span style="color: #000000;">&#123;</span>|| oSay:<span style="color: #000000;">SetColor</span><span style="color: #000000;">&#40;</span> CLR_HGREEN, CLR_HRED <span style="color: #000000;">&#41;</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oSay:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span>, oDlg:<span style="color: #0000ff;">refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; @ <span style="color: #000000;">3</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">SAY</span> oSay <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"This is a test"</span><br /><br />&nbsp; &nbsp; oSay:<span style="color: #000000;">lTransparent</span> = .F.<br /><br />&nbsp; &nbsp; <span style="color: #B900B9;">//oDlg:bStart = { || oSay:SetColor( CLR_HRED, CLR_HGREEN ), oSay:Refresh() }</span><br /><br />&nbsp; &nbsp; oDlg:<span style="color: #000000;">bPainted</span> = <span style="color: #000000;">&#123;</span> || oSay:<span style="color: #000000;">SetColor</span><span style="color: #000000;">&#40;</span> CLR_HRED, CLR_HGREEN <span style="color: #000000;">&#41;</span>, oSay:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">1</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">216</span>, <span style="color: #000000;">230</span>, <span style="color: #000000;">238</span> <span style="color: #000000;">&#41;</span>, RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">103</span>, <span style="color: #000000;">154</span>, <span style="color: #000000;">194</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">CENTER</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> GRADIENTBRUSH<span style="color: #000000;">&#40;</span> oDlg, aColors <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">LOCAL</span> hDC, hBmp, hBmpOld, oBrush<br /><br />&nbsp; &nbsp; hDC = CREATECOMPATIBLEDC<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">GetDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; hBmp = CREATECOMPATIBLEBITMAP<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">hDC</span>, oDlg:<span style="color: #000000;">nWidth</span>, oDlg:<span style="color: #000000;">nHeight</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; hBmpOld = SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmp <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; GRADIENTFILL<span style="color: #000000;">&#40;</span> hDC, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, oDlg:<span style="color: #000000;">nHeight</span>, oDlg:<span style="color: #000000;">nWidth</span>, aColors <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oBrush = TBrush<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> ,,,, hBmp <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oDlg:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> oBrush <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; AEVAL<span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">aControls</span>, <span style="color: #000000;">&#123;</span> | oCtl | <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> oCtl:<span style="color: #000000;">lTransparent</span>, oCtl:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">&#40;</span> oDlg:<span style="color: #000000;">oBrush</span> <span style="color: #000000;">&#41;</span>, <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">BRUSH</span> oBrush<br /><br />&nbsp; &nbsp; SELECTOBJECT<span style="color: #000000;">&#40;</span> hDC, hBmpOld <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; DELETEDC<span style="color: #000000;">&#40;</span> hDC <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oDlg:<span style="color: #000000;">ReleaseDC</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span></div>[/code:352u0or3]
A problem with GradientBrush()
Thank you, James. EMG
A problem with SAY and font- style and < size default >
Hello, I noticed a SAY painting problem and needed the following adjustment : @ 26 * nFactor, 25 * nFactor SAY oDay PROMPT cDay OF oWnd FONT oFontDay PIXEL UPDATE oDay:SetColor ( aVal[23], ) oDay:lTransparent := .T. oDay:nLeft := ( oWnd:nWidth() - oDay:nWidth() ) / 2 [color=#0000FF:1x288g4q]oDay:nHeight += 5[/color:1x288g4q] // [size=150:1x288g4q]y[/size:1x288g4q] display ( I think it will be the same with [size=150:1x288g4q]g[/size:1x288g4q] and [size=150:1x288g4q]j[/size:1x288g4q] IF aVal[26] = .T. // [size=150:1x288g4q]Italic[/size:1x288g4q] [color=#0000FF:1x288g4q]oDay:nWidth += 8[/color:1x288g4q] // width itallic-font ENDIF [img:1x288g4q]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Fontsize10&#46;jpg[/img:1x288g4q]
A problem with SAY and font- style and < size default >
small sample?
A problem with SAY and font- style and < size default >
The same result creating a sample [size=150:e18orla0]the black titles and frames I got after the last Window 10 - update ( 2 days ago )[/size:e18orla0] <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( --> All titles are black now word, exel .... maybe possible to fix it <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: --> I did a monitor-reset but no luck still the same The black text changed to white now and the systembuttons are still painted black [img:e18orla0]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Testsay1&#46;jpg[/img:e18orla0] [b:e18orla0]the normal view before the windows-update ( see the difference ) [/b:e18orla0] today I got another update but no change [img:e18orla0]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Testsay2&#46;jpg[/img:e18orla0] FUNCTION MAIN() LOCAL oWnd, oTime, oDate, oDay LOCAL oFontTime, oFontDate, oFontDay cTime := SUBSTR( Time(), 1, 6) + "00" dDate := Date() cDay := cDow( Date() ) DEFINE FONT oTempTime NAME "Alpine" SIZE 0, -20 DEFINE FONT oTempDay NAME "Alpine" SIZE 0, -30 DEFINE FONT oTempDate NAME "Alpine" SIZE 0, -40 oFontTime := oTempTime:Modify( -30, .T., .T. ) oFontDay := oTempTime:Modify( -40, .T., .T. ) oFontDate := oTempTime:Modify( -50, .T., .T. ) // top, left TO height, width DEFINE WINDOW oWnd FROM 100, 100 TO 400, 400 PIXEL ; TITLE "ALARM" COLOR 0, 16777215 @ 30, 30 SAY oTime PROMPT cTime OF oWnd FONT oFontTime PIXEL UPDATE oTime:SetColor ( 255, ) oTime:lTransparent := .T. [color=#4000FF:e18orla0]oTime:nHeight += 5 oTime:nWidth += 5 // Italic[/color:e18orla0] oTime:nLeft := ( oWnd:nWidth() - oTime:nWidth() ) / 2 - 5 // centered @ 80, 30 SAY oDay PROMPT cDay OF oWnd FONT oFontDay PIXEL UPDATE oDay:SetColor ( 255, ) oDay:lTransparent := .T. [color=#0000FF:e18orla0]oDay:nHeight += 5 oDay:nWidth += 5[/color:e18orla0] oDay:nLeft := ( oWnd:nWidth() - oDay:nWidth() ) / 2 - 5 @ 140, 30 SAY oDate PROMPT dDate OF oWnd FONT oFontDate PIXEL UPDATE oDate:SetColor ( 255, ) oDate:lTransparent := .T. [color=#4000FF:e18orla0]oDate:nHeight += 5 oDate:nWidth += 5[/color:e18orla0] oDate:nLeft := ( oWnd:nWidth() - oDate:nWidth() ) / 2 - 5 ACTIVATE WINDOW oWnd RELEASE FONT oFontTime, oFontDay, oFontDate RETURN NIL The same without [color=#FF0080:e18orla0]oFontTime := oTempTime:Modify( -30, .T., .T. ) oFontDay := oTempTime:Modify( -40, .T., .T. ) oFontDate := oTempTime:Modify( -50, .T., .T. )[/color:e18orla0] using DEFINE FONT oFontTime NAME "Alpine" SIZE 0, -30 ITALIC DEFINE FONT oFontDay NAME "Alpine" SIZE 0, -40 ITALIC DEFINE FONT oFontDate NAME "Alpine" SIZE 0, -50 ITALIC [color=#0000FF:e18orla0][b:e18orla0]:Modify( [/b:e18orla0] [/color:e18orla0]is needed to change fonts at runtime regards Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
A problem with SAY and font- style and < size default >
Uwe, looks perfect. I did not find any errors. I did not understand. [code=fw:2rzzazvc]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #00C800;">STATIC</span> oWnd<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, oTime, oDate, oDay<br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> oFontTime, oFontDate, oFontDay, oTempTime, oTempDay, oTempDate<br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> cTime, dDate, cDay<br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// SET CENTURY ON</span><br />&nbsp; &nbsp;SET DATE BRITISH<br />&nbsp; &nbsp;SET TIME FORMAT <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"HH:MM:SS"</span><br />&nbsp; &nbsp;<span style="color: #B900B9;">// SET EPOCH TO YEAR( DATE() ) - 50</span><br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// cTime := SUBSTR( Time(), 1, 6 ) + "00" &nbsp;//???</span><br /><br />&nbsp; &nbsp;cTime := Time<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;dDate := Date<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;cDay := cDow<span style="color: #000000;">&#40;</span> Date<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oTempTime <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"Alpine"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>, - <span style="color: #000000;">20</span><br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oTempDay &nbsp;<span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"Alpine"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>, - <span style="color: #000000;">30</span><br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oTempDate <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"Alpine"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>, - <span style="color: #000000;">40</span><br /><br />&nbsp; &nbsp;oFontTime := oTempTime:<span style="color: #000000;">Modify</span><span style="color: #000000;">&#40;</span> - <span style="color: #000000;">30</span>, .T. , .T. <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oFontDay &nbsp;:= oTempTime:<span style="color: #000000;">Modify</span><span style="color: #000000;">&#40;</span> - <span style="color: #000000;">40</span>, .T. , .T. <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oFontDate := oTempTime:<span style="color: #000000;">Modify</span><span style="color: #000000;">&#40;</span> - <span style="color: #000000;">50</span>, .T. , .T. <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// top, left TO height, width</span><br />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">100</span>, <span style="color: #000000;">100</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">400</span>, <span style="color: #000000;">400</span> <span style="color: #0000ff;">PIXEL</span> ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"ALARM"</span> <span style="color: #0000ff;">COLOR</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">16777215</span><br /><br />&nbsp; &nbsp;@ <span style="color: #000000;">30</span>, <span style="color: #000000;">30</span> <span style="color: #0000ff;">SAY</span> oTime <span style="color: #0000ff;">PROMPT</span> cTime <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">120</span>, <span style="color: #000000;">40</span> <span style="color: #0000ff;">FONT</span> oFontTime <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">UPDATE</span><br /><br />&nbsp; &nbsp;oTime:<span style="color: #000000;">SetColor</span> <span style="color: #000000;">&#40;</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oTime:<span style="color: #000000;">lTransparent</span> := .T.<br />&nbsp; &nbsp;oTime:<span style="color: #000000;">nHeight</span> += <span style="color: #000000;">5</span><br />&nbsp; &nbsp;oTime:<span style="color: #000000;">nWidth</span> += <span style="color: #000000;">5</span> <span style="color: #B900B9;">// Italic</span><br />&nbsp; &nbsp;oTime:<span style="color: #000000;">nLeft</span> := <span style="color: #000000;">&#40;</span> oWnd:<span style="color: #000000;">nWidth</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> - oTime:<span style="color: #000000;">nWidth</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> / <span style="color: #000000;">2</span> - <span style="color: #000000;">5</span> <span style="color: #B900B9;">// centered</span><br /><br />&nbsp; &nbsp;@ <span style="color: #000000;">80</span>, <span style="color: #000000;">30</span> <span style="color: #0000ff;">SAY</span> oDay <span style="color: #0000ff;">PROMPT</span> cDay <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">198</span>, <span style="color: #000000;">50</span> <span style="color: #0000ff;">FONT</span> oFontDay <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">UPDATE</span><br /><br />&nbsp; &nbsp;oDay:<span style="color: #000000;">SetColor</span> <span style="color: #000000;">&#40;</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oDay:<span style="color: #000000;">lTransparent</span> := .T.<br />&nbsp; &nbsp;oDay:<span style="color: #000000;">nHeight</span> += <span style="color: #000000;">5</span><br />&nbsp; &nbsp;oDay:<span style="color: #000000;">nWidth</span> += <span style="color: #000000;">5</span><br />&nbsp; &nbsp;oDay:<span style="color: #000000;">nLeft</span> := <span style="color: #000000;">&#40;</span> oWnd:<span style="color: #000000;">nWidth</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> - oDay:<span style="color: #000000;">nWidth</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> / <span style="color: #000000;">2</span> - <span style="color: #000000;">5</span><br /><br />&nbsp; &nbsp;@ <span style="color: #000000;">140</span>, <span style="color: #000000;">30</span> <span style="color: #0000ff;">SAY</span> oDate <span style="color: #0000ff;">PROMPT</span> dDate <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">198</span>, <span style="color: #000000;">50</span> <span style="color: #0000ff;">FONT</span> oFontDate <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">UPDATE</span> ;<br /><br /><br />&nbsp; &nbsp;oDate:<span style="color: #000000;">SetColor</span> <span style="color: #000000;">&#40;</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oDate:<span style="color: #000000;">lTransparent</span> := .T.<br />&nbsp; &nbsp;oDate:<span style="color: #000000;">nHeight</span> += <span style="color: #000000;">5</span><br />&nbsp; &nbsp;oDate:<span style="color: #000000;">nWidth</span> += <span style="color: #000000;">5</span><br />&nbsp; &nbsp;oDate:<span style="color: #000000;">nLeft</span> := <span style="color: #000000;">&#40;</span> oWnd:<span style="color: #000000;">nWidth</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> - oDate:<span style="color: #000000;">nWidth</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> / <span style="color: #000000;">2</span> - <span style="color: #000000;">5</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd<br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFontTime, oFontDay, oFontDate<br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br />&nbsp;</div>[/code:2rzzazvc] Regards, saludos.
A problem with SAY and font- style and < size default >
Did You delete the marked lines for the width and height correction to make the problem visible ? You will see the difference without these lines and value -5 [color=#0000FF:26pcc2du]oTime:nHeight += 5 oTime:nWidth += 5 // Italic[/color:26pcc2du] oTime:nLeft := ( oWnd:nWidth() - oTime:nWidth() ) / 2 [color=#0000FF:26pcc2du]- 5[/color:26pcc2du] // centered [color=#0000FF:26pcc2du]oDay:nHeight += 5 oDay:nWidth += 5[/color:26pcc2du] oDay:nLeft := ( oWnd:nWidth() - oDay:nWidth() ) / 2 [color=#0000FF:26pcc2du]- 5[/color:26pcc2du] [color=#0000FF:26pcc2du]oDate:nHeight += 5 oDate:nWidth += 5[/color:26pcc2du] oDate:nLeft := ( oWnd:nWidth() - oDate:nWidth() ) / 2 [color=#0000FF:26pcc2du]- 5[/color:26pcc2du] regards Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
A problem with SAY and font- style and < size default >
In Class TSAY I added Line 93 [b:36kg1t5c]// DEFAULT nWidth := SAY_CHARPIX_W * Len( ::cCaption ) - 4 DEFAULT nWidth := GetTextWidth( 0, ::cCaption, If( oFont != nil, oFont:hFont,; If( oWnd:oFont != nil, oWnd:oFont:hFont,) ) ) [color=#0000FF:36kg1t5c] + 5[/color:36kg1t5c][/b:36kg1t5c] because NO textwidth and height is defined ( DEFAULT-values ) should be corrected for a undefined nHeight as well Line 72 nHeight := If( oFont != nil, Abs( oFont:nHeight ), SAY_CHARPIX_H ) [color=#0000FF:36kg1t5c]+ 5[/color:36kg1t5c],; regards Uwe
A problem with TDatabase using copy() / Past() ?
Hello, I noticed a problem using tDatabase Copy() / Paste([color=#FF0000:q85bvmsz]aVals[/color:q85bvmsz]) Wihout selected fields, record 9 is copied to 10 [img:q85bvmsz]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Network13&#46;jpg[/img:q85bvmsz] METHOD Copy() METHOD Paste( aVals ) using Paste() without aVals works adding aVals doesn't work <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( --> [code=fw:q85bvmsz]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> NET_COPY4 <span style="color: #000000;">&#40;</span> nStart, nEnd, lFields <span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">Local</span> lReturn := .T., aVals := <span style="color: #000000;">&#123;</span> oCust:<span style="color: #000000;">Last</span>, oCust:<span style="color: #000000;">First</span> <span style="color: #000000;">&#125;</span><br /><br /><span style="color: #00C800;">IF</span> nStart = nEnd<br />    lReturn := .F. <br />    MsgAlert<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"nStart = nEnd"</span> + CRLF + ;<br />    <span style="color: #ff0000;">"Not possible, to copy Record + ALLTRIM(STR(nRecord)) !"</span>, <span style="color: #ff0000;">"ERROR"</span><span style="color: #000000;">&#41;</span><br />    <span style="color: #00C800;">RETURN</span> lReturn<br /><span style="color: #00C800;">ENDIF</span><br /><br />oCust:<span style="color: #000000;">Copy</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">// copy fields of selected record</span><br /><br /><span style="color: #00C800;">IF</span> nEnd > <span style="color: #000000;">0</span> <span style="color: #B900B9;">// no append</span><br />    oCust:<span style="color: #000000;">KeyGoTo</span><span style="color: #000000;">&#40;</span> nEnd <span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">// go to defined record</span><br /><span style="color: #00C800;">ELSE</span><br />    oCust:<span style="color: #000000;">Append</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">ENDIF</span><br /><br />oCust:<span style="color: #000000;">Lock</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">IF</span> lFields = .T. <span style="color: #B900B9;">// using selected fields</span><br />    oCust:<span style="color: #000000;">Paste</span><span style="color: #000000;">&#40;</span>aVals<span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">// doesn't work !</span><br /><span style="color: #00C800;">ELSE</span><br />    oCust:<span style="color: #000000;">Paste</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>  <span style="color: #B900B9;">// works</span><br /><span style="color: #00C800;">ENDIF</span><br />oCust:<span style="color: #000000;">SAVE</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />oCust:<span style="color: #000000;">Commit</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />oCust:<span style="color: #000000;">UnLock</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">RETURN</span> lReturn </div>[/code:q85bvmsz] maybe something wrong with paste() <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: --> regards Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
A problem with TDatabase using copy() / Past() ?
TDatabase is already Net Ready. There is no need for NET_* functions for TDatabase. This is unnecessary and superfluous. Your code: [code=fw:2uoehws2]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oCust:<span style="color: #000000;">Lock</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">IF</span> lFields = .T. <span style="color: #B900B9;">// using selected fields</span><br />&nbsp; &nbsp; oCust:<span style="color: #000000;">Paste</span><span style="color: #000000;">&#40;</span>aVals<span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">ELSE</span><br />&nbsp; &nbsp; oCust:<span style="color: #000000;">Paste</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> &nbsp;<span style="color: #B900B9;">// Paste( aVals )</span><br /><span style="color: #00C800;">ENDIF</span><br />oCust:<span style="color: #000000;">SAVE</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />oCust:<span style="color: #000000;">Commit</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />oCust:<span style="color: #000000;">UnLock</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:2uoehws2] Where is the need to write the unnecessary code to Lock, Save and Unlock()? How do you think FWH releases methods without inbuilt locking and unlocking? FWH methods are simple to use. It is simpler and safer to use the methods as they are provided. Kindly do not complicate them with such unnecessay superflous code. Now, about the methods Copy() and Paste() 1) Copying all values from one record to another record: [code=fw:2uoehws2]<div class="fw" id="{CB}" style="font-family: monospace;"><br />WITH OBJECT oDbf<br />&nbsp; &nbsp;:<span style="color: #000000;">Goto</span><span style="color: #000000;">&#40;</span> nSrcRec <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;:<span style="color: #000000;">Copy</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;:<span style="color: #000000;">GoTo</span><span style="color: #000000;">&#40;</span> nDstRec <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;:<span style="color: #000000;">Paste</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />END<br />&nbsp;</div>[/code:2uoehws2] 2) Copying all values of a record and appending: (a) [code=fw:2uoehws2]<div class="fw" id="{CB}" style="font-family: monospace;"><br />WITH OBJECT oDbf<br />&nbsp; &nbsp;:<span style="color: #000000;">GoTo</span><span style="color: #000000;">&#40;</span> nSrcRec <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;:<span style="color: #000000;">Copy</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;:<span style="color: #000000;">Blank</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;:<span style="color: #000000;">Paste</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />END<br />&nbsp;</div>[/code:2uoehws2] (b) [code=fw:2uoehws2]<div class="fw" id="{CB}" style="font-family: monospace;"><br />WITH OBJECT oDbf<br />&nbsp; &nbsp;:<span style="color: #000000;">GoTo</span><span style="color: #000000;">&#40;</span> nSrcRec <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;:<span style="color: #000000;">Copy</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;:<span style="color: #000000;">Append</span><span style="color: #000000;">&#40;</span> :<span style="color: #000000;">aCopy</span> <span style="color: #000000;">&#41;</span><br />END<br />&nbsp;</div>[/code:2uoehws2] (c) Copying and pasting selected fields [code=fw:2uoehws2]<div class="fw" id="{CB}" style="font-family: monospace;"><br />WITH OBJECT oDbf<br />&nbsp; &nbsp;:<span style="color: #000000;">GoTo</span><span style="color: #000000;">&#40;</span> nSrcRec <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;aVals := <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #ff0000;">"FIRST"</span>, :<span style="color: #000000;">First</span> <span style="color: #000000;">&#125;</span>, <span style="color: #000000;">&#123;</span> <span style="color: #ff0000;">"LAST"</span>, :<span style="color: #000000;">Last</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp;:<span style="color: #000000;">GoTo</span><span style="color: #000000;">&#40;</span> nDstRec <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;:<span style="color: #000000;">Paste</span><span style="color: #000000;">&#40;</span> aVals <span style="color: #000000;">&#41;</span><br />END<br />&nbsp;</div>[/code:2uoehws2] aVals can be a list of values of all fields Or a 2-dim array with fieldnames and values.
A problem with TDatabase using copy() / Past() ?
Mr Rao, thank You very much for the detailed info I changed the function and it works fine now <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> I think I can still optimize the other defined functions inside the sample as well. I'm trying to test most of the tDatabase methods [code=fw:3ic167ro]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> NET_COPY4 <span style="color: #000000;">&#40;</span> nStart, nEnd, lFields <span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">Local</span> lReturn := .T.<br /><span style="color: #00C800;">Local</span> aVals := <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><br /><br /><span style="color: #00C800;">IF</span> nStart = nEnd<br />    lReturn := .F. <br />    MsgAlert<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"nStart = nEnd"</span> + CRLF + ;<br />    <span style="color: #ff0000;">"Not possible, to copy Record + ALLTRIM(STR(nRecord)) !"</span>, <span style="color: #ff0000;">"ERROR"</span><span style="color: #000000;">&#41;</span><br />    <span style="color: #00C800;">RETURN</span> lReturn<br /><span style="color: #00C800;">ENDIF</span><br /><br />WITH OBJECT oCust<br />    aVals := <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #ff0000;">"FIRST"</span>, :<span style="color: #000000;">First</span> <span style="color: #000000;">&#125;</span>, <span style="color: #000000;">&#123;</span> <span style="color: #ff0000;">"LAST"</span>, :<span style="color: #000000;">Last</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span><br />    <span style="color: #B900B9;">// :Goto( nSrcRec ) selected from xBrowse</span><br />    :<span style="color: #000000;">Copy</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">// copy fields of selected record</span><br />    <span style="color: #00C800;">IF</span> nEnd > <span style="color: #000000;">0</span><br />        :<span style="color: #000000;">GoTo</span><span style="color: #000000;">&#40;</span> nEnd <span style="color: #000000;">&#41;</span><br />    <span style="color: #00C800;">ELSE</span><br />        oCust:<span style="color: #000000;">Append</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />    <span style="color: #00C800;">ENDIF</span><br />    <span style="color: #00C800;">IF</span> lFields = .T.<br />        :<span style="color: #000000;">Paste</span><span style="color: #000000;">&#40;</span>aVals<span style="color: #000000;">&#41;</span><br />    <span style="color: #00C800;">ELSE</span><br />        :<span style="color: #000000;">Paste</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />    <span style="color: #00C800;">ENDIF</span><br />END <br /> </div>[/code:3ic167ro]
A problem with TDatabase using copy() / Past() ?
We do not think TDatabase methods need external help for optimization. We recommend using them directly as FWH provided.
A problem with TDatabase using copy() / Past() ?
Mr. Rao, I dont' want to change or optimize anything. I only want to create some samples where I can have a look for the practical usage not wasting time searching inside the class or forum to get detailed infos. That is the only reason. I added Your swap - sample to the sample-dialog 3 [img:gyryamr6]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Network14&#46;jpg[/img:gyryamr6] regards Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
A problem with TDatabase using copy() / Past() ?
Do we have samples of xbrowse copy / paste ? Is there a setting that shows a menu on right click to do the copy / paste of a record ( like there is for text ) ? Are the values saved to the clipboard or are they lost when the xbrowse is closed. For example, if I open an xbrowse ( filtered ) and do a copy of a record, can I close it, then open the same file with a separate filter and do the paste ?
A problem with TDatabase using copy() / Past() ?
[quote:1qt3jdl7] Do we have samples of xbrowse copy / paste ? [/quote:1qt3jdl7] This is not a feature of xbrowse. This is a feature of TDatabase. [quote:1qt3jdl7] Is there a setting that shows a menu on right click to do the copy / paste of a record ( like there is for text ) ? [/quote:1qt3jdl7] No. [quote:1qt3jdl7] Are the values saved to the clipboard or are they lost when the xbrowse is closed. For example, if I open an xbrowse ( filtered ) and do a copy of a record, can I close it, then open the same file with a separate filter and do the paste ? [/quote:1qt3jdl7] This is a feature of TDatabase. The copied values are stored as data. oDbf:aCopy. These values are available as long as the object is live. It does not matter we close xbrowse and reopen in another xbrowse. With TDatabase we can close and reopen the same dbf after some time. In all cases the data aCopy is retained. [code=fw:1qt3jdl7]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oCust:<span style="color: #000000;">SetFilter</span><span style="color: #000000;">&#40;</span> ... <span style="color: #000000;">&#41;</span><br />oCust:<span style="color: #000000;">GoTo</span><span style="color: #000000;">&#40;</span> x <span style="color: #000000;">&#41;</span><br />oCust:<span style="color: #000000;">Copy</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #B900B9;">// Optionally we can even close and reopen the same dbf later</span><br />oCust:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #B900B9;">// after some time</span><br />oCust:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #B900B9;">//</span><br />oCust:<span style="color: #000000;">SetFilter</span><span style="color: #000000;">&#40;</span> ... <span style="color: #000000;">&#41;</span><br />oCust:<span style="color: #000000;">GoTo</span><span style="color: #000000;">&#40;</span> xx <span style="color: #000000;">&#41;</span><br />oCust:<span style="color: #000000;">Paste</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">// works</span><br /> </div>[/code:1qt3jdl7] The programmer has to develop his own user interface for the copy and paste operations.
A problem with TDatabase using copy() / Past() ?
Mr. Tim This thread is about Copy/Paste features of TDatabase. XBrowse has its own powerful Copy/Paste features using clibboard. Contents of clipboard remain till they are cleared even after closing the xbrowse. These features work not only across different browsers of any data, but also to copy and paste between external applications like Excel, etc. These features were dicusssed in different threads already. But we will soon make a separate post with complete details.
A problem with function ChooseColor() ?
Hello, I noticed a problem with < ChooseColor() > restoring the old color, doesn't seems to work a BREAK returns always 0 ( black ) Also tested changing the color BEFORE the break but still black Return NIL would be ok, because 0 is a color as well can be selected. tested as well with sample < LINES.prg > [color=#0040FF:360g6lqy][b:360g6lqy]STATIC PROCEDURE NewColor() LOCAL OldColor := nColor if ( nColor := ChooseColor() ) == -1 // NO result // MsgAlert( nColor ) = returns always 0 !!! nColor := OldColor endif[/b:360g6lqy][/color:360g6lqy] any idea how to keep the old color ? [img:360g6lqy]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Choosecol1&#46;jpg[/img:360g6lqy] added a alert to the color-selection [img:360g6lqy]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Choosecol2&#46;jpg[/img:360g6lqy] best regards Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
A problem with function ChooseColor() ?
Uwe, FWH function ChooseColor() supports two optional parameters: [url:24iafixz]http&#58;//wiki&#46;fivetechsoft&#46;com/doku&#46;php?id=fivewin_function_choosecolor[/url:24iafixz] As the first parameter you may provide it the "oldColor" and that value will be returned when the user press cancel
A problem with function ChooseColor() ?
Antonio, thank You very much for the info. With included parameters in < ChooseColor() > it works fine now. flag = 1 opens a small and flag = 2 opens a full color-selection. best regards Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
A problem with splitters ?
Hello, I noticed with a mouseclick on a splitter, the splitter is shown [color=#FF0000:21v4ec53]RESIZED[/color:21v4ec53] the splitter is working adjusting the mouse-position My GRADIENT-painting on panels is working but is it possible to get a info about the new panelsize, if the horizontal splitter is moved ??? I need it for a new gradient-calculation. [b:21v4ec53]The splitters :[/b:21v4ec53] [img:21v4ec53]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Panel1&#46;jpg[/img:21v4ec53] [b:21v4ec53]A Mouseclick on a splitter [/b:21v4ec53] [img:21v4ec53]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Hsplit&#46;jpg[/img:21v4ec53] best regards Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
A problem with splitters ?
Dear Uwe, Have you tried with oPanel:bResized ?
A problem with warnings
Compiling this sample: [code=fw:2zkow80f]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Fivewin.ch"</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> MAIN<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #00C800;">LOCAL</span> oDlg<br /><br />    <span style="color: #00C800;">LOCAL</span> cVar := SPACE<span style="color: #000000;">&#40;</span> <span style="color: #000000;">35</span> <span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg<br /><br />    @ <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">GET</span> cVar<br /><br />    <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />             <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />             <span style="color: #0000ff;">CENTER</span><br /><br />    <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span></div>[/code:2zkow80f] I get this warning in Harbour and xHarbour: [code=fw:2zkow80f]<div class="fw" id="{CB}" style="font-family: monospace;">Harbour <span style="color: #000000;">3.2</span>.0dev <span style="color: #000000;">&#40;</span>r1605041350<span style="color: #000000;">&#41;</span><br />Copyright <span style="color: #000000;">&#40;</span>c<span style="color: #000000;">&#41;</span> <span style="color: #000000;">1999</span><span style="color: #000000;">-2016</span>, http:<span style="color: #B900B9;">//harbour-project.org/</span><br />test.prg<span style="color: #000000;">&#40;</span><span style="color: #000000;">16</span><span style="color: #000000;">&#41;</span> Warning W0004  Codeblock parameter <span style="color: #ff0000;">'SELF'</span> declared but not used in <span style="color: #00C800;">function</span> <span style="color: #ff0000;">'MAIN'</span><br /> </div>[/code:2zkow80f] [code=fw:2zkow80f]<div class="fw" id="{CB}" style="font-family: monospace;">xHarbour <span style="color: #000000;">1.2</span><span style="color: #000000;">.3</span> Intl. <span style="color: #000000;">&#40;</span>SimpLex<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#40;</span>Build <span style="color: #000000;">20170513</span><span style="color: #000000;">&#41;</span><br />Copyright <span style="color: #000000;">1999</span><span style="color: #000000;">-2017</span>, http:<span style="color: #B900B9;">//www.xharbour.org <!-- m --><a class="postlink" href="http://www.harbour-project.org/">http://www.harbour-project.org/</a><!-- m --></span><br />test.prg<span style="color: #000000;">&#40;</span><span style="color: #000000;">16</span><span style="color: #000000;">&#41;</span> Warning W0004  Codeblock parameter: <span style="color: #ff0000;">'SELF'</span> declared but not used in <span style="color: #00C800;">function</span>: <span style="color: #ff0000;">'MAIN'</span></div>[/code:2zkow80f] The problem is /w3 compiler switch that I want to use absolutely. In xHarbour I can use /wb- to avoid that warning but Harbour doesn't support that switch. Any ideas? EMG
A problem with warnings
Dear Encrico With /w0 I can compile the sample without any warning Regards
A problem with warnings
Thank you, but you missed the point: I do want to use /w3. EMG
A problem with warnings
Enrico, Maybe change this line: @ 1, 1 GET cVar To this: @ 1, 1 GET cVar of oDlg James
A problem with warnings
No, this is a reduced sample still showing the problem: [code=fw:2v5pfljt]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Fivewin.ch"</span><br /><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; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg<br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">CENTER</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span></div>[/code:2v5pfljt] EMG
A problem with warnings
The warning come from the codeblock [code=fw:3qa1h61a]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #000000;">&#123;</span>|Self|<uInit><span style="color: #000000;">&#125;</span></div>[/code:3qa1h61a] and all the other similar codeblock where we don't use all the parameters. EMG
A problem with warnings
Enrico, It seems that this is a valid warning, is it not? Or, are you just not wanting to see it regardless? James
A problem with warnings
Yes, exactly (see my first post in this thread). EMG
A problem with warnings
I found in the warning.txt in the xhb folder. WARNING for XHB contrib users ============================= This contrib is deprecated and not maintained anymore. This was originally meant as a temporary stop-gap solution to help migrating existing code written for xHarbour to Harbour, plus a means of documenting the differences between the these two branches of the language. The recommended path is to gradually migrate to use native core Harbour functions and core language elements, then finalize that process by dropping the need for this library. Linking this library and/or using its headers (`hbcompat.ch` and `xhb.ch` in particular) may cause various unintended side-effects both at compilation and runtime. Most of this code is also never tested by this fork, and none of it is ever used, so the chances of bugs is higher than in other parts of Harbour. If you can't do without some parts of this code, feel free to fork it locally or publicly and continue maintaining it there, otherwise try switching to core Harbour functionality ASAP. -Viktor
A problem with warnings
Thank you, but I can't see how this can be of any help regarding my problem. I repeat: I need to use /w3 warning level switch but I don't want to see all that warnings originated by codeblocks parameters (that belong to FWH and are out of my control). I use /wb- with xHarbour, how can I get the same result with Harbour? EMG
A problem with warnings
/es[<level>] set exit severity /w[<level>] set warning level number (0..3, default 1) Strange, it only works this way. [code=fw:30ha9tp1]<div class="fw" id="{CB}" style="font-family: monospace;"><br />&nbsp; &nbsp;/m /n /w1 /es2<br />&nbsp;</div>[/code:30ha9tp1]
A problem with warnings
Enrico, I have a couple modules where I haven't figured out what to change in the code to suppress certain warnings. I found that in harbour I can use #pragma to suppress the warning locally within the problem files. #pragma WARNINGLEVEL = 3 // or whatever #pragma ENABLEWARNINGS = OFF/ON Robb
A problem with warnings
Thank you, but I don't know how to suppress codeblock parameters warning in Harbour, even using compiler switches. In xHarbour I'm using /wb- but Harbour doesn't support it. EMG
A problem with warnings
I don't know how to do it with a command line switch either, but with the pragmas I noted this will suppress the message for the specific section of effected code. Depending on code organization this can be a hassle to add, but does this not do what you want? #pragma WARNINGLEVEL = 1 ACTIVATE DIALOG oDlg; ON INIT MSGINFO(); CENTER #pragma WARNINGLEVEL = 3
A problem with warnings
Using your sample, this shows exactly how I have been dealing with this in my own code. [code=fw:19roiypd]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Fivewin.ch"</span><br /><br />#translate SUPPRESS_WARNING => <span style="color: #00D7D7;">#pragma</span> WARNINGLEVEL = <span style="color: #000000;">1</span><br />#translate RESTORE_WARNING  => <span style="color: #00D7D7;">#pragma</span> WARNINGLEVEL = <span style="color: #000000;">3</span><br /><br /><span style="color: #00C800;">FUNCTION</span> MAIN<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #00C800;">LOCAL</span> oDlg<br /><br />    <span style="color: #00C800;">LOCAL</span> cVar := SPACE<span style="color: #000000;">&#40;</span> <span style="color: #000000;">35</span> <span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg<br /><br />    @ <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #0000ff;">GET</span> cVar<br /><br />   SUPPRESS_WARNING<br /><br />   <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br />            <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />            <span style="color: #0000ff;">CENTER</span><br /><br />   RESTORE_WARNING<br /><br />   <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:19roiypd]
A problem with warnings
Understood, thank you. Unfortunately there are way too many points to change in a real application. Better use /w if there are no other way. <!-- s:-( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":-(" title="Sad" /><!-- s:-( --> Or keep using xHarbour. <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> EMG
A problem with xBrowse Image Cell-Align ? ( + toolpreview )
Hello, focused on testing graphical-solutions, during my tests with my new xBrowse-sample, I noticed a problem with the [b:29gw2ksa]image-bottom [/b:29gw2ksa], using [color=#0000FF:29gw2ksa][b:29gw2ksa]cell-adjustment [/b:29gw2ksa][/color:29gw2ksa] ( missing some space ) [b:29gw2ksa]oBrw:aCols[ 8 ]:nDataBmpAlign [/b:29gw2ksa] The next column ( Image 2 ), shows my [color=#0000FF:29gw2ksa][b:29gw2ksa]calculated[/b:29gw2ksa][/color:29gw2ksa] position. That works OK in all situations. The defined CELLSIZE = [b:29gw2ksa]100 x 85[/b:29gw2ksa] [img:29gw2ksa]http&#58;//www&#46;pflegeplus&#46;com/pictures/Cellalign1&#46;jpg[/img:29gw2ksa] The column-menu with the different adjustments : [img:29gw2ksa]http&#58;//www&#46;pflegeplus&#46;com/pictures/Cellalign2&#46;jpg[/img:29gw2ksa] My [b:29gw2ksa]Calculation-result[/b:29gw2ksa], to move the image to cell-TOP : [img:29gw2ksa]http&#58;//www&#46;pflegeplus&#46;com/pictures/Cellalign3&#46;jpg[/img:29gw2ksa] [color=#0000FF:29gw2ksa][b:29gw2ksa]How to show the image 1 on TOP like Image 2 ( calculated ) ???[/b:29gw2ksa][/color:29gw2ksa] [color=#FF0000:29gw2ksa][b:29gw2ksa]AL_TOP missing ?[/b:29gw2ksa][/color:29gw2ksa] [color=#4000FF:29gw2ksa][b:29gw2ksa]MENUITEM "Left Align" WHEN oCol:nDataBmpAlign > 0 ; ACTION ( oCol:nDataBmpAlign:= AL_LEFT, oCol:oBrw:Refresh() ) MENUITEM "Center Align" WHEN oCol:nDataBmpAlign != AL_CENTER ; ACTION ( oCol:nDataBmpAlign := AL_CENTER, oCol:oBrw:Refresh() ) MENUITEM "Right Align" WHEN oCol:nDataBmpAlign != AL_RIGHT ; ACTION ( oCol:nDataBmpAlign := AL_RIGHT , oCol:oBrw:Refresh() )[/b:29gw2ksa][/color:29gw2ksa] [size=150:29gw2ksa]The tool-preview[/size:29gw2ksa] Main-screen [img:29gw2ksa]http&#58;//www&#46;pflegeplus&#46;com/pictures/Cellalign4&#46;jpg[/img:29gw2ksa] The test-dialog [img:29gw2ksa]http&#58;//www&#46;pflegeplus&#46;com/pictures/Cellalign5&#46;jpg[/img:29gw2ksa] The Painter [img:29gw2ksa]http&#58;//www&#46;pflegeplus&#46;com/pictures/Cellalign6&#46;jpg[/img:29gw2ksa] A dialog with a painted dialog-title [img:29gw2ksa]http&#58;//www&#46;pflegeplus&#46;com/pictures/Cellalign7&#46;jpg[/img:29gw2ksa] Best regards Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
A problem with xBrowse and arrays
Can you tell me why this sample selects the workarea 0 after closing the window? [code=fw:2wazi49p]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><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, oBrw, oCol<br /><br />&nbsp; &nbsp; <span style="color: #00C800;">LOCAL</span> aCell := <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> , <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> ,<span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> ,<span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> ,<span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> ,<span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> ,<span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">SELECT</span> <span style="color: #000000;">0</span><br /><br />&nbsp; &nbsp; USE CUSTOMER<br /><br />&nbsp; &nbsp; AADD<span style="color: #000000;">&#40;</span> aCell<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> , <span style="color: #ff0000;">"One"</span> &nbsp; <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; AADD<span style="color: #000000;">&#40;</span> aCell<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> , <span style="color: #ff0000;">"Two"</span> &nbsp; <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; AADD<span style="color: #000000;">&#40;</span> aCell<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> , <span style="color: #ff0000;">"Three"</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd<br /><br />&nbsp; &nbsp; @ <span style="color: #000000;">100</span>, <span style="color: #000000;">100</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">OF</span> oWnd DATASOURCE aCell CELL LINES<br /><br />&nbsp; &nbsp; oCol = oBrw:<span style="color: #000000;">AddCol</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; oCol:<span style="color: #000000;">bEditValue</span> &nbsp; = <span style="color: #000000;">&#123;</span> || aCell<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> , oBrw:<span style="color: #000000;">nArrayAt</span> &nbsp;<span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp; oBrw:<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oWnd:<span style="color: #000000;">oClient</span> = oBrw<br /><br />&nbsp; &nbsp; ? <span style="color: #ff0000;">"Before:"</span>, <span style="color: #0000ff;">ALIAS</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, <span style="color: #0000ff;">SELECT</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd<br /><br />&nbsp; &nbsp; ? <span style="color: #ff0000;">"After:"</span>, <span style="color: #0000ff;">ALIAS</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, <span style="color: #0000ff;">SELECT</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span></div>[/code:2wazi49p] EMG
A problem with xBrowse and arrays
Can you tell me why this sample selects the workarea 0 after closing the window? [code=fw:nlnhgpv4]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><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, oBrw, oCol<br /><br />&nbsp; &nbsp; <span style="color: #00C800;">LOCAL</span> aCell := <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> , <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> ,<span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> ,<span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> ,<span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> ,<span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> ,<span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">SELECT</span> <span style="color: #000000;">0</span><br /><br />&nbsp; &nbsp; USE CUSTOMER<br /><br />&nbsp; &nbsp; AADD<span style="color: #000000;">&#40;</span> aCell<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> , <span style="color: #ff0000;">"One"</span> &nbsp; <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; AADD<span style="color: #000000;">&#40;</span> aCell<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> , <span style="color: #ff0000;">"Two"</span> &nbsp; <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; AADD<span style="color: #000000;">&#40;</span> aCell<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> , <span style="color: #ff0000;">"Three"</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd<br /><br />&nbsp; &nbsp; @ <span style="color: #000000;">100</span>, <span style="color: #000000;">100</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">OF</span> oWnd DATASOURCE aCell CELL LINES<br /><br />&nbsp; &nbsp; oCol = oBrw:<span style="color: #000000;">AddCol</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; oCol:<span style="color: #000000;">bEditValue</span> &nbsp; = <span style="color: #000000;">&#123;</span> || aCell<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> , oBrw:<span style="color: #000000;">nArrayAt</span> &nbsp;<span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp; oBrw:<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oWnd:<span style="color: #000000;">oClient</span> = oBrw<br /><br />&nbsp; &nbsp; ? <span style="color: #ff0000;">"Before:"</span>, <span style="color: #0000ff;">ALIAS</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, <span style="color: #0000ff;">SELECT</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd<br /><br />&nbsp; &nbsp; ? <span style="color: #ff0000;">"After:"</span>, <span style="color: #0000ff;">ALIAS</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, <span style="color: #0000ff;">SELECT</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span></div>[/code:nlnhgpv4] EMG
A problem with xBrowse and arrays
Thanks for pointing this out. This happens only when Evaluation of bEditValue results in an error. (In the present case when oBrw:nArrayAt > 3 ). This does not happen where the bEditValue is valid for the entire browse. This is fixed in 18.04.
A problem with xBrowse-keyboard navigation ?
Hello, I noticed a problem with the xBrowse-keyboard usage I need the row- and column-position on cell-change using the keyboard On mouseclick no problem. The screenshot shows the problem moving inside the SAME row to the next cell, the column-no. is not updated Only changing the rowposition after the change it works. ( picture 2 and 3 ) tested with ON CHANGE and oBrw:bPainted := < |hDC| [code=fw:3fthjjse]<div class="fw" id="{CB}" style="font-family: monospace;"><br />@ <span style="color: #000000;">5</span>, <span style="color: #000000;">30</span> <span style="color: #0000ff;">SAY</span> oSay<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Row :    "</span> + LTRIM<span style="color: #000000;">&#40;</span>STR<span style="color: #000000;">&#40;</span>nRowPos<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>  <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">40</span>, <span style="color: #000000;">10</span> ;<br /> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">COLOR</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">12124088</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">OF</span> oDlg  <br />@ <span style="color: #000000;">5</span>, <span style="color: #000000;">90</span> <span style="color: #0000ff;">SAY</span> oSay<span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Column :    "</span> + LTRIM<span style="color: #000000;">&#40;</span>STR<span style="color: #000000;">&#40;</span>nColPos<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>  <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">60</span>, <span style="color: #000000;">10</span> ;<br /> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">COLOR</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">12124088</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">OF</span> oDlg  <br />...<br />...<br /><span style="color: #B900B9;">// xBrowse :</span><br /> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CHANGE</span>  <span style="color: #000000;">&#40;</span> nColPos := oBrw:<span style="color: #000000;">SelectedCol</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">nCreationOrder</span>, ;<br />              nRowPos := oBrw:<span style="color: #000000;">Keyno</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, ;<br />                       oSay<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, ; <span style="color: #B900B9;">// row-info</span><br />                       oSay<span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">// column-info</span><br /> </div>[/code:3fthjjse] [img:3fthjjse]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Colpos1&#46;jpg[/img:3fthjjse] maybe another possible solution <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: --> regards Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
A problem with xBrowse-keyboard navigation ?
Your observation is not correct. The SelectedCol() and nColSel are updated even when the column is changed by arrow keys. But by default, your bChange is called when row is changed but not when column only is changed. If you set oBrw:lColChangeNotify := .T. (default .f.), your on change code can see the changes in the selected column also.
A problem with xBrowse-keyboard navigation ?
Mr. Rao, [quote:10fohnz9]If you set oBrw:lColChangeNotify := .T. (default .f.), your on change code can see the changes in the selected column also.[/quote:10fohnz9] thank You very much. That was the missing info. It is working now and returns the selected column-number. regards Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
A problem with xBrowse-keyboard navigation ?
Mr. Rao, [quote:2voinypm]If you set oBrw:lColChangeNotify := .T. (default .f.), your on change code can see the changes in the selected column also.[/quote:2voinypm] thank You very much. That was the missing info. It is working now and returns the selected column-number. regards Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
A problem with xImage and JPG
A alphablended JPG with xImage how is that possible <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: --> The normal formats using transparent are : GIF, PNG, TIF and BMP [img:23r2tid9]http&#58;//www&#46;service-fivewin&#46;de/IMAGES/xImage5&#46;jpg[/img:23r2tid9] [size=150:23r2tid9]the original JPG[/size:23r2tid9] [img:23r2tid9]http&#58;//www&#46;service-fivewin&#46;de/IMAGES/Picture9&#46;jpg[/img:23r2tid9] regards Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
A problem with xImage and JPG
Example, PRG? Regards.
A problem with xImage and JPG
Nothing extra. It is the original sample xImage01.prg from the sample-folder You can test it from there. For the test I added the image to the imagefolder thats all. Just see the picture above regards Uwe
A problem with xImage and JPG
Master, this JPG is damaged. I opened it with IRFANVIEW.EXE and the image is not perfect. Try another one please. Greetings.
A problem with xImage and JPG
Look, [img:mdr72hkv]https&#58;//i&#46;imgur&#46;com/Pj7Glhx&#46;png[/img:mdr72hkv] Regards.
A problem with xImage and JPG
I*m using a professional sofware PHOTOSHOP and there is no error. Most of JPG-files don't use solid colors on the border-area. That is the reason black is shown transparent. With my new < cellborder-tool > it is possible to test it as well. The image-selection from the browser is using xImage. I tested some more JPG*s the problem belongs to JPG-images with some SOLID colorspaces from the outside Next I painted a [b:3cwfmtip]SOLID[/b:3cwfmtip] freehand-border around image Olga1.jpg A normal JPG without solid colors doesn*t have any problems [img:3cwfmtip]http&#58;//www&#46;service-fivewin&#46;de/IMAGES/xImage6&#46;jpg[/img:3cwfmtip] [img:3cwfmtip]http&#58;//www&#46;service-fivewin&#46;de/IMAGES/Olga2&#46;jpg[/img:3cwfmtip] Images can be tested here : [img:3cwfmtip]http&#58;//www&#46;service-fivewin&#46;de/IMAGES/Bord2&#46;jpg[/img:3cwfmtip] [img:3cwfmtip]http&#58;//www&#46;service-fivewin&#46;de/IMAGES/Bord7&#46;jpg[/img:3cwfmtip] regards Uwe
A problem with xImage and JPG
Please try chaing oBrw:bChange as [code=fw:13uw2lrd]<div class="fw" id="{CB}" style="font-family: monospace;"> &nbsp; &nbsp; &nbsp;:<span style="color: #000000;">bChange</span> &nbsp; &nbsp; &nbsp; := <span style="color: #000000;">&#123;</span> || oImage:<span style="color: #000000;">lBmpTransparent</span> := !<span style="color: #000000;">&#40;</span> Lower<span style="color: #000000;">&#40;</span> cFileExt<span style="color: #000000;">&#40;</span> oBrw:<span style="color: #000000;">aRow</span><span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> $ <span style="color: #ff0000;">"jpg,jpeg"</span> <span style="color: #000000;">&#41;</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oImage:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp;</div>[/code:13uw2lrd]
A problem with xImage and JPG
Thank You very much it is working now <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> solid color-areas are rarely inside JPG-files special on the outline area <!-- s:roll: --><img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" /><!-- s:roll: --> [img:nhts0af6]http&#58;//www&#46;service-fivewin&#46;de/IMAGES/Border13&#46;jpg[/img:nhts0af6] regards Uwe
A problem xBrowse Total and Index UNIQUE
Hello, is it possible to use xbrowse total with a index UNIQUE ? sample : A customer can have many bills the same time each bill can have many positions [color=#0000FF:1y7j1sej]each position[/color:1y7j1sej] includes the [b:1y7j1sej]invoice total[/b:1y7j1sej] using index UNIQUE I display each bill with the invoice total [b:1y7j1sej]only once[/b:1y7j1sej] the problem xbrowse total is counting ALL positions. UNIQUE is ignored. [img:1y7j1sej]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/XbrwTotal1&#46;jpg[/img:1y7j1sej] another section shows the details of a bill ( positions ) [img:1y7j1sej]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/XbrwTotal2&#46;jpg[/img:1y7j1sej] maybe a different solution needed ? I could calculate each column and display the result using the footer My working test [img:1y7j1sej]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/XbrwTotal3&#46;jpg[/img:1y7j1sej] counting the column-values [code=fw:1y7j1sej]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br />The used and created <span style="color: #0000ff;">index</span><br /><br />NET_USE <span style="color: #000000;">&#40;</span> c_Pfad3 + cRMonat + <span style="color: #ff0000;">".DBF"</span>, cRMonat, <span style="color: #000000;">3</span>,.F. <span style="color: #000000;">&#41;</span> = .T.<br />     ORDCREATE<span style="color: #000000;">&#40;</span> ,<span style="color: #ff0000;">"STAT"</span>, <span style="color: #ff0000;">"UPPER(PAT_NNAME + PAT_VNAME) + STR(RECHNG_ZAE)"</span>, ;<br />     <span style="color: #000000;">&#123;</span>|| STR<span style="color: #000000;">&#40;</span>RECHNG_ZAE<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> , .T. <span style="color: #000000;">&#41;</span>  <span style="color: #B900B9;">// .T. = UNIQUE</span><br /><br />TOTAL defined in <span style="color: #0000ff;">xBrowse</span><br /><br />WITH OBJECT oBrw1<br />     <span style="color: #00C800;">FOR</span> I := <span style="color: #000000;">5</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">13</span><br />          :<span style="color: #000000;">aCols</span><span style="color: #000000;">&#91;</span> I <span style="color: #000000;">&#93;</span>:<span style="color: #000000;">nWidth</span> := <span style="color: #000000;">75</span><br />          :<span style="color: #000000;">aCols</span><span style="color: #000000;">&#91;</span> I <span style="color: #000000;">&#93;</span>:<span style="color: #000000;">nDataStrAlign</span>   := AL_RIGHT<br />          :<span style="color: #000000;">aCols</span><span style="color: #000000;">&#91;</span> I <span style="color: #000000;">&#93;</span>:<span style="color: #000000;">nHeadStrAlign</span>   := AL_CENTER<br />          :<span style="color: #000000;">MakeTotals</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">// not working</span><br />          :<span style="color: #000000;">aCols</span><span style="color: #000000;">&#91;</span> I <span style="color: #000000;">&#93;</span>:<span style="color: #000000;">lTotal</span> := .T.<br />          :<span style="color: #000000;">aCols</span><span style="color: #000000;">&#91;</span> I <span style="color: #000000;">&#93;</span>:<span style="color: #000000;">nTotal</span> := <span style="color: #000000;">0</span><br />     <span style="color: #00C800;">NEXT</span><br />END<br /><br />Footer values REPLACED WITH :<br /><br /><span style="color: #000000;"><span style="color: #000000;">&#40;</span>cRMonat</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>DBGOTOP<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /><br />nReNr := <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->RECHNG_ZAE<br /><span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> !EOF<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />        <span style="color: #00C800;">IF</span> <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->KENNER = <span style="color: #ff0000;">"KrK"</span>  <span style="color: #B900B9;">// different bill-types</span><br />            nValue<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span> += <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->K1_SUMME<br />        ELSEIF <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->KENNER = <span style="color: #ff0000;">"KrX"</span><br />            nValue<span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span> += <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->K2_SUMME<br />        ELSEIF <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->KENNER = <span style="color: #ff0000;">"PrX"</span><br />            nValue<span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span> += <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->PR_SUMME<br />        ELSEIF <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->KENNER = <span style="color: #ff0000;">"PfK"</span><br />            nValue<span style="color: #000000;">&#91;</span><span style="color: #000000;">4</span><span style="color: #000000;">&#93;</span> += <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->P0_SUMME<br />        ELSEIF <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->KENNER = <span style="color: #ff0000;">"PfB"</span><br />            nValue<span style="color: #000000;">&#91;</span><span style="color: #000000;">5</span><span style="color: #000000;">&#93;</span> += <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->P1_SUMME<br />        ELSEIF <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->KENNER = <span style="color: #ff0000;">"B1K"</span><br />            nValue<span style="color: #000000;">&#91;</span><span style="color: #000000;">6</span><span style="color: #000000;">&#93;</span> += <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->PB1_SUMME<br />        ELSEIF <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->KENNER = <span style="color: #ff0000;">"B1P"</span><br />            nValue<span style="color: #000000;">&#91;</span><span style="color: #000000;">7</span><span style="color: #000000;">&#93;</span> += <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->PB2_SUMME<br />        ELSEIF <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->KENNER = <span style="color: #ff0000;">"B2K"</span><br />            nValue<span style="color: #000000;">&#91;</span><span style="color: #000000;">8</span><span style="color: #000000;">&#93;</span> += <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->P2_SUMME<br />        ELSEIF <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->KENNER = <span style="color: #ff0000;">"B2P"</span><br />            nValue<span style="color: #000000;">&#91;</span><span style="color: #000000;">9</span><span style="color: #000000;">&#93;</span> += <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->P3_SUMME<br />        <span style="color: #00C800;">ENDIF</span><br /><br />        <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>DBSKIP<span style="color: #000000;">&#40;</span><span style="color: #000000;">+1</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /><br />        <span style="color: #00C800;">IF</span> nReNr = <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->RECHNG_ZAE<br />            <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>DBSKIP<span style="color: #000000;">&#40;</span><span style="color: #000000;">+1</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />            nReNr := <span style="color: #000000;">&#40;</span>cRMonat<span style="color: #000000;">&#41;</span>->RECHNG_ZAE<br />        <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">ENDDO</span><br /><br /> </div>[/code:1y7j1sej] best regards Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
A problem xBrowse Total and Index UNIQUE
Same result using a original FWH-sample [img:h7tegiov]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/XbrwTotal4&#46;jpg[/img:h7tegiov] Not possible to refresh footers with total calculated footers are working fine [img:h7tegiov]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/XbrwTotal5&#46;jpg[/img:h7tegiov] I created a CUSTOMER.dbf with some equal names !!! for testing UNIQUE [code=fw:h7tegiov]<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;">'ord.ch'</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">'xbrowse.ch'</span><br /><br />REQUEST DBFCDX<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 /><span style="color: #00C800;">local</span> oDlg, oBrw1, oBrw2, oFont<br /><span style="color: #00C800;">local</span> nMaxSal &nbsp;:= <span style="color: #000000;">0</span>, nValue := <span style="color: #000000;">0</span><br /><span style="color: #00C800;">local</span> nProgClr := RGB<span style="color: #000000;">&#40;</span> <span style="color: #000000;">161</span>, <span style="color: #000000;">224</span>, <span style="color: #000000;">255</span> <span style="color: #000000;">&#41;</span><br /><br />XBrNumFormat<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">'E'</span>, .t. <span style="color: #000000;">&#41;</span><br /><br />USE customer <span style="color: #00C800;">NEW</span> SHARED <span style="color: #0000ff;">ALIAS</span> CUST VIA <span style="color: #ff0000;">'DBFCDX'</span><br />ORDCREATE<span style="color: #000000;">&#40;</span> ,<span style="color: #ff0000;">"CUST1"</span>, <span style="color: #ff0000;">"UPPER(LAST)"</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>|| UPPER<span style="color: #000000;">&#40;</span>LAST<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> , .F. <span style="color: #000000;">&#41;</span> &nbsp;<span style="color: #B900B9;">// .T. = UNIQUE</span><br />ORDCREATE<span style="color: #000000;">&#40;</span> ,<span style="color: #ff0000;">"CUST2"</span>, <span style="color: #ff0000;">"UPPER(LAST)"</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>|| UPPER<span style="color: #000000;">&#40;</span>LAST<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> , .T. <span style="color: #000000;">&#41;</span> &nbsp;<span style="color: #B900B9;">// .T. = UNIQUE</span><br /><br />DBSETORDER<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"CUST1"</span><span style="color: #000000;">&#41;</span><br /><br />DBEval<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#123;</span> || nMaxSal := <span style="color: #0000ff;">Max</span><span style="color: #000000;">&#40;</span> nMaxSal, FIELD->Salary <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />GO TOP<br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"TAHOMA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-12</span><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">500</span>, <span style="color: #000000;">520</span> <span style="color: #0000ff;">PIXEL</span> ;<br /><span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Progress Bars in XBrowse"</span> ;<br /><span style="color: #0000ff;">FONT</span> oFont<br /><br />@ <span style="color: #000000;">10</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">XBROWSE</span> oBrw1 ;<br />&nbsp; &nbsp; &nbsp; COLUMNS <span style="color: #ff0000;">'Last'</span>, <span style="color: #ff0000;">'Age'</span>, <span style="color: #ff0000;">'Salary'</span> ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">OF</span> oDlg ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">220</span>, <span style="color: #000000;">100</span> <span style="color: #0000ff;">PIXEL</span> ;<br />&nbsp; &nbsp; &nbsp; PICTURES <span style="color: #00C800;">nil</span>, <span style="color: #ff0000;">'999.99 %'</span> ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">'CUST'</span> ;<br />&nbsp; &nbsp; &nbsp; CELL LINES AUTOSORT NOBORDER FOOTERS<br /><br />WITH OBJECT oBrw1:<span style="color: #000000;">Salary</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">SetProgBar</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#123;</span> || nMaxSal <span style="color: #000000;">&#125;</span>,, <span style="color: #000000;">&#123;</span> || <span style="color: #000000;">&#123;</span> nProgClr, CLR_WHITE <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">nDataStrAlign</span> := AL_RIGHT<br />END<br /><br />WITH OBJECT oBrw1:<span style="color: #000000;">Age</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">cHeader</span> &nbsp; &nbsp;:= <span style="color: #ff0000;">'Percent'</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">SetProgBar</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">100</span>, <span style="color: #000000;">104</span>, <span style="color: #000000;">&#123;</span> || <span style="color: #000000;">&#123;</span> nProgClr, CLR_WHITE <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">nDataStrAlign</span> := AL_RIGHT<br />END<br /><br />WITH OBJECT oBrw1<br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">nStretchCol</span> &nbsp; := <span style="color: #000000;">1</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />END<br /><br />nValue := FOOTER_UPD<span style="color: #000000;">&#40;</span>nValue<span style="color: #000000;">&#41;</span><br />oBrw1:<span style="color: #000000;">aCols</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">cFooter</span> := nValue<br /><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'CUST'</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>DBGOTOP<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />oBrw1:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #B900B9;">// -----------------</span><br /><br />@ <span style="color: #000000;">150</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">XBROWSE</span> oBrw2 ;<br />&nbsp; &nbsp; &nbsp; COLUMNS <span style="color: #ff0000;">'Last'</span>, <span style="color: #ff0000;">'Age'</span>, <span style="color: #ff0000;">'Salary'</span> ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">OF</span> oDlg ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">220</span>, <span style="color: #000000;">100</span> <span style="color: #0000ff;">PIXEL</span> ;<br />&nbsp; &nbsp; &nbsp; PICTURES <span style="color: #00C800;">nil</span>, <span style="color: #ff0000;">'999.99 %'</span> ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">'CUST'</span> ;<br />&nbsp; &nbsp; &nbsp; CELL LINES AUTOSORT NOBORDER FOOTERS<br /><br />WITH OBJECT oBrw2:<span style="color: #000000;">Salary</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">nTotal</span> &nbsp; &nbsp; := <span style="color: #000000;">0</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">lTotal</span> &nbsp; &nbsp; := .t.<br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">SetProgBar</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#123;</span> || nMaxSal <span style="color: #000000;">&#125;</span>,, <span style="color: #000000;">&#123;</span> || <span style="color: #000000;">&#123;</span> nProgClr, CLR_WHITE <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">nDataStrAlign</span> := AL_RIGHT<br />END<br /><br />WITH OBJECT oBrw2:<span style="color: #000000;">Age</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">cHeader</span> &nbsp; &nbsp;:= <span style="color: #ff0000;">'Percent'</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">SetProgBar</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">100</span>, <span style="color: #000000;">104</span>, <span style="color: #000000;">&#123;</span> || <span style="color: #000000;">&#123;</span> nProgClr, CLR_WHITE <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">nDataStrAlign</span> := AL_RIGHT<br />END<br /><br />WITH OBJECT oBrw2<br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">nStretchCol</span> &nbsp; := <span style="color: #000000;">1</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">MakeTotals</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; :<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />END<br /><br />@ <span style="color: #000000;">120</span>,<span style="color: #000000;">70</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Normal"</span> <span style="color: #0000ff;">size</span> <span style="color: #000000;">40</span>,<span style="color: #000000;">20</span> &nbsp;<span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">PIXEL</span> ;<br /><span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> DBSETORDER<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"CUST1"</span><span style="color: #000000;">&#41;</span>, nValue := FOOTER_UPD<span style="color: #000000;">&#40;</span>nValue<span style="color: #000000;">&#41;</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'CUST'</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>DBGOTOP<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBrw1:<span style="color: #000000;">aCols</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">cFooter</span> := nValue, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBrw1:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, oBrw2:<span style="color: #000000;">RefreshFooters</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, oBrw2:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />@ <span style="color: #000000;">120</span>,<span style="color: #000000;">150</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Unique"</span> <span style="color: #0000ff;">size</span> <span style="color: #000000;">40</span>,<span style="color: #000000;">20</span> &nbsp;<span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">PIXEL</span> ;<br /><span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> DBSETORDER<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"CUST2"</span><span style="color: #000000;">&#41;</span>, nValue := FOOTER_UPD<span style="color: #000000;">&#40;</span>nValue<span style="color: #000000;">&#41;</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'CUST'</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>DBGOTOP<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBrw1:<span style="color: #000000;">aCols</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span>:<span style="color: #000000;">cFooter</span> := nValue, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oBrw1:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, oBrw2:<span style="color: #000000;">RefreshFooters</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, oBrw2:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /><br /><span style="color: #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;">FUNCTION</span> FOOTER_UPD<span style="color: #000000;">&#40;</span>nValue<span style="color: #000000;">&#41;</span><br /><br />nValue := <span style="color: #000000;">0</span><br /><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'CUST'</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>DBGOTOP<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> !EOF<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; nValue += <span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'CUST'</span><span style="color: #000000;">&#41;</span>->Salary<br />&nbsp; &nbsp; <span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'CUST'</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>DBSKIP<span style="color: #000000;">&#40;</span><span style="color: #000000;">+1</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">ENDDO</span><br /><br /><span style="color: #00C800;">RETURN</span> nValue<br />&nbsp;</div>[/code:h7tegiov] best regards Uwe <!-- s:? --><img src="{SMILIES_PATH}/icon_confused.gif" alt=":?" title="Confused" /><!-- s:? -->
A problem xBrowse and RELATION of 2 DBF's
Hello, I noticed a problem us RELATION [color=#0000FF:tdkxkbds]DBSELECTAREA( "KUNDE" ) ( "KUNDE" )->(DBSETORDER( "KUNDE1" )) ( "KUNDE" )->( ORDSETRELATION( cMonat, { || UPPER(NAME1 + NAME) }, "UPPER(NAME1 + NAME)" ) ) ( "KUNDE" )->( DBGOTOP() )[/color:tdkxkbds] After selecting a row in browser 2, the values are displayed but the position moves to row 1 selecting again the same row, everything is ok. It happens only with the 1. selection. Is it possible after the 1. selection to stay in the selected row ? Removing the [color=#0000FF:tdkxkbds]RELATION[/color:tdkxkbds], there is no problem. [img:tdkxkbds]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Relation1&#46;jpg[/img:tdkxkbds] best regards Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
A problem xBrowse and RELATION of 2 DBF's
A test with a created sample ( a combination of UNIQUE and RELATION ). The same effect : On 1. click in browser 2 on row 4 < Acker > ( selected in browser 1 ), the 1. row is shown as selected ( moved ) On 2. click ( same row ) the selected row stays activated. The effect is shown only on FIRST CLICK !!! Selecting another name in browser 1 and going back to < Acker > the same effect happens. The sample includes 2 DBF's with the same names In DBF 2, Acker is defined 4 times testing RELATION The UNIQUE - test-button shows < Fuller > defined twice in browser 1 only once Download : <!-- m --><a class="postlink" href="http://www.pflegeplus.com/DOWNLOADS/Relation1.zip">http://www.pflegeplus.com/DOWNLOADS/Relation1.zip</a><!-- m --> [img:2re37qgp]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Relation2&#46;jpg[/img:2re37qgp] USE customer1 NEW SHARED ALIAS CUST1 VIA 'DBFCDX' ORDCREATE( ,"CUST1", "UPPER(LAST)", ; {|| UPPER(LAST) } , .F. ) ORDCREATE( ,"CUST2", "UPPER(LAST)", ; {|| UPPER(LAST) } , .T. ) // .T. = UNIQUE DBSETORDER("CUST1") USE customer2 NEW SHARED ALIAS CUST2 VIA 'DBFCDX' ORDCREATE( ,"CUST3", "UPPER(LAST)", ; {|| UPPER(LAST) } , .F. ) DBSETORDER("CUST3") -------- DBSELECTAREA( "CUST1" ) ("CUST1")->(DBSETORDER( "CUST1" )) ("CUST1")->( ORDSETRELATION( "CUST2", { || UPPER(LAST) }, "UPPER(LAST)" ) ) ("CUST1")->( DBGOTOP() ) @ 10,10 XBROWSE oBrw1 ; COLUMNS 'Last', 'Age', 'Salary' ; OF oDlg ; SIZE 220, 100 PIXEL ; PICTURES nil, '999.99 %' ; [color=#008000:2re37qgp][b:2re37qgp]ALIAS 'CUST1' ;[/b:2re37qgp][/color:2re37qgp] CELL LINES AUTOSORT NOBORDER FOOTERS ... ... @ 150,10 XBROWSE oBrw2 ; COLUMNS 'Last', 'Age', 'Salary' ; OF oDlg ; SIZE 220, 100 PIXEL ; PICTURES nil, '999.99 %' ; [color=#0000FF:2re37qgp][b:2re37qgp]ALIAS 'CUST2' ;[/b:2re37qgp][/color:2re37qgp] CELL LINES AUTOSORT NOBORDER FOOTERS best regards Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
A problem xBrowse and RELATION of 2 DBF's
added a SAY of the selected salary to show the problem. the selected salary of row 4 is shown but doesn't stay in row 4 and moves to row 1 It happens ONLY on 1. click. The Second click is ok. [img:2wcmepje]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Relation3&#46;jpg[/img:2wcmepje] best regards Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
A problem xBrowse and RELATION of 2 DBF's
I tested and saw the problem. On the other hand, why not use scopes? Regards.
A problem xBrowse and RELATION of 2 DBF's
Francisco, thank You very much. I changed the source-part using SCOPES and it works perfect without this funny jump-effect. I didn't think about this solution. It was a translation of a part from Clipper-times I didn't change and I kept the logic using RELATION. best regards Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
A problem xBrowse and RELATION of 2 DBF's
A extended sample with some new tests Download : <!-- m --><a class="postlink" href="http://www.pflegeplus.com/DOWNLOADS/Xbrwtest3.zip">http://www.pflegeplus.com/DOWNLOADS/Xbrwtest3.zip</a><!-- m --> [color=#0040FF:gh5hs6e2][b:gh5hs6e2]1. testing SCOPE ( browser 2 ) 2. scoped browser with record MOVE-test 3. drawing boxes and lines on ALL brushes with auto-DELETE-function 4. autodelete of boxes and line ( timer )[/b:gh5hs6e2][/color:gh5hs6e2] [b:gh5hs6e2]requested from :[/b:gh5hs6e2] <!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=31653">viewtopic.php?f=3&t=31653</a><!-- l --> <!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=31545">viewtopic.php?f=3&t=31545</a><!-- l --> [img:gh5hs6e2]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Boxes1&#46;jpg[/img:gh5hs6e2] best regards Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
A problem xBrowse seek < numeric + character >
Hello, I noticed a problem on SEEK with a field-combination numeric + character I need the field < klasse0 > defined, because it is a GROUP-number. DOESN't work ! wrong results typing < 1 > shows 100 and next 150 [color=#008000:3deygjfn]The seek works with < [b:3deygjfn]SPACE[/b:3deygjfn] + 1 + 5 [/color:3deygjfn]> [color=#FF0000:3deygjfn]ORDCREATE( ,"LEISTG1","STR(Klasse0) + Leistung", ; // N 3.0 + C 15 {|| STR(Klasse0) + Leistung } , .F. )[/color:3deygjfn] [img:3deygjfn]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Seek12&#46;jpg[/img:3deygjfn] ONLY the numeric field WORKS searching group 15 ! shows 1 and next 15 [color=#008000:3deygjfn]ORDCREATE( ,"LEISTG1","Klasse0",; {|| Klasse0 }, .F. )[/color:3deygjfn] [img:3deygjfn]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Seek11&#46;jpg[/img:3deygjfn] any idea ? regards Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
A problem xBrowse seek < numeric + character >
XBrowse simply uses dbseek( upper( trim( cSeek ) ) xbrowse incremental seek works the same way as dbseek.