topic
stringlengths 1
63
| text
stringlengths 1
577k
⌀ |
|---|---|
A strange printing behavior
|
I'm looking for ideas based on some users experiences. Here is the problem:
An invoice print routine uses the same print function to print an invoice, counter sale, or estimate.
The only difference is in a few titles that are printed, and the customer info
This routine works EVERYWHERE except with one client where it used to work.
The client installed a new printer.
The customer can print invoices or estimates and it works perfectly
The customer can no longer print counter sales.
The problem cannot be replicated at any other client or in house.
When he put the old printer back on line, it now cannot print counter sales.
Again the same function is used to print all 3. The type selected makes a difference only in limited data output from the function.
So here is what I'm asking. I know it is not a FWH issue ( it has worked fine for many many years ). However, with all of your experiences with outputting to the windows print system, can anyone think of any reason this could occur ? Is there someting that tPrinter might expect the print system to respond that I could check, or any special characters that might prevent it from outputting ? I'm at a loss.
Thanks for your ideas.
|
A suggestion :help
|
Hello Silvio,
I had a look at the table and understand it like this :
There is a special offering >= 15 Days = 63 Euro and a price for one Day = 7 Euro.
If You rent < 15 Days, the price of 7 Euro each day is used.
If You calculate until 9 Days with 7 Euro a Day, You reach the price of the special offering.
That means :
If somebody stays > 9 Days and < 15 Days, the price will be higher > 63 Euro.
The Day-price after using the special offering 63 Euro = 63 / 15 would be 4,20 Euro up to 30 Days.
To stay 18 Days = 63 + ( 3 * 4,20 ) = 75,60 Euro => Fix-price 15 Days + 3 * Day-price ( 4,20 Euro ).
It is possible, to include this logic in my function.
The calculation :
< 15 Days = 7 Euro * Days
18 Days = 63 Euro + ( 3 * 4,20 Euro ) = 75,60 Euro.
Maybe You can speek to Your customer, if my understanding is correct, using 4,20 Euro a day after 14 days ( 15 ) ?
Days.....Price
--------------
1--------7
..
9--------[color=#FF0000:1n2r9kk8]63[/color:1n2r9kk8]
14-------98
-----------------------
15-------[color=#FF0000:1n2r9kk8]63[/color:1n2r9kk8]
..
30------[color=#FF0000:1n2r9kk8]126[/color:1n2r9kk8]
[code=fw:1n2r9kk8]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> PRICE_TEST<span style="color: #000000;">(</span>oWnd<span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> oDlg, oGET<br /><br /><span style="color: #00C800;">PRIVATE</span> aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span><br />aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> := <span style="color: #000000;">{</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">7</span> <span style="color: #000000;">}</span> <span style="color: #B900B9;">// 1 day</span><br />aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> := <span style="color: #000000;">{</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">15</span>, <span style="color: #000000;">63</span> <span style="color: #000000;">}</span> <span style="color: #B900B9;">// min 15 Days</span><br />aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> := <span style="color: #000000;">{</span> <span style="color: #000000;">16</span>, <span style="color: #000000;">30</span>, <span style="color: #000000;">126</span> <span style="color: #000000;">}</span> <span style="color: #B900B9;">// min >= 16 Days</span><br />nDAYS := <span style="color: #000000;">1</span><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Price Test"</span> <br /><br />@ <span style="color: #000000;">1</span>, <span style="color: #000000;">2</span> <span style="color: #0000ff;">GET</span> oGet <span style="color: #0000ff;">VAR</span> nDAYS <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">30</span>, <span style="color: #000000;">15</span> <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"99"</span><br />@ <span style="color: #000000;">2</span>, <span style="color: #000000;">2</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Price-Test"</span> <span style="color: #0000ff;">size</span> <span style="color: #000000;">50</span>, <span style="color: #000000;">25</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /><span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> oGet:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, ;<br /> nPRICE := GETPRICE3<span style="color: #000000;">(</span> nDAYS, aPRICE <span style="color: #000000;">)</span>, ;<br /> MsgAlert<span style="color: #000000;">(</span> nPrice <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #000000;">(</span> <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #B900B9;">// -----------------------</span><br /><br /><span style="color: #00C800;">FUNCTION</span> GETPRICE3<span style="color: #000000;">(</span> nDAYS, aPRICE <span style="color: #000000;">)</span><br />nPRICE := <span style="color: #000000;">0</span><br /><br /><span style="color: #00C800;">IF</span> nDAYS = <span style="color: #000000;">0</span><br /> MsgAlert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Day-value missing !"</span>,<span style="color: #ff0000;">"Error"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span> <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">ENDIF</span><br /><br />I := <span style="color: #000000;">1</span><br /><span style="color: #00C800;">FOR</span> I := <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> nDAYS<br /><br /> <span style="color: #B900B9;">// Days < 15 ( max 14 * 7 = 98 Euro )</span><br /> <span style="color: #B900B9;">// ---------------------------------------</span><br /> <span style="color: #00C800;">IF</span> nDAYS < aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <br /> nPRICE := aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> * nDAYS<br /> <span style="color: #00C800;">ENDIF</span> <br /><br /> <span style="color: #B900B9;">// longer >= 15 Days </span><br /> <span style="color: #B900B9;">// --------------------</span><br /> <span style="color: #00C800;">IF</span> nDAYS >= aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> .and. nDAYS <= aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><br /> <span style="color: #B900B9;">// 63 Euro / 15 = 4,20 Euro</span><br /> <span style="color: #B900B9;">// --------------------------------</span><br /> nPRICE := <span style="color: #000000;">(</span> aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> / aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span> * nDAYS <br /> <span style="color: #00C800;">ENDIF</span> <br /><br /> <span style="color: #B900B9;">// longer > 30 Days same calculation of 4,20 Euro each day</span><br /> <span style="color: #B900B9;">// ------------------------------------------------------------------</span><br /> <span style="color: #00C800;">IF</span> nDAYS > aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <br /> <span style="color: #B900B9;">// 63 Euro / 15 Days = 4,20 Euro</span><br /> <span style="color: #B900B9;">// -----------------------------------</span><br /> nPRICE := <span style="color: #000000;">(</span> aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> / aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span> * nDAYS <br /> <span style="color: #00C800;">ENDIF</span> <br /><br /><span style="color: #00C800;">NEXT</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #000000;">(</span> nPRICE <span style="color: #000000;">)</span><br /> </div>[/code:1n2r9kk8]
Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
|
A suggestion :help
|
I must create prices for umbrellas rent
it can be calcolate counting the days of rent
sample :
one day 9.00 euro
seven days 50,00 euro
15 days 100,00 euro
30 days 205,00 euro
but I have a problem
How I can make if I must to pay only for 14 or 18 days or 20 or 25 days ?
do U have an Idea ?
|
A suggestion :help
|
Sivio... use the Fibonacci serie
|
A suggestion :help
|
Silvio:
Just an idea
You must to know the price for each day as follow
9 euros / 1 days = 9 euros each day
50 euros / 7 days = 7.15 euros each day
100 euros / 15 days = 6.67 euros each day and
205 euros / 30 days = 6.84 euros each day
With these prices you make a table
FROM TO Price for each day
1 to 6 9 euros
7 to 14 7.15 euros each day
15 to 29 6.67 euros each day and
30 to 999 6.84 euros each day
Then, an example:
If your customer rent an umbrella for 10 days the price for each day must be 7.15 euros
because 10 is betwen 7 to 14
10 * 7.15 = 71.50 Euros
What do you think ?
Regards
|
A suggestion :help
|
it is a good idea
BUT
if I have 14 days to pay
14*7.15 = 100,1euros
but if I have 15 gg pay 100 euros
if I have 14 or 15 pay the same ??
|
A suggestion :help
|
Silvio:
Then, don't use the rounded prices for each day
9 euros / 1 days = 9 euros each day
50 euros / 7 days = 7.14 euros each day
100 euros / 15 days = 6.66 euros each day and
205 euros / 30 days = 6.83 euros each day
Regards
14 * 7.14 = 99.96 Euros
15 * 6.66 = 99.90 Euros
Regards
|
A suggestion :help
|
Hello Silvio,
I created a function for this ( [color=#FF0000:3pui7beh]Tested and Updated 28.03.2009[/color:3pui7beh] ).
With that it is possible to calculate the price, even with using days are [color=#4000FF:3pui7beh]not Linear[/color:3pui7beh].
In my application, I used it for the calculation of fluctuate prices of articles.
Another exsample how to [color=#FF0000:3pui7beh]keep the price between two given points [/color:3pui7beh],
You can find in my answer to Amando at the bottom. It is very easy and uses the same logic.
Just put some values and tell me Your results.
There are some control-Alerts You can use.
Silvio, maybe You can change the title of the topic in : [color=#FF0000:3pui7beh]How to calculate fluctuate prices ?[/color:3pui7beh]
If somebody needs this calulation, it is better to find.
[img:3pui7beh]http://www.pflegeplus.com/pictures/price3.jpg[/img:3pui7beh]
Test-calculation ( [color=#FF0000:3pui7beh]interpolating[/color:3pui7beh] ) between two given values :
7 Days = 50 Euro and 14 Days = 100 Euro
-----------------------------------------------
7 Days = 50,00 Euro
8 Days = 57,14 Euro
9 Days = 64,29 Euro
10 Days = 71,42 Euro
11 Days = 78,57 Euro
12 Days = 85,71 Euro
13 Days = 92,86 Euro
14 Days = 100,00 Euro
[code=fw:3pui7beh]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00C800;">FUNCTION</span> PRICE_TEST<span style="color: #000000;">(</span>oWnd<span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> oDlg, oGET<br /><br /><span style="color: #B900B9;">// A array DAYS and PRICE</span><br /><span style="color: #B900B9;">// ----------------------------</span><br /><span style="color: #00C800;">PRIVATE</span> aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">6</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><br />aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> := <span style="color: #000000;">{</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">10</span> <span style="color: #000000;">}</span><br />aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> := <span style="color: #000000;">{</span> <span style="color: #000000;">7</span>, <span style="color: #000000;">50</span> <span style="color: #000000;">}</span> <span style="color: #B900B9;">// 12 Days = 50 + ( ( ( 100 - 50 ) / 7 ) * 5 ) = 85.71</span><br />aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> := <span style="color: #000000;">{</span> <span style="color: #000000;">14</span>, <span style="color: #000000;">100</span> <span style="color: #000000;">}</span><br />aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">4</span><span style="color: #000000;">]</span> := <span style="color: #000000;">{</span> <span style="color: #000000;">21</span>, <span style="color: #000000;">130</span> <span style="color: #000000;">}</span> <span style="color: #B900B9;">// 25 Days = 130 + ( ( ( 200 - 130 ) / 7 ) * 4 ) = 170</span><br />aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">5</span><span style="color: #000000;">]</span> := <span style="color: #000000;">{</span> <span style="color: #000000;">28</span>, <span style="color: #000000;">200</span> <span style="color: #000000;">}</span> <br />aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">6</span><span style="color: #000000;">]</span> := <span style="color: #000000;">{</span> <span style="color: #000000;">35</span>, <span style="color: #000000;">200</span> <span style="color: #000000;">}</span> <span style="color: #B900B9;">// 30 Days = 200 + ( ( 200 / ( 35 - 28 ) * 2 ) = 257,14 => End</span><br /><br /><span style="color: #B900B9;">// calculate the price </span><br /><span style="color: #B900B9;">// ----------------------</span><br />nDAYS := <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;">TITLE</span> <span style="color: #ff0000;">"Price Test"</span> <br /><br />@ <span style="color: #000000;">1</span>, <span style="color: #000000;">2</span> <span style="color: #0000ff;">GET</span> oGet <span style="color: #0000ff;">VAR</span> nDAYS <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">30</span>, <span style="color: #000000;">15</span> <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"99"</span><br />@ <span style="color: #000000;">2</span>, <span style="color: #000000;">2</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Price-Test"</span> <span style="color: #0000ff;">size</span> <span style="color: #000000;">50</span>, <span style="color: #000000;">25</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /><span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> oGet:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, ;<br /> nPRICE := GETPRICE1<span style="color: #000000;">(</span> nDAYS, aPRICE <span style="color: #000000;">)</span>, ;<br /> MsgAlert<span style="color: #000000;">(</span> nPrice <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #000000;">(</span> <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #B900B9;">// ------------------------------------------</span><br /><br /><span style="color: #00C800;">FUNCTION</span> GETPRICE1<span style="color: #000000;">(</span> nDAYS, aPRICE <span style="color: #000000;">)</span><br />nPRICE := <span style="color: #000000;">0</span><br /><br /><span style="color: #B900B9;">// Testing days of last Array-Element for valid input</span><br /><span style="color: #B900B9;">// ------------------------------------------------------------</span><br /><span style="color: #00C800;">IF</span> nDAYS = <span style="color: #000000;">0</span><br /> MsgAlert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"No Days-value defined !"</span>,<span style="color: #ff0000;">"Error"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span> <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">IF</span> nDAYS > aPRICE<span style="color: #000000;">[</span>LEN<span style="color: #000000;">(</span>aPRICE<span style="color: #000000;">)</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span><br /> MsgAlert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"To many Days !"</span>,<span style="color: #ff0000;">"Error"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span> <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">ENDIF</span><br /><br />I := <span style="color: #000000;">1</span><br /><span style="color: #00C800;">FOR</span> I := <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> LEN<span style="color: #000000;">(</span> aPRICE <span style="color: #000000;">)</span> <span style="color: #B900B9;">// 6</span><br /> <span style="color: #00C800;">IF</span> I + <span style="color: #000000;">1</span> < LEN<span style="color: #000000;">(</span> aPRICE <span style="color: #000000;">)</span> <span style="color: #B900B9;">// < 6</span><br /><br /> <span style="color: #B900B9;">// Price is defined for nDAYS ( no calculation )</span><br /> <span style="color: #B900B9;">// ---------------------------------------------------</span><br /> <span style="color: #00C800;">IF</span> nDAYS = aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <br /><br /> nPRICE := aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <br /><br /> EXIT<br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #B900B9;">// 1 7 14 21 28 35</span><br /> <span style="color: #B900B9;">// 6 13 20 27 34</span><br /> <span style="color: #B900B9;">// 1-6, 7-13, 14-20, 21-27, 28-34, 35</span><br /><br /> <span style="color: #00C800;">IF</span> nDAYS >= aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> .and. nDAYS <= aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">+1</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">-1</span> <br /><br /> <span style="color: #B900B9;">// nPARTPRICE := ( 100 - 50 ) / ( 14 - 7 ) = 7,14</span><br /> <span style="color: #B900B9;">// aPRICE[3] := { 14, 100 }</span><br /> <span style="color: #B900B9;">// ----</span><br /> <span style="color: #B900B9;">// nPARTPRICE := ( 200 - 130 ) / ( 28 - 21 ) = 10</span><br /> <span style="color: #B900B9;">// aPRICE[5] := { 28, 200 }</span><br /> <span style="color: #B900B9;">// ---------------------------------------------------------</span><br /> nPARTPRICE := <span style="color: #000000;">(</span> aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">+1</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span>- aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span>/<span style="color: #000000;">(</span> aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">+1</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span>- aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span><br /> <br /> <span style="color: #B900B9;">// nPRICE := 50 + ( 7,14 * ( 12 - 7 ) ) = 85,71</span><br /> <span style="color: #B900B9;">// aPRICE[2] := { 7, 50 } </span><br /> <span style="color: #B900B9;">// 12 Days = 50 + ( ( ( 100 - 50 ) / 7 ) * 5 ) = 85.71</span><br /> <span style="color: #B900B9;">// ------</span><br /> <span style="color: #B900B9;">// nPRICE := 130 + ( 10 * ( 25 - 21 ) ) = 170</span><br /> <span style="color: #B900B9;">// aPRICE[4] := { 21, 130 } </span><br /> <span style="color: #B900B9;">// 25 Days = 130 + ( ( ( 200 - 130 ) / 7 ) * 4 ) = 170</span><br /> <span style="color: #B900B9;">// -------------------------------------------------------------</span><br /> nPRICE := aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> + <span style="color: #000000;">(</span> nPARTPRICE * <span style="color: #000000;">(</span> nDAYS - aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">// msgalert( aPRICE[I][2], "1") </span><br /> <span style="color: #B900B9;">// msgalert( nPARTPRICE, "2") </span><br /> <span style="color: #B900B9;">// msgalert( aPRICE[I-1][1], "3") </span><br /><br /> EXIT<br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #B900B9;">// Special calculation needed for last Array-Element</span><br /> <span style="color: #B900B9;">// Last Array-Element only for End of days ( no extra price )</span><br /> <span style="color: #B900B9;">// -------------------------------------------------------------------</span><br /> <span style="color: #00C800;">IF</span> I = LEN<span style="color: #000000;">(</span> aPRICE <span style="color: #000000;">)</span> <span style="color: #B900B9;">// 6</span><br /><br /> <span style="color: #00C800;">IF</span> nDAYS >= aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">-1</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <span style="color: #B900B9;">// Array-Element 5</span><br /><br /> <span style="color: #B900B9;">// aPRICE[5] := { 28, 200 }</span><br /> <span style="color: #B900B9;">// aPRICE[6] := { 35, 200 } // End</span><br /> <span style="color: #B900B9;">// nPARTPRICE := 200 / ( 35 - 28 ) = 28,57</span><br /><br /> <span style="color: #B900B9;">// ----------------------------------------------------------</span><br /> nPARTPRICE := aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> / <span style="color: #000000;">(</span> aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> - aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">-1</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span> <br /> <br /> <span style="color: #B900B9;">// 30 Days = 200 + ( ( 200 / ( 35 - 28 ) * 2 ) = 257,14</span><br /> <span style="color: #B900B9;">// -------------------------------------------------------------------</span><br /> nPRICE := aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> + <span style="color: #000000;">(</span> nPARTPRICE * <span style="color: #000000;">(</span> nDAYS - aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">-1</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">// msgalert( aPRICE[I][2], "1") // 200</span><br /> <span style="color: #B900B9;">// msgalert( nPARTPRICE, "2") // 28,57</span><br /> <span style="color: #B900B9;">// msgalert( aPRICE[I-1][1], "3") // 28</span><br /> <span style="color: #B900B9;">// msgalert( aPRICE[I][1], "4") // 35</span><br /><br /> EXIT<br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #00C800;">NEXT</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #000000;">(</span> nPRICE <span style="color: #000000;">)</span><br /> </div>[/code:3pui7beh]
Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
|
A suggestion :help
|
The Function is Updated ( 28.03.2009 )
Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
|
A suggestion :help
|
Ukoenig:
Taking your example I get these individual prices
7 50.00 7.1429
8 57.14 7.1400
9 64.29 7.1500
10 71.42 7.1300
11 78.57 7.1500
12 85.71 7.1400
13 92.86 7.1500
14 100.00 7.1400
As we can see the price of 9 days is more expensive than the price of 8 days
and the price of 11 days is more expensive than the price of 10 days also.
and so on.
Regards
|
A suggestion :help
|
Hello Armando
The prices are calculated ( interpolated ) between two given prices in my function above.
It is a solution for a part of a merchandise planning and control system.
If You want to [color=#FF0000:233l8mx5]keep the price the same between two given points[/color:233l8mx5], it is very easy to do this.
There is nothing to calculate and the function returns the exact price inside a price-group.
It is the same function-logic like solution 1. Now You have two options, how to get a price.
For me, this logic doesn't make sense, because if somebody rents 14 Days ( start of Group ), it would be
the same like for 20 Days ( end of Group).
Normaly for that, You have to use the special price from this group from 14 to 21 Days and use the
Price for the calculation. Let' say, somebody stays 18 Days, the price for each Day from group 14 to 21 is used.
But it's up to You.
The picture shows the difference between the two solutions :
[img:233l8mx5]http://www.pflegeplus.com/pictures/price4.jpg[/img:233l8mx5]
Returns the same price between two given points
Overview :
[img:233l8mx5]http://www.pflegeplus.com/pictures/price5.jpg[/img:233l8mx5]
[code=fw:233l8mx5]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> PRICE_TEST<span style="color: #000000;">(</span>oWnd<span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> oDlg, oGET<br /><br /><span style="color: #B900B9;">// A array DAYS and PRICE</span><br /><span style="color: #B900B9;">// ----------------------------</span><br /><span style="color: #00C800;">PRIVATE</span> aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">6</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><br />aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> := <span style="color: #000000;">{</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">10</span> <span style="color: #000000;">}</span><br />aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> := <span style="color: #000000;">{</span> <span style="color: #000000;">7</span>, <span style="color: #000000;">50</span> <span style="color: #000000;">}</span> <br />aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> := <span style="color: #000000;">{</span> <span style="color: #000000;">14</span>, <span style="color: #000000;">100</span> <span style="color: #000000;">}</span><br />aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">4</span><span style="color: #000000;">]</span> := <span style="color: #000000;">{</span> <span style="color: #000000;">21</span>, <span style="color: #000000;">130</span> <span style="color: #000000;">}</span> <br />aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">5</span><span style="color: #000000;">]</span> := <span style="color: #000000;">{</span> <span style="color: #000000;">28</span>, <span style="color: #000000;">200</span> <span style="color: #000000;">}</span> <br />aPRICE<span style="color: #000000;">[</span><span style="color: #000000;">6</span><span style="color: #000000;">]</span> := <span style="color: #000000;">{</span> <span style="color: #000000;">35</span>, <span style="color: #000000;">260</span> <span style="color: #000000;">}</span> <br /><br /><span style="color: #B900B9;">// find the Price of a given Day ( Group )</span><br /><span style="color: #B900B9;">// ---------------------------------------------</span><br />nDAYS := <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;">TITLE</span> <span style="color: #ff0000;">"Price Test"</span> <br /><br />@ <span style="color: #000000;">1</span>, <span style="color: #000000;">2</span> <span style="color: #0000ff;">GET</span> oGet <span style="color: #0000ff;">VAR</span> nDAYS <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">30</span>, <span style="color: #000000;">15</span> <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"99"</span><br />@ <span style="color: #000000;">2</span>, <span style="color: #000000;">2</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Price-Test"</span> <span style="color: #0000ff;">size</span> <span style="color: #000000;">50</span>, <span style="color: #000000;">25</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /><span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> oGet:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, ;<br /> nPRICE := GETPRICE2<span style="color: #000000;">(</span> nDAYS, aPRICE <span style="color: #000000;">)</span>, ;<br /> MsgAlert<span style="color: #000000;">(</span> nPrice <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #000000;">(</span> <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #B900B9;">// ------------------------------------------</span><br /><br /><span style="color: #00C800;">FUNCTION</span> GETPRICE2<span style="color: #000000;">(</span> nDAYS, aPRICE <span style="color: #000000;">)</span><br />nPRICE := <span style="color: #000000;">0</span><br /><br /><span style="color: #B900B9;">// Testing days of last Array-Element for valid input</span><br /><span style="color: #B900B9;">// ------------------------------------------------------------</span><br /><span style="color: #00C800;">IF</span> nDAYS = <span style="color: #000000;">0</span><br /> MsgAlert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"No Days-value defined !"</span>,<span style="color: #ff0000;">"Error"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span> <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">IF</span> nDAYS > aPRICE<span style="color: #000000;">[</span>LEN<span style="color: #000000;">(</span>aPRICE<span style="color: #000000;">)</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span><br /> MsgAlert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"To many Days !"</span>,<span style="color: #ff0000;">"Error"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span> <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">ENDIF</span><br /><br />I := <span style="color: #000000;">1</span><br /><span style="color: #00C800;">FOR</span> I := <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> LEN<span style="color: #000000;">(</span> aPRICE <span style="color: #000000;">)</span> <span style="color: #B900B9;">// 6</span><br /><br /><span style="color: #00C800;">IF</span> I < LEN<span style="color: #000000;">(</span> aPRICE <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> nDAYS >= aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> .and. nDAYS < aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">+1</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <br /> nPRICE := aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <br /> EXIT<br /> <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">ELSE</span> <span style="color: #B900B9;">// For the last Array-Element</span><br /> <span style="color: #00C800;">IF</span> nDAYS = aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <br /> nPRICE := aPRICE<span style="color: #000000;">[</span>I<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <br /> EXIT<br /> <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #00C800;">NEXT</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #000000;">(</span> nPRICE <span style="color: #000000;">)</span><br /><br /> </div>[/code:233l8mx5]
Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
|
A suggestion :help
|
Sorry but I have this prices
[img:96bis26x]http://img4.imageshack.us/img4/6781/tariffe20072.gif[/img:96bis26x]
I must create a dbf from it
If I have to pay an umbrellas ( look on jpg first line : ombrellone 1° Fila blue box ) for 14 days How many euros I must ask ?
If you calculare the price of each day for 14 days = 7 x 14 = 98 euro
but you can see on the blu box you can pay for 15 day only 63 euro
then I must pay many euro for 14 day than for 15 days ?
Do U understand my problem ?
|
A todo el Foro FELIZ NAVIDAD
|
Llegada esta Fecha , solo resta MUY FELICES FIESTAS A TODOS y gracias por estar. les mando a todos un fuerte abrazo y que la pasen muy bien juntos a sus afectos.
juan carlos bellucci.
|
A todo el Foro FELIZ NAVIDAD
|
Juan Carlos, igualmente a tí y a todos los amigos del foro.
Saludos.
|
A todo el Foro FELIZ NAVIDAD
|
Juan,
Gracias por todo. FELIZ NAVIDAD a todos deste foro!!
|
A todo el Foro FELIZ NAVIDAD
|
Un saludo muy afectivo para todos!
|
A todo el Foro FELIZ NAVIDAD
|
Gracias por todo. Le deseo una FELIZ NAVIDAD a todos!
|
A todo el Foro FELIZ NAVIDAD
|
Sólo decir gracias por toda la ayuda que en forma desinteresada he recibido siempre de los integrantes del foro.
Desearles a todos que tengan unas felices fiestas y lo mejor para su vida.
Un abrazo.
Rolando <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
A todo el Foro FELIZ NAVIDAD
|
FELICES FIESTAS PARA TODOS, QUE LA PASEN SUPER.
Saludos,
Adhemar
|
A todo el Foro FELIZ NAVIDAD
|
A todo este increible grupo de compañeros y a sus familias
Felíz Navidad y feliz año 2013.
Saludos
Ruben Fernandez
|
A todo el Foro FELIZ NAVIDAD
|
Dios les bendiga
|
A todo el Foro FELIZ NAVIDAD
|
Que la paz reyne en cada uno de vuestros hogares.....
FELIZ NAVIDAD!!!!!
|
A todo el Foro FELIZ NAVIDAD
|
Felices Fiestas !!
|
A todo el Foro FELIZ NAVIDAD
|
Felices Fiestas y Prospero 2013 !!!
Zorionak eta Urte Berri On !!!
|
A todo el Foro FELIZ NAVIDAD
|
Felices fiestas para todos y que este próximo año sea lleno de salud y exitos...
|
A todo el Foro FELIZ NAVIDAD
|
Pués eso,
Espero que hayan pasado o esten pasando una Feliz Navidad.
Que el 2013 no sea un año más en sus vidas. Vívanlo plenamente.
Saludos,
Carlos G.
|
A tool to send email ?
|
Hi friends:
Do you know a very good class, function, lib, dll or tool to send emails from my app, my tools: FWH0810 and xHarbour build 1.1.0 Intl. (SimpLex) (Rev. 6195)?
With best regards
|
A tool to send email ?
|
Here it is:
[code=fw:26kgtr9f]<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;">STATIC</span> hLib<br /><br /><br /><span style="color: #00C800;">FUNCTION</span> MAIN<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> cFrom := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">LOCAL</span> cServer := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">LOCAL</span> cTo := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">LOCAL</span> cSubjeCt := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">LOCAL</span> cMessage := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">LOCAL</span> cSender := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">LOCAL</span> cUser := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">LOCAL</span> cPassword := <span style="color: #ff0000;">""</span><br /><br /> ? SENDMAIL<span style="color: #000000;">(</span> cFrom, cServer, cTo, cSubject, cMessage, , cSender, cUser, cPassword <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> SENDMAIL<span style="color: #000000;">(</span> cFrom, cServer, cTo, cSubject, cMessage, aAttach, cSender, cUser, cPassword, aCc, lHtml, cPort, lNotification <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> cMsgFile := CTEMPFILE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> cCmd := <span style="color: #ff0000;">"SndMail -f "</span> + cFrom + <span style="color: #ff0000;">" -X "</span> + cServer + <span style="color: #ff0000;">" -r "</span> + cTo + <span style="color: #ff0000;">" -s "</span> + <span style="color: #000000;">[</span><span style="color: #ff0000;">"] + cSubject + ["</span><span style="color: #000000;">]</span> + <span style="color: #ff0000;">" -b "</span> + cMsgFile<br /><br /> <span style="color: #00C800;">LOCAL</span> nRes<br /><br /> <span style="color: #00C800;">LOCAL</span> i<br /><br /> <span style="color: #00C800;">DEFAULT</span> lHtml := <span style="color: #ff0000;">"<html"</span> $ LOWER<span style="color: #000000;">(</span> cMessage <span style="color: #000000;">)</span><br /><br /> MEMOWRIT<span style="color: #000000;">(</span> cMsgFile, cMessage + CRLF <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> aAttach <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">FOR</span> i = <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> LEN<span style="color: #000000;">(</span> aAttach <span style="color: #000000;">)</span><br /> cCmd += <span style="color: #ff0000;">" -a "</span> + <span style="color: #000000;">[</span><span style="color: #ff0000;">"] + aAttach[ i ] + ["</span><span style="color: #000000;">]</span><br /> <span style="color: #00C800;">NEXT</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> cSender <span style="color: #000000;">)</span><br /> cCmd += <span style="color: #ff0000;">" -F "</span> + <span style="color: #000000;">[</span><span style="color: #ff0000;">"] + cSender + ["</span><span style="color: #000000;">]</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> cUser <span style="color: #000000;">)</span><br /> cCmd += <span style="color: #ff0000;">" -h LOGIN -u "</span> + cUser<br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> cPassword <span style="color: #000000;">)</span><br /> cCmd += <span style="color: #ff0000;">" -p "</span> + cPassword<br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> aCc <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">FOR</span> i = <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> LEN<span style="color: #000000;">(</span> aCc <span style="color: #000000;">)</span><br /> cCmd += <span style="color: #ff0000;">" -c "</span> + <span style="color: #000000;">[</span><span style="color: #ff0000;">"] + aCc[ i ] + ["</span><span style="color: #000000;">]</span><br /> <span style="color: #00C800;">NEXT</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> lHtml<br /> cCmd += <span style="color: #ff0000;">" -H"</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> cPort <span style="color: #000000;">)</span><br /> cCmd += <span style="color: #ff0000;">" -P "</span> + cPort<br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> lNotification <span style="color: #000000;">)</span><br /> cCmd += <span style="color: #ff0000;">" -t "</span> + <span style="color: #000000;">[</span><span style="color: #ff0000;">"] + "</span>Disposition-Notification-<span style="color: #0000ff;">To</span>: <span style="color: #ff0000;">" + cFrom + ["</span><span style="color: #000000;">]</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> hDLL = LOADLIBRARY<span style="color: #000000;">(</span> <span style="color: #ff0000;">"sndmail.dll"</span> <span style="color: #000000;">)</span><br /><br /> SMTPLIBOPEN<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> nRes = SMTPSENDMAIL<span style="color: #000000;">(</span> cCmd <span style="color: #000000;">)</span><br /><br /> SMTPLIBCLOSE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> FREELIBRARY<span style="color: #000000;">(</span> hDLL <span style="color: #000000;">)</span><br /><br /> FERASE<span style="color: #000000;">(</span> cMsgFile <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">RETURN</span> nRes = <span style="color: #000000;">0</span><br /><br /><br />DLL <span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> SMTPLIBOPEN<span style="color: #000000;">(</span><span style="color: #000000;">)</span> AS VOID;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"USmtpLibOpen"</span> LIB hLib<br /><br />DLL <span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> SMTPSENDMAIL<span style="color: #000000;">(</span> cCmd AS STRING <span style="color: #000000;">)</span> AS LONG;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"USmtpCmdLineSendMail"</span> LIB hLib<br /><br />DLL <span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> SMTPLIBCLOSE<span style="color: #000000;">(</span><span style="color: #000000;">)</span> AS VOID;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"USmtpLibClose"</span> LIB hLib</div>[/code:26kgtr9f]
EMG
|
A tool to send email ?
|
Enrico:
Thanks so much for your sample, I'll test it.
Best regards
|
A tool to send email ?
|
I'm using SndMail:
[url:na6frzwh]http://www.xmailserver.org/davide.html[/url:na6frzwh]
EMG
|
A tool to send email ?
|
Thanks a lot Enrico.
Is it possible a small sample <!-- s:oops: --><img src="{SMILIES_PATH}/icon_redface.gif" alt=":oops:" title="Embarassed" /><!-- s:oops: -->
Best regards
|
A tool to send email ?
|
Enrico,
thanks a lot for the sample and your help !!!
Armando,
change hDLL for hLib.
Best regards,
Felix
|
A tool to send email ?
|
[quote="Baxajaun":oxlqv7c5]change hDLL for hLib.[/quote:oxlqv7c5]
Sorry, my fault.
EMG
|
A tool to send email ?
|
Hi friends...
came out this error when compiling
Error: 'D:\SOFT\SNDMAIL\SNDMAIL-2.5\SNDMAIL.LIB' contains invalid OMF record,
|
A tool to send email ?
|
You don't have to link sndmail.lib. Use sndmail.dll only.
EMG
|
A tool to send email ?
|
Hi,,, (thanks Giordano)
any example with hotmail???
this is my code:
[code=fw:1aombo9n]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> cFrom := <span style="color: #ff0000;">"cliente@hotmail.com"</span><br /> cServer := <span style="color: #ff0000;">"smtp.live.com"</span><br /> cTo := <span style="color: #ff0000;">"willi@hotmail.com"</span><br /> cSubject := <span style="color: #ff0000;">"error system"</span><br /> cMessage := memoread<span style="color: #000000;">(</span><span style="color: #ff0000;">"error.log"</span><span style="color: #000000;">)</span><br /> cSender := <span style="color: #ff0000;">""</span><br /> cUserm := <span style="color: #ff0000;">"cliente"</span><br /> cPassm := <span style="color: #ff0000;">"12345678"</span><br /> ? SENDMAIL<span style="color: #000000;">(</span> cFrom, cServer, cTo, cSubject, cMessage, , cSender, cUserm, cPassm <span style="color: #000000;">)</span><br /> </div>[/code:1aombo9n]
return .F.
suggestions??
|
A tool to send email ?
|
[quote="Willi Quintana":38qvr7xe]Hi,,, (thanks Giordano)[/quote:38qvr7xe]
My name is Enrico. <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
[quote="Willi Quintana":38qvr7xe]any example with hotmail???[/quote:38qvr7xe]
No, sorry. It should work. Does it work using Outlook or similar email apps?
EMG
|
A tool to send email ?
|
hotmail
-P port Set SMTP port { 25 }
port 25 or 995
|
A tool to send email ?
|
Enrico,
I tested Your sample, but nothing happens
FUNCTION MAIN()
[color=#FF0000:3er17qi6]// AOL SMTP-Server ( infos from internet ):
// smtp.de.aol.com for emails ending with aol.com
// login for the SMTP-Server is needed.
// username and password[/color:3er17qi6]
[color=#0000FF:3er17qi6]LOCAL cFrom := "Uwe"
LOCAL cServer := "smtp.de.aol.com"
LOCAL cTo := "esckoenig@aol.com" // my email for testing the mailbox for incomming emails
LOCAL cSubjeCt := "Test"
LOCAL cMessage := "Test"
LOCAL cSender := "Uwe"
LOCAL cUser := "aoluser" // adding my username
LOCAL cPassword := "aolpassword" // adding my password
? SENDMAIL( cFrom, cServer, cTo, cSubject, cMessage, , cSender, cUser, cPassword )
RETURN NIL
FUNCTION SENDMAIL( cFrom, cServer, cTo, cSubject, cMessage, aAttach, cSender, cUser, cPassword, aCc, lHtml, cPort, lNotification )
...
...[/color:3er17qi6]
maybe something missing or not possible to use it ?
or is there maybe another working sample in the meantime
because the post is dated 2011 ?
regards
Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
|
A tool to send email ?
|
I don't use sndmail.dll any longer. Now I'm using CDO.Message:
[code=fw:1pncxhlg]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">FUNCTION</span> SENDMAIL<span style="color: #000000;">(</span> cFrom, cServer, cTo, cSubject, cMessage, aAttach, cSender, cUser, cPassword, aCc, lHtml, cPort, lNotification, lSSL <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> lOk := .F.<br /><br /> <span style="color: #00C800;">LOCAL</span> oCfg, oMsg<br /><br /> <span style="color: #00C800;">LOCAL</span> cCc := <span style="color: #ff0000;">""</span><br /><br /> <span style="color: #00C800;">LOCAL</span> i<br /><br /> <span style="color: #00C800;">DEFAULT</span> lHtml := <span style="color: #ff0000;">"<html"</span> $ LOWER<span style="color: #000000;">(</span> cMessage <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">DEFAULT</span> lNotification := .F.<br /> <span style="color: #00C800;">DEFAULT</span> lSSL := .F.<br /><br /> <span style="color: #00C800;">TRY</span><br /> oCfg = CREATEOBJECT<span style="color: #000000;">(</span> <span style="color: #ff0000;">"CDO.Configuration"</span> <span style="color: #000000;">)</span><br /><br /> oCfg:<span style="color: #000000;">Item</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"http://schemas.microsoft.com/cdo/configuration/smtpserver"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> = cServer<br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> cPort <span style="color: #000000;">)</span><br /> oCfg:<span style="color: #000000;">Item</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"http://schemas.microsoft.com/cdo/configuration/smtpserverport"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := VAL<span style="color: #000000;">(</span> cPort <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> oCfg:<span style="color: #000000;">Item</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"http://schemas.microsoft.com/cdo/configuration/sendusing"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> = <span style="color: #000000;">2</span><br /> oCfg:<span style="color: #000000;">Item</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> = .F.<br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> cUser <span style="color: #000000;">)</span> .AND. !EMPTY<span style="color: #000000;">(</span> cPassword <span style="color: #000000;">)</span><br /> oCfg:<span style="color: #000000;">Item</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> = .T.<br /> oCfg:<span style="color: #000000;">Item</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"http://schemas.microsoft.com/cdo/configuration/sendusername"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> = cUser<br /> oCfg:<span style="color: #000000;">Item</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"http://schemas.microsoft.com/cdo/configuration/sendpassword"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cPassword<br /> oCfg:<span style="color: #000000;">Item</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"http://schemas.microsoft.com/cdo/configuration/smtpusessl"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> = lSSL<br /> <span style="color: #00C800;">ENDIF</span><br /><br /> oCfg:<span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> oMsg = CREATEOBJECT<span style="color: #000000;">(</span> <span style="color: #ff0000;">"CDO.Message"</span> <span style="color: #000000;">)</span><br /><br /> oMsg:<span style="color: #000000;">Configuration</span> = oCfg<br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> cSender <span style="color: #000000;">)</span><br /> cFrom = <span style="color: #000000;">[</span><span style="color: #ff0000;">"] + cSender + ["</span><span style="color: #000000;">]</span> + <span style="color: #ff0000;">" <"</span> + cFrom + <span style="color: #ff0000;">">"</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> oMsg:<span style="color: #0000ff;">From</span> = cFrom<br /> oMsg:<span style="color: #0000ff;">To</span> = cTo<br /> oMsg:<span style="color: #0000ff;">Subject</span> = cSubject<br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> aCc <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">FOR</span> i = <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> LEN<span style="color: #000000;">(</span> aCc <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> i > <span style="color: #000000;">1</span><br /> cCc += <span style="color: #ff0000;">";"</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> cCc += aCc<span style="color: #000000;">[</span> i <span style="color: #000000;">]</span><br /> <span style="color: #00C800;">NEXT</span><br /><br /> oMsg:<span style="color: #000000;">CC</span> = cCc<br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> !lHtml<br /> oMsg:<span style="color: #000000;">TextBody</span> = cMessage<br /> <span style="color: #00C800;">ELSE</span><br /> oMsg:<span style="color: #000000;">HTMLBody</span> = cMessage<br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> aAttach <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">FOR</span> i = <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> LEN<span style="color: #000000;">(</span> aAttach <span style="color: #000000;">)</span><br /> oMsg:<span style="color: #000000;">AddAttachment</span><span style="color: #000000;">(</span> aAttach<span style="color: #000000;">[</span> i <span style="color: #000000;">]</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">NEXT</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> lNotification<br /> oMsg:<span style="color: #000000;">Fields</span>:<span style="color: #000000;">Item</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"urn:schemas:mailheader:disposition-notification-to"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> = cFrom<br /> oMsg:<span style="color: #000000;">Fields</span>:<span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> oMsg:<span style="color: #000000;">Send</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> lOk = .T.<br /> CATCH<br /> END<br /><br /> <span style="color: #00C800;">RETURN</span> lOk</div>[/code:1pncxhlg]
EMG
|
A tool to send email ?
|
Enrico,
thank You very much for the sample.
I will add it to my downloadsection and test it
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
A tool to send email ?
|
Enrico,
Please you can set an example for sendmail (...), for the case of using cServer ?
|
A tool to send email ?
|
Sorry, I haven't understood your question...
EMG
|
A tool to send email ?
|
Perfect! Thanks.
[img:3k3ooe82]http://i.imgur.com/En2CbdA.png[/img:3k3ooe82]
Regards, saludos.
|
A tool to send email ?
|
link for download sndmail.dll
<!-- m --><a class="postlink" href="http://www.xmailserver.org/SndMail-2.5.zip">http://www.xmailserver.org/SndMail-2.5.zip</a><!-- m -->
[code=fw:3aduxr3u]<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> hDll<br /><br /><span style="color: #00C800;">FUNCTION</span> MAIN<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> cFrom := <span style="color: #ff0000;">"joao@pleno.com.br"</span><br /> <span style="color: #00C800;">LOCAL</span> cServer := <span style="color: #ff0000;">"smtp.pleno.com.br"</span><br /> <span style="color: #00C800;">LOCAL</span> cTo := <span style="color: #ff0000;">"joao@pleno.com.br"</span><br /> <span style="color: #00C800;">LOCAL</span> cSubjeCt := <span style="color: #ff0000;">"Test with sendmail.dll"</span><br /> <span style="color: #00C800;">LOCAL</span> cMessage := <span style="color: #ff0000;">"Test with sendmail.dll - Email Body"</span><br /> <span style="color: #00C800;">LOCAL</span> cSender := <span style="color: #ff0000;">"joao@pleno.com.br"</span><br /> <span style="color: #00C800;">LOCAL</span> cUser := <span style="color: #ff0000;">"joao@pleno.com.br"</span><br /> <span style="color: #00C800;">LOCAL</span> cPassword := <span style="color: #ff0000;">"xxxx999"</span><br /> <span style="color: #00C800;">LOCAL</span> aAttach := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /> <span style="color: #00C800;">LOCAL</span> aCc := <span style="color: #ff0000;">""</span> <span style="color: #B900B9;">//???</span><br /> <span style="color: #00C800;">LOCAL</span> lHtml := .F.<br /> <span style="color: #00C800;">LOCAL</span> cPort := <span style="color: #ff0000;">"587"</span><br /> <span style="color: #00C800;">LOCAL</span> lNotification := .F. <span style="color: #B900B9;">// cFrom</span><br /> <span style="color: #00C800;">LOCAL</span> lRet<br /><br /> lRet := SENDMAIL<span style="color: #000000;">(</span> cFrom, cServer, cTo, cSubject, cMessage, cSender, cUser, cPassword, aAttach, aCc, lHtml, cPort, lNotification <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> lRet<br /><br /> ? <span style="color: #ff0000;">"Message sent successfully"</span><br /><br /> <span style="color: #00C800;">ELSE</span><br /><br /> ? <span style="color: #ff0000;">"Unsent message check windows live mail"</span><br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #00C800;">FUNCTION</span> SENDMAIL<span style="color: #000000;">(</span> cFrom, cServer, cTo, cSubject, cMessage, cSender, cUser, cPassword, aAttach, aCc, lHtml, cPort, lNotification <span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #00C800;">LOCAL</span> cMsgFile := CTEMPFILE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> cCmd := <span style="color: #ff0000;">"SndMail -f "</span> + cFrom + <span style="color: #ff0000;">" -X "</span> + cServer + <span style="color: #ff0000;">" -r "</span> + cTo + <span style="color: #ff0000;">" -s "</span> + <span style="color: #000000;">[</span><span style="color: #ff0000;">"] + cSubject + ["</span><span style="color: #000000;">]</span> + <span style="color: #ff0000;">" -b "</span> + cMsgFile<br /><br /> <span style="color: #00C800;">LOCAL</span> nRes<br /><br /> <span style="color: #00C800;">LOCAL</span> i<br /><br /> <span style="color: #00C800;">DEFAULT</span> lHtml := <span style="color: #ff0000;">"<html"</span> $ LOWER<span style="color: #000000;">(</span> cMessage <span style="color: #000000;">)</span><br /><br /> MEMOWRIT<span style="color: #000000;">(</span> cMsgFile, cMessage + CRLF <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> aAttach <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">FOR</span> i = <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> LEN<span style="color: #000000;">(</span> aAttach <span style="color: #000000;">)</span><br /> cCmd += <span style="color: #ff0000;">" -a "</span> + <span style="color: #000000;">[</span><span style="color: #ff0000;">"] + aAttach[ i ] + ["</span><span style="color: #000000;">]</span><br /> <span style="color: #00C800;">NEXT</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> cSender <span style="color: #000000;">)</span><br /> cCmd += <span style="color: #ff0000;">" -F "</span> + <span style="color: #000000;">[</span><span style="color: #ff0000;">"] + cSender + ["</span><span style="color: #000000;">]</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> cUser <span style="color: #000000;">)</span><br /> cCmd += <span style="color: #ff0000;">" -h LOGIN -u "</span> + cUser<br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> cPassword <span style="color: #000000;">)</span><br /> cCmd += <span style="color: #ff0000;">" -p "</span> + cPassword<br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> aCc <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">FOR</span> i = <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> LEN<span style="color: #000000;">(</span> aCc <span style="color: #000000;">)</span><br /> cCmd += <span style="color: #ff0000;">" -c "</span> + <span style="color: #000000;">[</span><span style="color: #ff0000;">"] + aCc[ i ] + ["</span><span style="color: #000000;">]</span><br /> <span style="color: #00C800;">NEXT</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> lHtml<br /> cCmd += <span style="color: #ff0000;">" -H"</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> cPort <span style="color: #000000;">)</span><br /> cCmd += <span style="color: #ff0000;">" -P "</span> + cPort<br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> lNotification <span style="color: #000000;">)</span><br /> cCmd += <span style="color: #ff0000;">" -t "</span> + <span style="color: #000000;">[</span><span style="color: #ff0000;">"] + "</span>Disposition-Notification-<span style="color: #0000ff;">To</span>: <span style="color: #ff0000;">" + cFrom + ["</span><span style="color: #000000;">]</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> hDLL = LOADLIBRARY<span style="color: #000000;">(</span> <span style="color: #ff0000;">"sndmail.dll"</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> hDll = <span style="color: #000000;">0</span><br /> ? <span style="color: #000000;">[</span>Install sendmail.dll.. <span style="color: #000000;">]</span><br /> __QUIT<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ELSE</span><br /> SMTPLIBOPEN<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// OPEN sndmail.dll</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> nRes = SMTPSENDMAIL<span style="color: #000000;">(</span> cCmd <span style="color: #000000;">)</span><br /><br /> SMTPLIBCLOSE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> FREELIBRARY<span style="color: #000000;">(</span> hDLL <span style="color: #000000;">)</span><br /><br /> FERASE<span style="color: #000000;">(</span> cMsgFile <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> nRes = <span style="color: #000000;">0</span><br /><br />DLL <span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> SMTPLIBOPEN<span style="color: #000000;">(</span><span style="color: #000000;">)</span> AS VOID;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"USmtpLibOpen"</span> LIB hDll<br /><br />DLL <span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> SMTPSENDMAIL<span style="color: #000000;">(</span> cCmd AS STRING <span style="color: #000000;">)</span> AS LONG;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"USmtpCmdLineSendMail"</span> LIB hDll<br /><br />DLL <span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> SMTPLIBCLOSE<span style="color: #000000;">(</span><span style="color: #000000;">)</span> AS VOID;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"USmtpLibClose"</span> LIB hDll<br /><br /><span style="color: #B900B9;">// END OF PROGRAM</span><br /> </div>[/code:3aduxr3u]
|
A tool to send email ?
|
[url:23hhthgx]http://www.4shared.com/zip/yOCLl-p-ba/SNDMAIL.html[/url:23hhthgx]
|
A tool to send email ?
|
Enrico,
puedes mostrar un ejemplo de uso de sendmail() con el parametro cServer ?
Google translator :
you can show an example of using sendmail () with the parameter cServer?
|
A tool to send email ?
|
The parameter cServer is the smtp server used to send the email.
EMG
|
A tool to send email ?
|
Is it working to send with TLS/e-mails?
|
A tool to send email ?
|
> Is it working to send with TLS/e-mails?
In my opinion the answer is NO
Bye
|
A tool to send email ?
|
Is there some way to do this ?
|
A tool to send email ?
|
Please read this:
[url:2krcw3ju]http://forums.fivetechsupport.com/viewtopic.php?f=3&t=21490#p191444[/url:2krcw3ju]
EMG
|
A toolbox of netfunctions and tDatabase-tests
|
Hello,
I'm working on a toolbox of netfunctions to control
any network-error.
You can open a DBF twice and test the different netfunctions.
Sample 1 : trying to ZAP a DBF
it will show your own defined error-messages.
[img:35em2fop]http://www.pflegeplus.com/IMAGES/Network2.jpg[/img:35em2fop]
Sample 2 : trying to RECALL a record that is in use
it will show your own defined error-messages.
[img:35em2fop]http://www.pflegeplus.com/IMAGES/Network3.jpg[/img:35em2fop]
I hope it will be usable.
// ---------- NET - FUNCTIONS ----------------------------
// --------------------------------------------------------------------
[color=#0040FF:35em2fop]FUNCTION NET_USE ( cDBName, cAlias, nTrials, lNet )
FUNCTION NET_RLOCK( nTrials )
FUNCTION NET_ULOCK()
FUNCTION NET_FLOCK ( nTrials )
FUNCTION NET_WAIT ( nTrials )
FUNCTION SHOW_WAIT( nTrials, oMeter, oText1 )
FUNCTION NET_DELETE ( nTrials )
FUNCTION NET_RECALL ( nTrials )
FUNCTION NET_APPEND ( nTrials )
FUNCTION NET_PACK( cDBName, cAlias, nTrials )
FUNCTION NET_PACK1( cDBName, cAlias, nTrials )
FUNCTION PACK1()
FUNCTION NET_ZAP( cDBName, cAlias, nTrials )
FUNCTION ZAP1()
FUNCTION NET_CLOSE( nTrials )
FUNCTION NET_ORDER
FUNCTION NET_COPY ( cALIAS, nStart, nEnd, nTrials )[/color:35em2fop]
sample : open a DBF
[code=fw:35em2fop]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// ---------- NET - FUNCTIONS ----------------------------</span><br /><span style="color: #B900B9;">// --------------------------------------------------------------------</span><br /><br /><span style="color: #00C800;">FUNCTION</span> NET_USE <span style="color: #000000;">(</span> cDBName, cAlias, nTrials, lNet <span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> lReturn := .T.<br /><span style="color: #00C800;">LOCAL</span> lOpen := .F.<br /><span style="color: #00C800;">LOCAL</span> nTrcount := nTrials<br /><span style="color: #00C800;">LOCAL</span> YesNo := .F.<br /><br /><span style="color: #B900B9;">// SHARED all Users</span><br /><span style="color: #B900B9;">// EXCLUSIVE 1 User</span><br /><br /><span style="color: #00C800;">IF</span> !File<span style="color: #000000;">(</span> cDBName <span style="color: #000000;">)</span><br /> nMsgBox <span style="color: #000000;">(</span><span style="color: #ff0000;">"File -> "</span> + cDBName + <span style="color: #ff0000;">" is missing !"</span>, <span style="color: #ff0000;">"Attention !"</span><span style="color: #000000;">)</span><br /> SET RESOURCES <span style="color: #0000ff;">to</span><br /> set _3DLOOK OFF<br /> FreeLibrary<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> CLOSE DATABASE<br /> QUIT<br /><span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> nTrcount <= nTrials<br /> <span style="color: #00C800;">IF</span> !lNet<br /> USE &cDBName <span style="color: #0000ff;">ALIAS</span> &cAlias <span style="color: #00C800;">NEW</span> VIA <span style="color: #ff0000;">"DBFCDX"</span> EXCLUSIVE<br /> <span style="color: #00C800;">ELSE</span><br /> USE &cDBName <span style="color: #0000ff;">ALIAS</span> &cAlias <span style="color: #00C800;">NEW</span> VIA <span style="color: #ff0000;">"DBFCDX"</span> SHARED<br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">IF</span> !NETERR<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> lReturn := .T.<br /> <span style="color: #00C800;">ELSE</span><br /> <span style="color: #00C800;">IF</span> lNet = .T.<br /> Status := <span style="color: #ff0000;">"SHARED"</span><br /> <span style="color: #00C800;">ELSE</span><br /> Status := <span style="color: #ff0000;">"EXCLUSIVE"</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">IF</span> nTrcount = nTrials<br /> xName := WNetGetUser<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> MsgYesNo<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Open "</span> + Status + <span style="color: #ff0000;">" of "</span> + upper<span style="color: #000000;">(</span>cDBName<span style="color: #000000;">)</span> + <span style="color: #ff0000;">" not possible !"</span> + ;<br /> <span style="color: #ff0000;">" try again ?"</span>, <span style="color: #ff0000;">"Network-error -> &xName !"</span> <span style="color: #000000;">)</span><br /> nTrials := nTrcount<br /> <span style="color: #00C800;">IF</span> nTrials > <span style="color: #000000;">0</span> <br /> NET_WAIT <span style="color: #000000;">(</span> nTrcount, nTrials <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ELSE</span><br /> lReturn := .F.<br /> EXIT<br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ENDIF</span><br /> nTrials --<br /><span style="color: #00C800;">ENDDO</span><br /><br /><span style="color: #00C800;">RETURN</span> lReturn<br /> </div>[/code:35em2fop]
regards
Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
|
A toolbox of netfunctions and tDatabase-tests
|
Uwe,
You should be using database objects. Some messaging is already built into TDatabase. If those don't meet your desires then you can subclass and write your own. This much easier than calling a bunch of functions each time you try to lock or save a record. You just do oCustomer:save() and it locks, saves, and unlocks with messaging and retrys if the lock fails. Simple, one line of code.
Users don't know or care how or where the data resides so I wouldn't be giving them types of messages you are. Give them something simple like "Update failed to complete, try again?" They don't care why or the path and name of the data file.
|
A toolbox of netfunctions and tDatabase-tests
|
James,
I had a look at TDatabase.
That looks much better and I will rebuild my sample
switching from the old fashion way to TDatabase.
Is there somewhere a recommended sample about the usage ?
I found only little solution parts inside the forum.
regards
Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
|
A toolbox of netfunctions and tDatabase-tests
|
I finished sample 1 and started with a second one using [color=#4000FF:dwfamufb][b:dwfamufb]TDataBase()[/b:dwfamufb][/color:dwfamufb]
testing the netfunctions.
It is the first time testing TDataBase() and i might be wrong
and I have to do some changes.
Maybe a language-support is possible like ?
[color=#0000FF:dwfamufb]METHOD Recall(cMsg1, cMsg2) CLASS TDataBase
MsgAlert( cMsg1, cMsg2 )
//MsgAlert( "DataBase in use", "Please try again" )[/color:dwfamufb]
I noticed a problem with PACK and ZAP
( all other functions are working )
I tested to change from SHARED to EXCLUSIVE because of testing PACK and ZAP.
A errormessage is shown ( that is Ok ). But in case of a error it must stay SHARED !!!
But the status changes to EXCLUSIVE even with the errormessage and crashes on exit-button.
Opening as a single user it is Ok.
I think the problem belongs to :
METHOD Open( cAlias, cFile, cDriver, lShared, lReadOnly, cPassword ) CLASS TDataBase
[color=#FF0000:dwfamufb]::Use()[/color:dwfamufb]
[color=#0000FF:dwfamufb]METHOD Use() CLASS TDataBase
...
...
if ::td_ExecLoop( { || dbUseArea( .t., ::cDriver, ::cFile, ::cAlias, ::lShared, ::lReadOnly ) }, ;
"Unable to open " + ::cFile + ". Retry?" )
::SetArea( Select() )
SELECT 0
else
::nArea := 0
::cAlias := ""
return .f.
endif
...
...
return ::Used()[/color:dwfamufb]
[code=fw:dwfamufb]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> NET_PACKZAP<span style="color: #000000;">(</span>nStyle<span style="color: #000000;">)</span><br /><br />MsgAlert<span style="color: #000000;">(</span> oCust:<span style="color: #000000;">lShared</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// .T. SHARED ok</span><br />oCust:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br />oCust:= TDataBase<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> ,<span style="color: #ff0000;">"CUSTOMER.dbf"</span>, <span style="color: #ff0000;">"DBFCDX"</span>, .F. <span style="color: #000000;">)</span> <span style="color: #B900B9;">// try open EXCLUSIVE</span><br /><span style="color: #B900B9;">// Errormessage but oCust:lShared() shows .F. ( exclusive )</span><br />MsgAlert<span style="color: #000000;">(</span> oCust:<span style="color: #000000;">lShared</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// shows .F. !!! and crashes</span><br /><br /><span style="color: #00C800;">IF</span> oCust:<span style="color: #000000;">lShared</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> = .F.<br /> <span style="color: #00C800;">IF</span> nStyle = <span style="color: #000000;">1</span><br /> oCust:<span style="color: #000000;">Pack</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /> <span style="color: #00C800;">ELSE</span><br /> oCust:<span style="color: #000000;">Zap</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /> <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">ELSE</span><br /> MsgAlert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Not possible to open EXCLUSIVE"</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #B900B9;">// back opening SHARED</span><br />oCust:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br />oCust:= TDataBase<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"CUST"</span>, <span style="color: #ff0000;">"CUSTOMER"</span>, <span style="color: #ff0000;">"DBFCDX"</span>, .T. <span style="color: #000000;">)</span> <br /><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span> <span style="color: #00C800;">NIL</span><span style="color: #000000;">)</span><br /> </div>[/code:dwfamufb]
[img:dwfamufb]http://www.pflegeplus.com/IMAGES/Network6.jpg[/img:dwfamufb]
[img:dwfamufb]http://www.pflegeplus.com/IMAGES/Network7.jpg[/img:dwfamufb]
regards
Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
|
A toolbox of netfunctions and tDatabase-tests
|
Uwe,
The code below packs the file just fine.
Your error message indicates that the file was not open. Did you have it open elsewhere in your program? You can't have it open in a browse and then open it again in exclusive use.
James
[code=fw:3nca6zbl]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">// Test TDatabase:pack()</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #00C800;">Function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> use customer<br /> copy <span style="color: #0000ff;">to</span> temp<br /> use temp<br /> delete all<br /> close<br /> <br /> oCustomers:= TDatabase<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span>,<span style="color: #ff0000;">"temp"</span>,,.f.<span style="color: #000000;">)</span><br /> oCustomers:<span style="color: #000000;">use</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">(</span> oCustomers:<span style="color: #000000;">used</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>,<span style="color: #ff0000;">"oCustomers:used()"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// Returns .T.</span><br /> <br /> <span style="color: #00C800;">if</span> oCustomers:<span style="color: #000000;">used</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">(</span> oCustomers:<span style="color: #000000;">lShared</span>, <span style="color: #ff0000;">"oCustomers:lShared"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// Returns .F.</span><br /> oCustomers:<span style="color: #000000;">pack</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Done packing."</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span></div>[/code:3nca6zbl]
|
A toolbox of netfunctions and tDatabase-tests
|
Uwe,
Also you must have oCust declared as a static because you didn't pass it. I don't recommend using statics.
And I don't recommend calling functions to manipulate the database. If you want to modify the database's behavior then create a subclass and override a method (like Zap()).
[code=fw:1s0hqy52]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">Class</span> MyDatabase <span style="color: #0000ff;">from</span> TDatabase<br /> <span style="color: #00C800;">Method</span> Zap<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endclass</span><br /><br /><span style="color: #00C800;">Method</span> Zap<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">Class</span> MyDatabase<br /> <span style="color: #00C800;">Local</span> lSuccess:=.F.<br /> <span style="color: #00C800;">if</span> ! :<span style="color: #000000;">lShared</span><br /> ::<span style="color: #00C800;">super</span>:<span style="color: #000000;">zap</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> lSuccess := .T.<br /> <span style="color: #00C800;">else</span><br /> <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"File busy now. Cannot zap()."</span>, <span style="color: #ff0000;">"Information"</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><span style="color: #00C800;">Return</span> lSuccess</div>[/code:1s0hqy52]
|
A toolbox of netfunctions and tDatabase-tests
|
Uwe,
I forgot to ask, did you get the papers I sent you on object-oriented programming?
|
A toolbox of netfunctions and tDatabase-tests
|
James,
Thank You very much. I received Your Emails.
Next I tested Your PACK-sample.
Packing works, but I need something more :
after PACK I have to close EXCLUSIVE and switch back to SHARED to refresh xBrowse.
Adding these two missing steps I noticed a problem.
[color=#FF0000:3t1exftx]Application
===========
Error description: Error BASE/1002 Alias does not exist: CUST
Stack Calls
===========
Called from: .\TDATAB.PRG => (b)DATABASE( 135 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:CHANGE( 1786 )[/color:3t1exftx]
From inside the created netfunction-section ( part 1 ) it works.
the needed steps :
[color=#0000FF:3t1exftx]USE
USE "Customer" ALIAS "Cust" NEW VIA "DBFCDX" EXCLUSIVE
PACK
USE
USE "Customer" ALIAS "Cust" NEW VIA "DBFCDX" SHARED[/color:3t1exftx]
[code=fw:3t1exftx]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> NET_PACK<span style="color: #000000;">(</span> cDBName, cAlias, nTrials <span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> lReturn := .F., nReturn := <span style="color: #000000;">0</span><br /><span style="color: #00C800;">LOCAL</span> nTrcount := nTrials<br /><br /><span style="color: #00C800;">IF</span> MsgYesNo<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Pack File : "</span> + upper<span style="color: #000000;">(</span>cDBName<span style="color: #000000;">)</span> , <span style="color: #ff0000;">"DBF Pack !"</span> <span style="color: #000000;">)</span><br /> act_ord := NET_ORDER<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> SET FILTER <span style="color: #0000ff;">TO</span><br /> SET <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">TO</span><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> nTrCount <= nTrials .and. nTrcount > <span style="color: #000000;">0</span><br /> <span style="color: #00C800;">IF</span> NET_CLOSE<span style="color: #000000;">(</span> nTrials <span style="color: #000000;">)</span> = .F.<br /> nReturn = <span style="color: #000000;">2</span><br /> EXIT<br /> <span style="color: #00C800;">ELSE</span><br /> <span style="color: #B900B9;">// .T. = SHARED all Users</span><br /> <span style="color: #B900B9;">// .F. = EXCLUSIVE 1 User</span><br /> <span style="color: #00C800;">IF</span> NET_USE <span style="color: #000000;">(</span> cDBName, cAlias, nTrials, .F. <span style="color: #000000;">)</span> <span style="color: #B900B9;">// EXCLUSIVE</span><br /> MsgRun<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Pack File : "</span> + upper<span style="color: #000000;">(</span>cDBName<span style="color: #000000;">)</span>, <span style="color: #ff0000;">"Please wait......."</span>,;<br /> <span style="color: #000000;">{</span> || PACK1<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> NET_CLOSE<span style="color: #000000;">(</span> nTrcount <span style="color: #000000;">)</span> = .T.<br /> <span style="color: #00C800;">IF</span> NET_USE <span style="color: #000000;">(</span> cDBName, cAlias, nTrials, .T. <span style="color: #000000;">)</span> <span style="color: #B900B9;">// SHARED</span><br /> nReturn = <span style="color: #000000;">1</span><br /> EXIT<br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ENDIF</span><br /> nTrcount --<br /> <span style="color: #00C800;">IF</span> nTrcount <= nTrials<br /> NET_USE <span style="color: #000000;">(</span> cDBName, cAlias, nTrials, .T. <span style="color: #000000;">)</span> <span style="color: #B900B9;">// SHARED</span><br /> nReturn = <span style="color: #000000;">2</span><br /> EXIT<br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> nTrcount --<br /><br /> <span style="color: #00C800;">ENDDO</span><br /><span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #00C800;">IF</span> nReturn = <span style="color: #000000;">1</span><br /> MsgWait<span style="color: #000000;">(</span> <span style="color: #ff0000;">"File : "</span> + cDBName + <span style="color: #ff0000;">" packed !"</span>, <span style="color: #ff0000;">"Attention !"</span>, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> lReturn := .T.<br /><span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">IF</span> nReturn = <span style="color: #000000;">2</span><br /> MsgAlert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"ERROR pack File : "</span> + cDBName, <span style="color: #ff0000;">"Attention !"</span>, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #000000;">(</span>lReturn<span style="color: #000000;">)</span><br /> </div>[/code:3t1exftx]
Now it is possible to switch between the different tests
[img:3t1exftx]http://www.pflegeplus.com/IMAGES/Network8.jpg[/img:3t1exftx]
regards
Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
|
A toolbox of netfunctions and tDatabase-tests
|
Uwe,
[quote:3o9747z6]Next I tested Your PACK-sample.
Packing works, but I need something more :
after PACK I have to close EXCLUSIVE and switch back to SHARED to refresh xBrowse.
Adding these two missing steps I noticed a problem.
Error description: Error BASE/1002 Alias does not exist: CUST
[/quote:3o9747z6]
Well I can't help much without seeing your code.
From the error message I assume you are using the alias "CUST." Database objects generate their own alias so you can't specify a different one. Well, actually you can but you shouldn't. Unique aliases are automatically generated each time a database object is opened--and you can open multiple copies of a database object (even in the same function).
Did you use the code I posted for your test?
|
A toolbox of netfunctions and tDatabase-tests
|
James,
Yes I tested Your sample.
I will post the complete tool with a download-link.
With that it will be possible to have something useful to work on.
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
A toolbox of netfunctions and tDatabase-tests
|
Uwe,
I just noticed that the error occurred in xBrowse. I suspect you specified "CUST" was the alias. You need to do this to specify that the browse is using a database object:
oBrw:SetoDBF( oDatabase ) // where oDatabase is whatever name you have used for the database object
oBrw gets the alias from there.
James
|
A toolbox of netfunctions and tDatabase-tests
|
James,
here is the downloadlink
still some improvements must be done
but the basics are working.
DOWNLOAD
<!-- m --><a class="postlink" href="http://www.pflegeplus.com/DOWNLOADS/Network.zop">http://www.pflegeplus.com/DOWNLOADS/Network.zop</a><!-- m -->
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
A toolbox of netfunctions and tDatabase-tests
|
[quote:3ajpdvkl]Uwe wrote:
cAlias := cGetNewAlias( "CUST" )
USE CUSTOMER NEW ALIAS (cAlias) SHARED VIA "DBFCDX"
oCust := TDataBase():New( Select( cAlias ) )
[/quote:3ajpdvkl]
The above should be this simple:
oCustomers:= TCustomers():New()
You need to create a class for each file and the class name should be plural (Customers for tables)
Later you will want to create record classes and they should be singular (Customer)
Forget aliases--you will rarely, if ever, need to use them again.
[code=fw:3ajpdvkl]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #00C800;">Function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> oCustomers<br /> <br /> oCustomers:= TCustomers<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// simple, one line. File is open in shared mode.</span><br /> <span style="color: #B900B9;">// Indexes are open, in rimary key index order, at top of file</span><br /> <span style="color: #B900B9;">// One line!</span><br /> <span style="color: #B900B9;">// Display first 3 customer names</span><br /> <span style="color: #00C800;">for</span> i = <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> <span style="color: #000000;">3</span><br /> <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">(</span> oCustomers:<span style="color: #0000ff;">Name</span>, <span style="color: #ff0000;">"Customer Name"</span><span style="color: #000000;">)</span><br /> oCustomers:<span style="color: #000000;">skip</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">next</span><br /> <br /> browse<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//---------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">Class</span> TCustomers <span style="color: #0000ff;">from</span> TDatabase<br /> <span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endclass</span><br /><br /><span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span>lShared<span style="color: #000000;">)</span> <span style="color: #00C800;">Class</span> TCustomers<br /> <span style="color: #00C800;">Default</span> lShared := .T.<br /> ::<span style="color: #00C800;">super</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span>,<span style="color: #ff0000;">"customer"</span>,,lShared<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">use</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">setOrder</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">gotop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">self</span></div>[/code:3ajpdvkl]
|
A toolbox of netfunctions and tDatabase-tests
|
with browse() you cannot show any record
See oCustomers ( tdatabase ) and oCustomer (TdataRow)
[code=fw:3g4o54kn]<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;">Function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> oCustomers<br /><br /> oCustomers:= TCustomers<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// simple, one line. File is open in shared mode.</span><br /> <span style="color: #B900B9;">// Indexes are open, in primary key index order, at top of file</span><br /> <span style="color: #B900B9;">// One line!</span><br /><br /> xbrowser oCustomers <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Customer"</span><br /><br /><br /> <span style="color: #B900B9;">// Display first 3 customer names with TdataRow</span><br /><br /> ocustomer:=TCustomer<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span>oCustomers<span style="color: #000000;">)</span> <span style="color: #B900B9;">//TdataRow</span><br /><br /> <span style="color: #00C800;">for</span> i = <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> <span style="color: #000000;">3</span><br /> <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">(</span> ocustomer:<span style="color: #000000;">first</span>, <span style="color: #ff0000;">"Customer Name"</span><span style="color: #000000;">)</span><br /> * oCustomer:<span style="color: #000000;">skip</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">next</span><br /><br /><br /> <span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br /><br /> <span style="color: #B900B9;">//---------------------------------------------------------------------------//</span><br /><br /> <span style="color: #00C800;">Class</span> TCustomers <span style="color: #0000ff;">from</span> TDatabase<br /> <span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Endclass</span><br /><br /> <span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span>lShared<span style="color: #000000;">)</span> <span style="color: #00C800;">Class</span> TCustomers<br /> <span style="color: #00C800;">Default</span> lShared := .T.<br /> ::<span style="color: #00C800;">super</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span>,<span style="color: #ff0000;">"customer"</span>,,lShared<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">use</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">setOrder</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">gotop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">Return</span> <span style="color: #00C800;">self</span><br /> <span style="color: #B900B9;">//---------------------------------------------------------------------------//</span><br /> <span style="color: #00C800;">CLASS</span> TCustomer <span style="color: #0000ff;">From</span> TDataRow<br /> <span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDCLASS</span><br /><br /> <span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span>oTable <span style="color: #000000;">)</span><br /> ::<span style="color: #00C800;">super</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> oTable <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Return</span> <span style="color: #00C800;">self</span><br /> </div>[/code:3g4o54kn]
|
A toolbox of netfunctions and tDatabase-tests
|
Silvio,
function Browse() is not compatible with tDatabase.
tested from inside the tool
[img:2g3kn2ml]http://www.pflegeplus.com/IMAGES/Network11.jpg[/img:2g3kn2ml]
also You can use from folder < samples > [color=#0000FF:2g3kn2ml]xbradded.prg [/color:2g3kn2ml]
next select [color=#0000FF:2g3kn2ml]tDatabase[/color:2g3kn2ml] and You can browse the file customer.
[img:2g3kn2ml]http://www.pflegeplus.com/IMAGES/Network9.jpg[/img:2g3kn2ml]
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
A toolbox of netfunctions and tDatabase-tests
|
James,
here is the new downloadlink
PACK and ZAP is working now <!-- s:roll: --><img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" /><!-- s:roll: -->
some more improvements are done :
closing the program, the number of the last selected sample is saved to a INI-file
and will be opened at the next start.
Using different colours on each of the 3 samples
A new empty dialog is added to include more tests.
I couldn't find a replacement of
h := FW_RecToHash() <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: --> replacement -> h := ReadToHash() <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
FW_HashToRec( h ) <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
DOWNLOAD
<!-- m --><a class="postlink" href="http://www.pflegeplus.com/DOWNLOADS/Network.zop">http://www.pflegeplus.com/DOWNLOADS/Network.zop</a><!-- m -->
( rename zop to zip )
[img:2xg03ky3]http://www.pflegeplus.com/IMAGES/Network10.jpg[/img:2xg03ky3]
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
A toolbox of netfunctions and tDatabase-tests
|
[quote="ukoenig":1nhcdyrx]Silvio,
function Browse() is not compatible with tDatabase.
tested from inside the tool
[img:1nhcdyrx]http://www.pflegeplus.com/IMAGES/Network11.jpg[/img:1nhcdyrx]
also You can use from folder < samples > [color=#0000FF:1nhcdyrx]xbradded.prg [/color:1nhcdyrx]
next select [color=#0000FF:1nhcdyrx]tDatabase[/color:1nhcdyrx] and You can browse the file customer.
[img:1nhcdyrx]http://www.pflegeplus.com/IMAGES/Network9.jpg[/img:1nhcdyrx]
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->[/quote:1nhcdyrx]
Uwe,
I not write Browse() but[b:1nhcdyrx] xbrowser oCustomers[/b:1nhcdyrx]
James wrote Browse()
|
A toolbox of netfunctions and tDatabase-tests
|
Uwe,
do you try it on Lan Network xbradded.prg ?
When I edit a customer I open Custedit() ok ?
and Insert new customer [b:ll5jfye7]Number 501[/b:ll5jfye7]
But I not save it because I'm distracted or I have to go to the bathroom or I'm having coffee...
and I leave the window open
[code=fw:ll5jfye7]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> CustEditDlg<span style="color: #000000;">(</span> oRec <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oDlg, oFont, oGrp<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"TAHOMA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-14</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">618</span>,<span style="color: #000000;">382</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"CUSTOMER"</span><br /> </div>[/code:ll5jfye7]
You are on another terminal and Open the same function Custedit() and Insert new customer [b:ll5jfye7]Number 501[/b:ll5jfye7]
and save it
when I return back also I save the customer and we have a surprice...
[b:ll5jfye7]two records with the same number 501[/b:ll5jfye7]
|
A toolbox of netfunctions and tDatabase-tests
|
I finished the tests with many improvements.
Field copy and field replacements.
Once the original DBF is destrroyed from testing, You can restore it from CUST_ORG.dbf
No problems found. <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
( Just let me know if there is still something wrong )
The new third dialog can be used for Your own tests and works from code.
DOWNLOAD
<!-- m --><a class="postlink" href="http://www.pflegeplus.com/DOWNLOADS/Network.zop">http://www.pflegeplus.com/DOWNLOADS/Network.zop</a><!-- m -->
( rename zop to zip )
[img:vvh9fwtf]http://www.pflegeplus.com/IMAGES/Network12.jpg[/img:vvh9fwtf]
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
A toolbox of netfunctions and tDatabase-tests
|
After many tests and changes
( 3 empty dialogs are added for more tests )
included
tests of : [color=#0000FF:znglfv2d]new, delete, undelete, pack, zap,
save from gets, array-copy, backup restore [/color:znglfv2d]and much more
DOWNLOAD
<!-- m --><a class="postlink" href="http://www.pflegeplus.com/DOWNLOADS/Network.zop">http://www.pflegeplus.com/DOWNLOADS/Network.zop</a><!-- m -->
( rename zop to zip )
[img:znglfv2d]http://www.pflegeplus.com/IMAGES/Network18.jpg[/img:znglfv2d]
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
A toolbox of netfunctions and tDatabase-tests
|
Uwe,
try to make a source dialog edit and add new Id ( incremental field Cr as "0001"-> strzero(recno+1,4))
1. open the test dialog on two different pc ( A,B)
2. Insert a new record on Pc A but not save
3. Insert a new record on Pc B but not save
4. save Pc A
5. save Pc B
and see if you have two record with the same id
|
A toolbox of netfunctions and tDatabase-tests
|
Why do you need the ID?
Try with a global unique identifier.
Otto
|
A toolbox of netfunctions and tDatabase-tests
|
I need
a field character of 4 called ID sample "0001"
I'm asking the moon ?
|
A toolbox of netfunctions and tDatabase-tests
|
A consecutive number and chronological order when entering is only possible if you accept that you also have records with a serial number that are empty.
If you pull the number at the beginning of the input and then the user aborts the input, then the number is used and the data record is empty.
Otherwise you have to drag the number when saving.
|
A toolbox of netfunctions and tDatabase-tests
|
it's all right what you say, I prefer to have a compatibility with the old procedure done in single user (exclusive way).
|
A toolbox of netfunctions and tDatabase-tests
|
Master Uwe, sorry for my stupidity, could you explain the purpose of this program, please?
Regards, saludos.
|
A toolbox of netfunctions and tDatabase-tests
|
karinha,
the purpose :
1. examples of the syntax to use the different methods of tDatabase
2. easy adding of Your own tests without starting from the beginning to define dialogs, browser ....
It works like a box to include different tests.
everything is included in just one program
I just added to a empty dialog Silvios ID-number test
next I'm working on a test of using ORDSCOPE using tDatabase instead of a filter
Silvios ID-number-test
I added the needed ID-number to Customer.dbf
[img:mgkkad45]http://www.pflegeplus.com/IMAGES/Network20.jpg[/img:mgkkad45]
testing ORDSCOPE
[img:mgkkad45]http://www.pflegeplus.com/IMAGES/Network21.jpg[/img:mgkkad45]
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
A toolbox of netfunctions and tDatabase-tests
|
[quote="ukoenig":2ncmnstn]karinha,
the purpose :
1. examples of the syntax to use the different methods of tDatabase
2. easy adding of Your own tests without starting from the beginning to define dialogs, browser ....
It works like a box to include different tests.
everything is included in just one program
I just added to a empty dialog Silvios ID-number test
next I'm working on a test of using ORDSCOPE using tDatabase instead of a filter
Silvios ID-number-test
I added the needed ID-number to Customer.dbf
[img:2ncmnstn]http://www.pflegeplus.com/IMAGES/Network20.jpg[/img:2ncmnstn]
testing ORDSCOPE
[img:2ncmnstn]http://www.pflegeplus.com/IMAGES/Network21.jpg[/img:2ncmnstn]
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->[/quote:2ncmnstn]
oK. Many thanks master Uwe.
Translate for portuguese:
o objetivo :
1. exemplos da sintaxe para usar os diferentes métodos de tDatabase
2. fácil adição de seus próprios testes sem começar desde o início para definir diálogos, navegador ....
Funciona como uma caixa para incluir testes diferentes.
tudo está incluído em apenas um programa
Acabei de adicionar a uma caixa de diálogo vazia Silvios ID-number test
Em seguida, estou trabalhando em um teste de uso de ORDSCOPE usando tDatabase em vez de um filtro
Teste de número de ID da Silvios
Eu adicionei o número de identificação necessário ao Customer.dbf
Regards, saludos.
|
A toolbox of netfunctions and tDatabase-tests
|
A typical usage
I finished Silvios test with ID - numbers
There is NO problem with the Id's NO double numbers
[quote:mr6b6a0n]
try to make a source dialog edit and add new Id ( incremental field Cr as "0001"-> strzero(recno+1,4))
1. open the test dialog on two different pc ( A,B)
2. Insert a new record on Pc A but not save
3. Insert a new record on Pc B but not save
4. save Pc A
5. save Pc B
and see if you have two record with the same id
I need
a field character of 4 called ID sample "0001"
[/quote:mr6b6a0n]
DOWNLOAD
<!-- m --><a class="postlink" href="http://www.pflegeplus.com/DOWNLOADS/Network.zop">http://www.pflegeplus.com/DOWNLOADS/Network.zop</a><!-- m -->
( rename zop to zip )
You can open the program twice, that will have the same effect like a workstation.
there are 2 different solutions :
1. a new record added with the new Id
2. a new record added WITHOUT Id. The < Id > is added together with the other fields using the < Save button >
Buttons ;
New 1 = new with ID
New 2 = new with NO ID
Zap = Zap file
Restore original = replaces DBF with backup
Renumber = write all ID's new
Save = save vars to DBF with a defined ID from record-number
[img:mr6b6a0n]http://www.pflegeplus.com/IMAGES/Network22.jpg[/img:mr6b6a0n]
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
A toolbox of netfunctions and tDatabase-tests
|
Hello,
I need some help for the new FILTER-section to complete it.
It belongs to the first 3 positions using < [color=#0000FF:1lrtlu0e][b:1lrtlu0e]Setfilter[/b:1lrtlu0e][/color:1lrtlu0e] >
[color=#FF0000:1lrtlu0e]1. oCust:SetFilter(" Last <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
3. oCust:SetFilter( " Hiredate <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: --> [/color:1lrtlu0e]
[color=#008000:1lrtlu0e][b:1lrtlu0e]2. oCust:SetFilter( " Age [/b:1lrtlu0e][/color:1lrtlu0e] works <!-- s:!: --><img src="{SMILIES_PATH}/icon_exclaim.gif" alt=":!:" title="Exclamation" /><!-- s:!: -->
[code=fw:1lrtlu0e]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">IF</span> nAge2 = <span style="color: #000000;">0</span> <span style="color: #B900B9;">// only nAge1</span><br /> oCust:<span style="color: #000000;">SetFilter</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">" Age == "</span> + STR<span style="color: #000000;">(</span>nAge1<span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// from GET - field</span><br /><span style="color: #00C800;">ELSE</span><br /> oCust:<span style="color: #000000;">SetFilter</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">" Age >= "</span> + STR<span style="color: #000000;">(</span>nAge1<span style="color: #000000;">)</span> + <span style="color: #ff0000;">" .and. Age <= "</span> + STR<span style="color: #000000;">(</span>nAge2<span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <br /><span style="color: #00C800;">ENDIF</span><br /> </div>[/code:1lrtlu0e]
The problem seems to be the defined vars of 1 and 3
tests 2, 4 and 5 and 6 are working :
[color=#008000:1lrtlu0e]oCust:SetFilter( " Married = .T. " )
oCust:SetFilter( " Married = .F. " )
oCust:ClearFilter() [/color:1lrtlu0e]
As well all ORDSCOPE-tests are working fine <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
The test is included in < TDATAB3.prg >
Thw index is defined in < NETWORK.prg >
DOWNLOAD
<!-- m --><a class="postlink" href="http://www.pflegeplus.com/DOWNLOADS/Network.zop">http://www.pflegeplus.com/DOWNLOADS/Network.zop</a><!-- m -->
( rename zop to zip )
1. Select a filter from the radio
2. define filter vars ( filter 1, 2 or 3 ) if needed
3. select button < Ordscope > or < Setfilter >
Test : showing all customers with age 60 using ORDSCOPE
[img:1lrtlu0e]http://www.pflegeplus.com/IMAGES/Network23.jpg[/img:1lrtlu0e]
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
A toolbox of netfunctions and tDatabase-tests
|
The update with many new tests included
Thanks to Mr. Rao for his help <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
future improvements
1. connection to the forum and fw-topics for each test
2. editor to view the source of each test
3. a help text for each test
For the switch-tests a internet-connection is needed !!!
some more interesting examples will be added in the future
or You can addi Your own tests
like You can see there is still some more space left adding new tests.
I think it is useful because I couldn't find much in the forum or sample-folder to answer special questions.
DOWNLOAD
<!-- m --><a class="postlink" href="http://www.pflegeplus.com/DOWNLOADS/Network.zop">http://www.pflegeplus.com/DOWNLOADS/Network.zop</a><!-- m -->
( rename zop to zip )
[img:3lrsvvee]http://www.pflegeplus.com/IMAGES/Network25.jpg[/img:3lrsvvee]
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
A transparent MDI-child to show Backgrd. of MDI-frame ?
|
Hello,
is it possible, do define a transparent MDI-child ?
I want to show the Background from MDI-frame.
I got it working, but only with some graphical-extras.
Maybe my Solution is the only way, how to do it.
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=20440&p=108457#p108457">viewtopic.php?f=3&t=20440&p=108457#p108457</a><!-- l -->
Best Regards
Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
|
A transparent MDI-child to show Backgrd. of MDI-frame ?
|
Uwe
Are you talking about the transparency of the mdi child frame ??
Rick Lipkin
|
A transparent MDI-child to show Backgrd. of MDI-frame ?
|
Rick,
the Screenshot explains, what I mean.
Using a Dialog, I can define a Zero-brush and I will see the Background of the MDI-frame ( my first tests ).
It doesn't work with Windows, and shows a black Background.
I fixed the Problem, using Brushes the same like the MDI-frame shows, to get a transparent-effect.
( posted to Colin in detail, how to do it )
It works fine for me, but that makes it a bit complicated for normal Users.
No problem using Colors and BMP-brushes, but using Gradient or Image, You need exactly a copy
of the MDI-frame-background-area is covered with the MDI-child.
What I mean is, to see instead of the gray color the background of the MDI-Frame without Brush-define.
[img:2n6eqjnh]http://www.pflegeplus.com/pictures/mdibtn11.jpg[/img:2n6eqjnh]
Using the MDIFrame-Screenshot-section as MDI-child-brush :
[img:2n6eqjnh]http://www.pflegeplus.com/pictures/mdibtn13.jpg[/img:2n6eqjnh]
The Result with the Screencapture-Image used as Brush ( transparent effect )
[img:2n6eqjnh]http://www.pflegeplus.com/pictures/mdibtn12.jpg[/img:2n6eqjnh]
Best Regards
Uwe <!-- s:roll: --><img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" /><!-- s:roll: -->
|
A transparent MDI-child to show Backgrd. of MDI-frame ?
|
Here is another approach, but much simpler. Programmers with lesser knowledge like me can understand and do.
[code=fw:3707in6k]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oWnd, oBar, oBrush<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BRUSH</span> oBrush FILE <span style="color: #ff0000;">"c:<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\o</span>lga1.jpg"</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd <span style="color: #0000ff;">MDI</span> <span style="color: #0000ff;">BRUSH</span> oBrush<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTONBAR</span> oBar <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>,<span style="color: #000000;">32</span> <span style="color: #000000;">2007</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Transp-Child"</span> ;<br /> <span style="color: #0000ff;">ACTION</span> TranspChild<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> SET <span style="color: #0000ff;">MESSAGE</span> <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">""</span> <span style="color: #000000;">2007</span><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> TranspChild<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oWnd<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd <span style="color: #0000ff;">MDICHILD</span> <span style="color: #0000ff;">OF</span> WndMain<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd ;<br /> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">PAINT</span> ChildPaint<span style="color: #000000;">(</span> hDC, oWnd <span style="color: #000000;">)</span> ;<br /> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">MOVE</span> <span style="color: #000000;">(</span> oWnd:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> ChildPaint<span style="color: #000000;">(</span> hDC, oWnd <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> aPoint<br /><br /> aPoint := ClientToScreen<span style="color: #000000;">(</span> WndMain<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">hWnd</span>, <span style="color: #000000;">{</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> aPoint := ScreenToClient<span style="color: #000000;">(</span> oWnd:<span style="color: #000000;">hWnd</span>, aPoint <span style="color: #000000;">)</span><br /><br /> SetBrushOrgEx<span style="color: #000000;">(</span> hDC, aPoint<span style="color: #000000;">[</span> <span style="color: #000000;">2</span> <span style="color: #000000;">]</span>, aPoint<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> + WndMain<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">oBar</span>:<span style="color: #000000;">nHeight</span> - <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /><br /> FillRect<span style="color: #000000;">(</span> hDC, GetClientRect<span style="color: #000000;">(</span> oWnd:<span style="color: #000000;">hWnd</span> <span style="color: #000000;">)</span>, WndMain<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">hBrush</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /> </div>[/code:3707in6k]
Screen shot:
[url=http://img703.imageshack.us/i/transpmdi.jpg/:3707in6k][img:3707in6k]http://img703.imageshack.us/img703/7664/transpmdi.jpg[/img:3707in6k][/url:3707in6k]
|
A transparent MDI-child to show Backgrd. of MDI-frame ?
|
Edited my source slightly. Avoided setting brush to child window.
|
A transparent MDI-child to show Backgrd. of MDI-frame ?
|
Mr. Rao,
thank You very much. I added the Button-logic and it works perfect.
I will include the new Solution in my next Update.
[img:3ocu116o]http://www.pflegeplus.com/pictures/mdibutt1.jpg[/img:3ocu116o]
You can test all kind of Backgrounds. Define nOption on top.
nOption = 1 Color
nOption = 2 Gradient
nOption = 3 Brush
nOption = 4 Image ( adjusted to Screen )
[code=fw:3ocu116o]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">FUNCTION</span> MAIN<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> oWnd, oBar, oBrush, nOption<br /><span style="color: #00C800;">local</span> aRect3 := GetSysmetrics<span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// Screen-Height</span><br /><span style="color: #00C800;">local</span> aRect4 := GetSysmetrics<span style="color: #000000;">(</span> <span style="color: #000000;">0</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// Screen-Width</span><br /><br />nOption := <span style="color: #000000;">4</span><br /><br /><span style="color: #00C800;">IF</span> nOption = <span style="color: #000000;">1</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BRUSH</span> oBrush <span style="color: #0000ff;">COLOR</span> <span style="color: #000000;">16776960</span><br /><span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">IF</span> nOption = <span style="color: #000000;">2</span><br /> aColors := <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #000000;">0.5</span>, <span style="color: #000000;">16776960</span>, <span style="color: #000000;">16777215</span> <span style="color: #000000;">}</span>, <span style="color: #000000;">{</span> <span style="color: #000000;">0.5</span>, <span style="color: #000000;">16777215</span>, <span style="color: #000000;">16776960</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <br /><span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">IF</span> nOption = <span style="color: #000000;">3</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BRUSH</span> oBrush FILENAME <span style="color: #ff0000;">"e:<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\b</span>ackgrnd<span style="color: #000000;">\M</span>arble.bmp"</span><br /><span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">IF</span> nOption = <span style="color: #000000;">4</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">IMAGE</span> oTmp FILENAME <span style="color: #ff0000;">"e:<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\o</span>lga1.jpg"</span><br /> oBrush := TBrush<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">new</span><span style="color: #000000;">(</span> ,,,, ResizeBmp<span style="color: #000000;">(</span> oTmp:<span style="color: #000000;">hBitmap</span>, aRect4, aRect3, .T. <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <br /> oTmp:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd <span style="color: #0000ff;">MDI</span> <span style="color: #0000ff;">BRUSH</span> oBrush<br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTONBAR</span> oBar <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>,<span style="color: #000000;">32</span> <span style="color: #000000;">2007</span><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Transp-Child"</span> ;<br /><span style="color: #0000ff;">ACTION</span> TranspChild<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br />SET <span style="color: #0000ff;">MESSAGE</span> <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">""</span> <span style="color: #000000;">2007</span><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd ;<br /><span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">PAINT</span> IIF<span style="color: #000000;">(</span> nOption = <span style="color: #000000;">2</span>, GradBrush<span style="color: #000000;">(</span> oWnd, aColors, .T. <span style="color: #000000;">)</span>, <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #B900B9;">// ----- Gradient-Brush --------------------------</span><br /><br /><span style="color: #00C800;">FUNCTION</span> GradBrush<span style="color: #000000;">(</span> oWnd, aColors, lPos <span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> hDC, hBmp, hBmpOld, oBrush<br /><br /><span style="color: #00C800;">if</span> Empty<span style="color: #000000;">(</span> oWnd:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">hBitmap</span> <span style="color: #000000;">)</span><br /> hDC = CreateCompatibleDC<span style="color: #000000;">(</span> oWnd:<span style="color: #000000;">GetDC</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> hBmp = CreateCompatibleBitMap<span style="color: #000000;">(</span> oWnd:<span style="color: #000000;">hDC</span>, oWnd:<span style="color: #000000;">nWidth</span>, oWnd:<span style="color: #000000;">nHeight</span> <span style="color: #000000;">)</span><br /> hBmpOld = SelectObject<span style="color: #000000;">(</span> hDC, hBmp <span style="color: #000000;">)</span><br /> GradientFill<span style="color: #000000;">(</span> hDC, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, oWnd:<span style="color: #000000;">nHeight</span>, oWnd:<span style="color: #000000;">nWidth</span>, aColors, lPos <span style="color: #000000;">)</span><br /> DeleteObject<span style="color: #000000;">(</span> oWnd:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">hBrush</span> <span style="color: #000000;">)</span><br /> oWnd:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">hBitmap</span> = hBmp<br /> oWnd:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">hBrush</span> = CreatePatternBrush<span style="color: #000000;">(</span> hBmp <span style="color: #000000;">)</span> <br /> SelectObject<span style="color: #000000;">(</span> hDC, hBmpOld <span style="color: #000000;">)</span><br /> oWnd:<span style="color: #000000;">ReleaseDC</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">endif</span> <br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> TRANSPCHILD<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> oWnd, oBtn1, oBtn2, oBtn3, oFont1<br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd <span style="color: #0000ff;">MDICHILD</span> <span style="color: #0000ff;">OF</span> WndMain<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">50</span>, <span style="color: #000000;">20</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">350</span>, <span style="color: #000000;">190</span> <span style="color: #0000ff;">PIXEL</span> ;<br />BORDER NONE ; <br />NOSYSMENU ;<br />NOICONIZE ;<br />NOCAPTION <br /><br />oWnd:<span style="color: #000000;">SetBrush</span><span style="color: #000000;">(</span> WndMain<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">oBrush</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont1 <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"Arial"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">-14</span> BOLD<br /><br />@ <span style="color: #000000;">10</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">BTNBMP</span> oBtn1 <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">PIXEL</span> ;<br /><span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">150</span> , <span style="color: #000000;">70</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Test Button &1"</span> <span style="color: #000000;">2007</span> ;<br /><span style="color: #0000ff;">FONT</span> oFont1 ;<br />TOP ;<br />NOBORDER ;<br />FILENAME <span style="color: #ff0000;">"e:<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\3</span>2x32<span style="color: #000000;">\S</span>etup.bmp"</span> ;<br /><span style="color: #0000ff;">ACTION</span> MsgAlert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Test"</span>, <span style="color: #ff0000;">"Button 1"</span> <span style="color: #000000;">)</span><br />oBtn1:<span style="color: #000000;">SetColor</span><span style="color: #000000;">(</span> <span style="color: #000000;">128</span>, <span style="color: #000000;">)</span><br />oBtn1:<span style="color: #000000;">cTooltip</span> := <span style="color: #000000;">{</span> <span style="color: #ff0000;">"Test"</span> + CRLF + ;<br /> <span style="color: #ff0000;">"Button"</span>,<span style="color: #ff0000;">"Button 1"</span>, <span style="color: #000000;">1</span>, CLR_BLACK, <span style="color: #000000;">14089979</span> <span style="color: #000000;">}</span><br /><br />@ <span style="color: #000000;">115</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">BTNBMP</span> oBtn2 <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">PIXEL</span> ;<br /><span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">150</span> , <span style="color: #000000;">70</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Test Button &2"</span> <span style="color: #000000;">2007</span> ;<br /><span style="color: #0000ff;">FONT</span> oFont1 ;<br />TOP ;<br />NOBORDER ;<br />FILENAME <span style="color: #ff0000;">"e:<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\3</span>2x32<span style="color: #000000;">\S</span>tar.bmp"</span> ;<br /><span style="color: #0000ff;">ACTION</span> MsgAlert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Test"</span>, <span style="color: #ff0000;">"Button 2"</span> <span style="color: #000000;">)</span><br />oBtn2:<span style="color: #000000;">SetColor</span><span style="color: #000000;">(</span> <span style="color: #000000;">128</span>, <span style="color: #000000;">)</span><br />oBtn2:<span style="color: #000000;">cTooltip</span> := <span style="color: #000000;">{</span> <span style="color: #ff0000;">"Test"</span> + CRLF + ;<br /> <span style="color: #ff0000;">"Button"</span>,<span style="color: #ff0000;">"Button 2"</span>, <span style="color: #000000;">1</span>, CLR_BLACK, <span style="color: #000000;">14089979</span> <span style="color: #000000;">}</span><br /><br />@ <span style="color: #000000;">220</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">BTNBMP</span> oBtn3 <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">PIXEL</span> ;<br /><span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">150</span> , <span style="color: #000000;">70</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Exit"</span> <span style="color: #000000;">2007</span> ;<br /><span style="color: #0000ff;">FONT</span> oFont1 ;<br />TOP ;<br />NOBORDER ;<br />FILENAME <span style="color: #ff0000;">"e:<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\3</span>2x32<span style="color: #000000;">\Q</span>uit.bmp"</span> ;<br /><span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> oWnd:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <br />oBtn3:<span style="color: #000000;">SetColor</span><span style="color: #000000;">(</span> <span style="color: #000000;">128</span>, <span style="color: #000000;">)</span><br />oBtn3:<span style="color: #000000;">cTooltip</span> := <span style="color: #000000;">{</span> <span style="color: #ff0000;">"Exit"</span> + CRLF + ;<br /> <span style="color: #ff0000;">"MDI-test"</span>,<span style="color: #ff0000;">"Exit"</span>, <span style="color: #000000;">1</span>, CLR_BLACK, <span style="color: #000000;">14089979</span> <span style="color: #000000;">}</span><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd ;<br /><span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">PAINT</span> ChildPaint<span style="color: #000000;">(</span> hDC, oWnd <span style="color: #000000;">)</span> ;<br /><span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">MOVE</span> <span style="color: #000000;">(</span> oWnd:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br />oFont1:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> CHILDPAINT<span style="color: #000000;">(</span> hDC, oWnd <span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> aPoint<br /><br />aPoint := ClientToScreen<span style="color: #000000;">(</span> WndMain<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">hWnd</span>, <span style="color: #000000;">{</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br />aPoint := ScreenToClient<span style="color: #000000;">(</span> oWnd:<span style="color: #000000;">hWnd</span>, aPoint <span style="color: #000000;">)</span><br /><br />SetBrushOrgEx<span style="color: #000000;">(</span> hDC, aPoint<span style="color: #000000;">[</span> <span style="color: #000000;">2</span> <span style="color: #000000;">]</span>, aPoint<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> + WndMain<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">oBar</span>:<span style="color: #000000;">nHeight</span> - <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /><br />FillRect<span style="color: #000000;">(</span> hDC, GetClientRect<span style="color: #000000;">(</span> oWnd:<span style="color: #000000;">hWnd</span> <span style="color: #000000;">)</span>, oWnd:<span style="color: #000000;">oBrush</span>:<span style="color: #000000;">hBrush</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /> </div>[/code:3ocu116o]
Best Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
|
A transparent MDI-child to show Backgrd. of MDI-frame ?
|
Mr. Rao,
Thank You very much for all Your Infos.
I included Your Functions and it is possible now, to show the transparent Child
without using a extra Background-image.
As well the MDI-frame Background can be changed without a new start.
The Restart-test is still included to show the changes, reading new Values from INI-file.
I will still include some more Controls, like a Browser ...
Once, the Child is defined as < Transparent > .....
[img:1rmxmo0e]http://www.pflegeplus.com/pictures/mditr1.jpg[/img:1rmxmo0e]
it shows the Backgroundpart of the MDI-frame from any MDI-frame Background-selection .....
[img:1rmxmo0e]http://www.pflegeplus.com/pictures/mditr2.jpg[/img:1rmxmo0e]
the result of a MDI-frame Background-change works without Restart .
[img:1rmxmo0e]http://www.pflegeplus.com/pictures/mditr3.jpg[/img:1rmxmo0e]
You can change the Values of the Ini-file and a Restart will use them.
For each line of the INI-file, a detailed Info is included.
[img:1rmxmo0e]http://www.pflegeplus.com/pictures/mditr4.jpg[/img:1rmxmo0e]
Best Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
|
A transparent MDI-child to show Backgrd. of MDI-frame ?
|
Mr Uwe
Glad I could be of some help to you.
Can you please let me know what is the function you were using to make bitmap from a smaller rectangle inside a window?
Honestly, I am not still happy with my solution for transparency. This is not truly transparent. Because to be really transparent, when more MDICHILD windows are used, each window should show the overlapped part of other child windows too. This does not do that. But this serves the purpose for now.
|
A transparent MDI-child to show Backgrd. of MDI-frame ?
|
Mr. Rao,
I added a new Group to the Ribbonbar.
Now it is possible to place a Thumbnail on the MDI-frame of any defined Background ( 3 Groups ).
The Screenshot shows the Button-group with selected < transparent >
The Thumbnail shows the Image, that would be the Background, if < Image > is selected.
[img:1l5pqr4v]http://www.pflegeplus.com/pictures/mditr5.jpg[/img:1l5pqr4v]
To paint a Thumbnail on a MDI-frame, I used :
[code=fw:1l5pqr4v]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// from the Ribbonbar :</span><br />...<br />...<br /><span style="color: #B900B9;">// At Startup : lBmpActive := .F. </span><br /><br /><span style="color: #B900B9;">// --------- THUMBNAILS ----------------------</span><br /><span style="color: #B900B9;">// --------------------------------------------------</span><br /><span style="color: #B900B9;">// --------------------------------------------------</span><br /><br />ADD GROUP oGroup9 RIBBON oRibbon <span style="color: #0000ff;">TO</span> OPTION <span style="color: #000000;">9</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Background - Thumbnails"</span> WIDTH <span style="color: #000000;">1000</span> <span style="color: #0000ff;">FONT</span> oFONT2 <br /><br />oGroup9:<span style="color: #000000;">SetFont</span><span style="color: #000000;">(</span> oFont1 <span style="color: #000000;">)</span><br />oGroup9:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br />@ <span style="color: #000000;">10</span>, <span style="color: #000000;">10</span> SELEX oSelex8 <span style="color: #0000ff;">VAR</span> nOption8 <span style="color: #0000ff;">OF</span> oGroup9 <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">320</span>, <span style="color: #000000;">70</span> ;<br />GRADIENT OUTTRACK <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #000000;">0.5</span>, <span style="color: #000000;">16770250</span>, <span style="color: #000000;">16312263</span> <span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">0.5</span>, <span style="color: #000000;">16312263</span>, <span style="color: #000000;">16770250</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span>;<br />GRADIENT INTRACK <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #000000;">0.5</span>, <span style="color: #000000;">14853684</span>, <span style="color: #000000;">16312263</span> <span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">0.5</span>, <span style="color: #000000;">16312263</span>, <span style="color: #000000;">14853684</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span>;<br /><span style="color: #0000ff;">ITEMS</span> <span style="color: #ff0000;">"Color"</span>, <span style="color: #ff0000;">"Gradient"</span>, <span style="color: #ff0000;">"Brush"</span>, <span style="color: #ff0000;">"Image"</span>, <span style="color: #ff0000;">"???"</span> ;<br /><span style="color: #0000ff;">COLOR</span> THUMB <span style="color: #000000;">8388608</span> ;<br />COLORTEXT <span style="color: #000000;">128</span>, <span style="color: #000000;">32768</span> ;<br />THUMBSIZE <span style="color: #000000;">30</span>, <span style="color: #000000;">25</span> ROUNDSIZE <span style="color: #000000;">5</span> ; <br /><span style="color: #0000ff;">FONT</span> oFont1 ;<br /><span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"MDI-frame"</span> TOP ;<br />COLORTITLE <span style="color: #000000;">0</span> ;<br /><span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> CLOSE_DLG<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, ;<br /> IIF<span style="color: #000000;">(</span> nOption8 < <span style="color: #000000;">5</span>, <span style="color: #000000;">(</span> SHOW_THUMB<span style="color: #000000;">(</span><span style="color: #000000;">1</span>,nOption8<span style="color: #000000;">)</span>, lBmpActive := .T.<span style="color: #000000;">)</span> , <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br />oSelex8:<span style="color: #000000;">Setoption</span><span style="color: #000000;">(</span> <span style="color: #000000;">5</span> <span style="color: #000000;">)</span><br />...<br />...<br /><span style="color: #B900B9;">// --- Test for a opened Child -----------</span><br /><br /><span style="color: #00C800;">FUNCTION</span> CLOSE_DLG<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">IF</span> lBmpActive = .T.<br /> lBmpActive := .F.<br /> oWndThumb:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span> <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #B900B9;">// ----------------------------</span><br /><br /><span style="color: #00C800;">FUNCTION</span> SHOW_THUMB<span style="color: #000000;">(</span>nGroup,nSelect<span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> hDC, oBmp<br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWndThumb <span style="color: #0000ff;">MDICHILD</span> <span style="color: #0000ff;">OF</span> oWndMain <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">50</span>, <span style="color: #000000;">250</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">200</span>, <span style="color: #000000;">450</span> <span style="color: #0000ff;">PIXEL</span> ;<br />NOSYSMENU ;<br />NOICONIZE ;<br />NOCAPTION <br /><br /><span style="color: #B900B9;">//BORDER NONE ;</span><br /><br />@ <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> BITMAP oBMP FILENAME c_Path + <span style="color: #ff0000;">"<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\3</span>2x32<span style="color: #000000;">\E</span>xit.bmp"</span> <span style="color: #0000ff;">ADJUST</span> <span style="color: #0000ff;">OF</span> oWndThumb<br /><span style="color: #00C800;">IF</span> nGroup = <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">IF</span> nSelect = <span style="color: #000000;">1</span><br /> oBMP:<span style="color: #000000;">bPainted</span> := <span style="color: #000000;">{</span>|hDC| DRAW_BRU<span style="color: #000000;">(</span> oBMP, hDC, <span style="color: #000000;">1</span>, nColor1a, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, .F., <span style="color: #ff0000;">""</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">IF</span> nSelect = <span style="color: #000000;">2</span><br /> oBMP:<span style="color: #000000;">bPainted</span> := <span style="color: #000000;">{</span>|hDC| DRAW_BRU<span style="color: #000000;">(</span> oBMP, hDC, <span style="color: #000000;">2</span>, nColor1a, nColor1b, nMove1, lDirect1, <span style="color: #ff0000;">""</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">IF</span> nSelect = <span style="color: #000000;">3</span><br /> oBMP:<span style="color: #000000;">bPainted</span> := <span style="color: #000000;">{</span>|hDC| DRAW_BRU<span style="color: #000000;">(</span> oBMP, hDC, <span style="color: #000000;">3</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, .F., cBrush1<span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">IF</span> nSelect = <span style="color: #000000;">4</span><br /> oBMP:<span style="color: #000000;">bPainted</span> := <span style="color: #000000;">{</span>|hDC| DRAW_BRU<span style="color: #000000;">(</span> oBMP, hDC, <span style="color: #000000;">5</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, .F., cImage1<span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">IF</span> nGroup = <span style="color: #000000;">2</span><br /> <span style="color: #00C800;">IF</span> nSelect = <span style="color: #000000;">1</span><br /> oBMP:<span style="color: #000000;">bPainted</span> := <span style="color: #000000;">{</span>|hDC| DRAW_BRU<span style="color: #000000;">(</span> oBMP, hDC, <span style="color: #000000;">1</span>, nColor2a, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, .F., <span style="color: #ff0000;">""</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">IF</span> nSelect = <span style="color: #000000;">2</span><br /> oBMP:<span style="color: #000000;">bPainted</span> := <span style="color: #000000;">{</span>|hDC| DRAW_BRU<span style="color: #000000;">(</span> oBMP, hDC, <span style="color: #000000;">2</span>, nColor2a, nColor2b, nMove2, lDirect2, <span style="color: #ff0000;">""</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">IF</span> nSelect = <span style="color: #000000;">3</span><br /> oBMP:<span style="color: #000000;">bPainted</span> := <span style="color: #000000;">{</span>|hDC| DRAW_BRU<span style="color: #000000;">(</span> oBMP, hDC, <span style="color: #000000;">3</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, .F., cBrush2<span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">IF</span> nSelect = <span style="color: #000000;">4</span><br /> oBMP:<span style="color: #000000;">bPainted</span> := <span style="color: #000000;">{</span>|hDC| DRAW_BRU<span style="color: #000000;">(</span> oBMP, hDC, <span style="color: #000000;">5</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, .F., cImage2<span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">IF</span> nGroup = <span style="color: #000000;">3</span><br /> <span style="color: #00C800;">IF</span> nSelect = <span style="color: #000000;">1</span><br /> oBMP:<span style="color: #000000;">bPainted</span> := <span style="color: #000000;">{</span>|hDC| DRAW_BRU<span style="color: #000000;">(</span> oBMP, hDC, <span style="color: #000000;">1</span>, nColor3a, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, .F., <span style="color: #ff0000;">""</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">IF</span> nSelect = <span style="color: #000000;">2</span><br /> oBMP:<span style="color: #000000;">bPainted</span> := <span style="color: #000000;">{</span>|hDC| DRAW_BRU<span style="color: #000000;">(</span> oBMP, hDC, <span style="color: #000000;">2</span>, nColor3a, nColor3b, nMove3, lDirect3, <span style="color: #ff0000;">""</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">IF</span> nSelect = <span style="color: #000000;">3</span><br /> oBMP:<span style="color: #000000;">bPainted</span> := <span style="color: #000000;">{</span>|hDC| DRAW_BRU<span style="color: #000000;">(</span> oBMP, hDC, <span style="color: #000000;">3</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, .F., cBrush3<span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">IF</span> nSelect = <span style="color: #000000;">4</span><br /> oBMP:<span style="color: #000000;">bPainted</span> := <span style="color: #000000;">{</span>|hDC| DRAW_BRU<span style="color: #000000;">(</span> oBMP, hDC, <span style="color: #000000;">5</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, .F., cImage3<span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWndThumb ;<br /><span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> oBmp:<span style="color: #0000ff;">Move</span><span style="color: #000000;">(</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">200</span>, <span style="color: #000000;">150</span>, .T. <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span> <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span><br /> </div>[/code:1l5pqr4v]
[color=#0000FF:1l5pqr4v]FUNCTION DRAW_BRUSH( oBitmap, hDC, nStyle, nVColor, nBColor, nMove, lDirect, cImage )[/color:1l5pqr4v]
nStyle : selected 1 = Color, 2 = Gradient, 3 = Brush (tiled), 4 = Brush (adjusted), 5 = Image
nVColor := 1. Gradient-color or Color
nBColor : 2. Gradient-color
nMove := 2. Gradient-color-position
lDirect := Vertical, horizontal
cImage := Brush or Image
[color=#FF0000:1l5pqr4v]from Code :[/color:1l5pqr4v]
[color=#0000FF:1l5pqr4v]1. Color Preview :[/color:1l5pqr4v]
@ 100, 100 BITMAP oBMP FILENAME c_Path + "\bitmaps\32x32\Exit.bmp" ADJUST OF oWndThumb
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 1, nColor1, 0, 0, .F., "") }
[color=#0000FF:1l5pqr4v]2. Gradient Preview :[/color:1l5pqr4v]
@ 100, 100 BITMAP oBMP FILENAME c_Path + "\bitmaps\32x32\Exit.bmp" ADJUST OF oWndThumb
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 2, nColor1, nColor2, nMove, .F., "") }
[color=#0000FF:1l5pqr4v]3. Brush Preview ( tiled ) :[/color:1l5pqr4v]
@ 100, 100 BITMAP oBMP FILENAME c_Path + "\bitmaps\32x32\Exit.bmp" ADJUST OF oWndThumb
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 3, 0, 0, 0, .F., cBrush) }
[color=#0000FF:1l5pqr4v]4. Brush Preview ( adjusted ) :[/color:1l5pqr4v]
@ 100, 100 BITMAP oBMP FILENAME c_Path + "\bitmaps\32x32\Exit.bmp" ADJUST OF oWndThumb
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 4, 0, 0, 0, .F., cBrush) }
[color=#0000FF:1l5pqr4v]5. Image Preview :[/color:1l5pqr4v]
@ 100, 100 BITMAP oBMP FILENAME c_Path + "\bitmaps\32x32\Exit.bmp" ADJUST OF oWndThumb
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 5, 0, 0, 0, .F., cImage) }
// Define BMP-size and Position using ON INIT !!!!
// --------------------------------------------------------
ACTIVATE WINDOW oWnd ;
ON INIT oBmp:Move( 50, 50, 250, 200, .T. )
[color=#FF0000:1l5pqr4v]from Resource :[/color:1l5pqr4v]
REDEFINE BITMAP oBMP ID 100 ADJUST RESOURCE "Blanc" OF oDlg // any small BMP from Resource or File
oBMP:bPainted := {|hDC| DRAW_BRU(oBMP, hDC, 1, nColor1, 0, 0, .F., "") }
[code=fw:1l5pqr4v]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// ---------- IMAGE / BMP-BRUSH ( Color, Gradient, Brush, Image ) ------------</span><br /><br /><span style="color: #00C800;">FUNCTION</span> DRAW_BRUSH<span style="color: #000000;">(</span> oBitmap, hDC, nStyle, nVColor, nBColor, nMove, lDirect, cImage <span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> oNewBrush, nRow := <span style="color: #000000;">0</span>, nCol := <span style="color: #000000;">0</span>, n<br /><span style="color: #00C800;">LOCAL</span> aGrad := <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> nMove, nVColor, nBColor <span style="color: #000000;">}</span>, <span style="color: #000000;">{</span> nMove, nBColor, nVColor <span style="color: #000000;">}</span> <span style="color: #000000;">}</span><br /><span style="color: #00C800;">LOCAL</span> aRect := GETCLIENTRECT<span style="color: #000000;">(</span> oBitmap:<span style="color: #000000;">hWnd</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">IF</span> nStyle = <span style="color: #000000;">1</span> <span style="color: #B900B9;">// Color</span><br /> aRect := GETCLIENTRECT<span style="color: #000000;">(</span> oBitmap:<span style="color: #000000;">hWnd</span> <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BRUSH</span> oNewbrush <span style="color: #0000ff;">COLOR</span> nVColor<br /> FillRect<span style="color: #000000;">(</span> oBitmap:<span style="color: #000000;">hDC</span>, aRect, oNewbrush:<span style="color: #000000;">hBrush</span> <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">BRUSH</span> oNewbrush<br /><span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">IF</span> nStyle = <span style="color: #000000;">2</span> <span style="color: #B900B9;">// Gradient</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BRUSH</span> oNewBrush <span style="color: #0000ff;">COLOR</span> GradientFill<span style="color: #000000;">(</span> hDC, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, aRect<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span>, aRect<span style="color: #000000;">[</span><span style="color: #000000;">4</span><span style="color: #000000;">]</span>, aGrad, lDirect <span style="color: #000000;">)</span><br /> FillRect<span style="color: #000000;">(</span> hDC, aRect, oNewBrush:<span style="color: #000000;">hBrush</span> <span style="color: #000000;">)</span><br /> oBitmap:<span style="color: #000000;">ReleaseDC</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">BRUSH</span> oNewbrush<br /><span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">IF</span> nStyle = <span style="color: #000000;">3</span> <span style="color: #B900B9;">// Brush ( tiled )</span><br /> <span style="color: #0000ff;">DEFINE</span> BITMAP oNewbrush FILENAME cImage<br /> nHeight := oNewbrush:<span style="color: #000000;">nHeight</span><br /> nWidth := oNewbrush:<span style="color: #000000;">nWidth</span><br /> <span style="color: #00C800;">IF</span> aRect<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> > <span style="color: #000000;">0</span> <br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> nRow < aRect<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span><br /> nCol = <span style="color: #000000;">0</span><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> nCol < aRect<span style="color: #000000;">[</span><span style="color: #000000;">4</span><span style="color: #000000;">]</span><br /> PalBmpDraw<span style="color: #000000;">(</span> hDC, nRow, nCol, oNewbrush:<span style="color: #000000;">hBitmap</span> <span style="color: #000000;">)</span><br /> nCol += nHeight<br /> <span style="color: #00C800;">ENDDO</span><br /> nRow += nWidth<br /> <span style="color: #00C800;">ENDDO</span><br /> <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">IF</span> nStyle = <span style="color: #000000;">4</span> <span style="color: #B900B9;">// Brush ( stretched )</span><br /> <span style="color: #0000ff;">DEFINE</span> BITMAP oNewbrush FILENAME cImage<br /> PalBmpDraw<span style="color: #000000;">(</span> hDC, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, oBitmap:<span style="color: #000000;">hBitmap</span>, , aRect<span style="color: #000000;">[</span><span style="color: #000000;">4</span><span style="color: #000000;">]</span>, aRect<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">IF</span> nStyle = <span style="color: #000000;">5</span> <span style="color: #B900B9;">// Image</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">IMAGE</span> oNewbrush FILENAME cImage <br /> PalBmpDraw<span style="color: #000000;">(</span> hDC, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, oNewbrush:<span style="color: #000000;">hBitmap</span>, , aRect<span style="color: #000000;">[</span><span style="color: #000000;">4</span><span style="color: #000000;">]</span>, aRect<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span> <br /><span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span> <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span><br /> </div>[/code:1l5pqr4v]
Best Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
|
A transparent MDI-child to show Backgrd. of MDI-frame ?
|
Mr. Rao,
In my new Tool, I added Buttons to a MDI-Window.
With tests before : From MDI-Main and Child, transparent works.
Now it gets a bit more complicated :
1. A Main-window
2. The Main-window includes a Dialog
3. From the Dialog I call a MDI-frame
4. The MDI-Frame includes a Child.
The Child I cannot get transparent painted ( used a Gradient for a Moment )
Is there maybe a Solution to paint it transparent as well ?
[img:1icef27c]http://www.pflegeplus.com/pictures/MDI5.jpg[/img:1icef27c]
The Structure :
[color=#0000FF:1icef27c]// ---------- The Dialog on Main-window ---------
FUNCTION PAINTER(oWndMain)
...
...
REDEFINE BTNBMP oBtn12 ID 915 OF oDlg1 2007 ;
FILENAME c_path + "\Bitmaps\Preview.bmp" ;
LEFT ;
PROMPT " &Preview" ;
FONT oFont5 ;
ACTION FULL_SIZE() // Button calls Preview-window
..
..
ACTIVATE DIALOG oDlg1 NOWAIT
..
..
RETURN NIL
// -- PREVIEW - WINDOW called from a Dialog of the Main-window --
FUNCTION FULL_SIZE()
LOCAL oWnd7
// Image Background painted
...
...
ACTIVATE WINDOW oWnd7 MAXIMIZED ;
ON INIT TRANSPCHILD(oWnd7)
RETURN NIL
// --------- MDI-Child with Buttons ----------
FUNCTION TRANSPCHILD(oWnd7)
local hDC, oWndBtn
DEFINE WINDOW oWndBtn MDICHILD OF oWnd7 FROM 55, 17 TO 185, 175 PIXEL ;
BORDER NONE ;
NOSYSMENU ;
NOICONIZE ;
NOCAPTION
// 2 Buttons painted
1. Switch Dialog ON / OFF to show the complete Window-background
2. Exit MDI-frame ( Preview )
...
...
ACTIVATE WINDOW oWndBtn ;
ON PAINT CHILDPAINT( hDC, oWnd7, oWndBtn )
RETURN NIL
//-------- NO BACKGROUND displayed from MDI-frame !!! ----------
STATIC FUNCTION CHILDPAINT( hDC, oWnd7, oWndBtn )
LOCAL aPoint
aPoint := ClientToScreen( oWnd7:hWnd, { 0, 0 } ) // WndMain()
aPoint := ScreenToClient( oWndBtn:hWnd, aPoint )
SetBrushOrgEx( hDC, aPoint[ 2 ] - 1, aPoint[ 1 ] + oWndBtn:nTop + 80 )
//+ WndMain():oBar:nHeight - 1 )
FillRect( hDC, GetClientRect( oWndBtn:hWnd ), oWndBtn:oBrush:hBrush )
RETURN NIL[/color:1icef27c]Best Regards
Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
|
A veces funciona y a veces no el Pegado(CTRL_V) en TGet
|
Saludos amigos del foro.
Este maravilloso foro que tanto nos ayuda.
Una pregunta que seguro ya la hicieron antes.
Porque "a veces" funciona y "a veces no" el Pegado en TGet. Es decir cuando hago CTRL-V en un campo GET aparece inmediatamente lo pegado, pero cuando paso al siguiente campo get desaparece lo copiado.
Cuando yo utilizo esto, lo que hago es CTRL-V (pegar), luego la tecla END para irme al final del campo y nuevamente CTRL-V para volver a pegar y luego borrar lo ultimo pegado( que es un solo caracter) y asi, si permanece lo pegado.
Tengo varias aplicaciones en las que no le di mucha importancioa a este tema, por eso no hacia la consulta, pero ahora necesito que esto funcione bien en una empresa a la que le desarrolle un sistema.
Ah y este problema es en cualquier maquina, tanto en Win98, Me o Xp
Utilizo FiveWin24, Clipper3 y Blinker7
De antemano gracias, y gracias por responder a una pregunta que seguro ya fue contestada.
|
A veces funciona y a veces no el Pegado(CTRL_V) en TGet
|
No había probado, el Ctrl-C, y Ctrl-V, en la aplicación que esta en pleno desarrollo.
Así que lo he estado probando, y no da problemas. Seguiré haciendo pruebas.
Le adjunto, la configuración de un Edit text style, que uso en la aplicación, por si le fuera de ayuda:
En Caption: Text
En Attributes: Tab stop, Visibley Border
Alignment: Left
Case insensitive
Multiline
Son los unicos, que están activados.
Saludos, José Mª
|
A ver si alguien me aclara éste error
|
Hola a todos
Tengo éste código[code:3grhj11v]cFile:="ALBARAN"
dbUseArea(.T.,,(cFile),"Pedidos",.T.)
Pedidos->(OrdSetFocus("Codigo"))
pedidos->(Dbgotop())
CursorWait()
//***** _DIAS = 90
dStartDate:=DATE()-_DIAS
COPY TO POD2WEB1 FOR pedidos->FECHA > dStartDate [/code:3grhj11v]
La base de datos ALBARAN.DBF, tiene campo memo, por lo tanto tiene ALBARAN.FPT.
Bien, pues cuando llega al copy, me hace bien la copia en el fichero POD2WEB1.DBF, y me genera un POD2WEB1.FPT, pero se queda aquí, no continua y me lanza el siguiente error:
[list:3grhj11v] Error description: Error DBFCDX/1010 Read error: G:\mocwin\2007\ALBARAN.fpt
Stack Calls
===========
Called from: => __DBCOPY(0)
Called from: subesube.prg => CREATEMPCLI(229)
[/list:u:3grhj11v]
Si pongo el codeblock para averiguar el error delante de la línea en cuestión, me da los siguientes errores
[img][url=http://img528.imageshack.us/my.php?image=error1pv1.jpg:3grhj11v][img]http://img528.imageshack.us/img528/4216/error1pv1.th.jpg[/img][/url:3grhj11v] [/img]
[img][url=http://img150.imageshack.us/my.php?image=error2oh0.jpg:3grhj11v][img]http://img150.imageshack.us/img150/9868/error2oh0.th.jpg[/img][/url:3grhj11v][/img]
Que podrá ser? Será por el fpt?
Será mejor que en lugar de un copy to, cree la base en blanco y haga un append from?
Saludos
|
A ver si alguien me aclara éste error
|
Solucionado
Debía de estar corrupto el fpt, le he pasado el Advanced Dbf Repair, y ya funciona
Saludos
|
A ver si esta sale...Boton con prompt en 2 lineas
|
Alguien me daria un ejemplo de un boton desde
recursos con 2 lineas de promp y un bitmap (Ej.: prompt "Cerrar"+CRLF+"TODAS LAS BASES" y una cruz como bitmap para ver
si terminan mis problemas con lo botones POR FAVOR.
Gracias y disculpen
Saludos Ruben Fernandez
|
A ver si esta sale...Boton con prompt en 2 lineas
|
Hola amigo...
Prueba así:
[code=fw:3r7qwi5p]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBtn <span style="color: #0000ff;">ID</span> <span style="color: #000000;">200</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"CRUCECITA"</span> <span style="color: #0000ff;">LEFT</span>;<br /> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Linea 1"</span>+CHR<span style="color: #000000;">(</span><span style="color: #000000;">13</span><span style="color: #000000;">)</span>+<span style="color: #ff0000;">"Linea 2"</span>;<br /> TOOLTIP <span style="color: #ff0000;">"Prueba"</span>;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #0000ff;">Msginfo</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> </div>[/code:3r7qwi5p]
Espero te sirva.
Saludos, Esteban.
|
A ver si esta sale...Boton con prompt en 2 lineas
|
Gracias Esteban... no funciono, seguire probando a ver como lo logro.
Muchas gracias y saludos
Ruben Fernandez
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.