topic stringlengths 1 63 | text stringlengths 1 577k ⌀ |
|---|---|
check adodb connection | hi
is there any way (function) to know if there is an adodb connection active ?
thanks |
check adodb connection | No se si sea lo que buscas
[url:3ayyiqbm]http://forums.fivetechsupport.com/viewtopic.php?f=3&t=36268&hilit=ADO+state#p216489[/url:3ayyiqbm] |
check columns array - Resolved - | I must check if there are all numbers from 1 to 90 on each column
and I made this function but it not run ok
[img:tnz53q1s]https://i.postimg.cc/prhp2HNG/fffffffffffffffffff.png[/img:tnz53q1s]
[code=fw:tnz53q1s]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00C800;">FOR</span> n= <span style="color: #000000;">2</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">56</span><br /> lCompleto:=Controllo_90<span style="color: #000000;">(</span>aTab,n<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">next</span><br /><br /> <span style="color: #00C800;">If</span> lCompleto<br /><br />....<br /><br /><span style="color: #00C800;">endif</span><br />oDbf:<span style="color: #000000;">skip</span><span style="color: #000000;">(</span><span style="color: #000000;">-1</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">enddo</span> <br /><br /><span style="color: #00C800;">Function</span> Controllo_90<span style="color: #000000;">(</span>aTab,nCol<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> conta<br /> <span style="color: #00C800;">local</span> aCount:=<span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">LOCAL</span> nRows := len<span style="color: #000000;">(</span> aTab <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> nR, nC,k<br /> <span style="color: #00C800;">local</span> num<br /> <span style="color: #00C800;">local</span> lreturn<br /><br /><br /> <span style="color: #B900B9;">// save on array the numbers 90</span><br /> conta:= <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">do</span> <span style="color: #00C800;">while</span> <span style="color: #000000;">(</span>conta <= <span style="color: #000000;">90</span><span style="color: #000000;">)</span><br /> aadd<span style="color: #000000;">(</span>aCount, <span style="color: #000000;">{</span>conta,.f.<span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> conta:= conta + <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">enddo</span><br /><br /> <span style="color: #00C800;">for</span> nR := <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> nRows<br /> <span style="color: #00C800;">for</span> nC := nCol <span style="color: #0000ff;">to</span> nCol<br /> num:= aTab<span style="color: #000000;">[</span>nR, nC<span style="color: #000000;">]</span><br /> <span style="color: #00C800;">For</span> k:=<span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> len<span style="color: #000000;">(</span>aCount<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">If</span> aCount<span style="color: #000000;">[</span>k<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> = num<br /> aCount<span style="color: #000000;">[</span>k<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> :=.t.<br /> <span style="color: #00C800;">Endif</span><br /> <span style="color: #00C800;">next</span><br /> <span style="color: #00C800;">next</span><br /> <span style="color: #00C800;">next</span><br /><br /> nConta:=<span style="color: #000000;">0</span><br /> <span style="color: #00C800;">For</span> j:=<span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> len<span style="color: #000000;">(</span>aCount<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">If</span> aCount<span style="color: #000000;">[</span>j<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><br /> nConta:=nConta<span style="color: #000000;">+1</span><br /> <span style="color: #00C800;">Endif</span><br /> <span style="color: #00C800;">next</span><br /><br /> <span style="color: #00C800;">If</span> nConta=<span style="color: #000000;">90</span><br /> lreturn := .t.<br /> <span style="color: #00C800;">else</span><br /> lreturn := .f.<br /> <span style="color: #00C800;">Endif</span><br /><br /> <span style="color: #00C800;">return</span> lreturn<br /><br /><br /> </div>[/code:tnz53q1s] |
check existing first and last on customer - RESOLVED !!! | Silvio,
[quote:3dnyw4cp]>how can i do this check and see that the name entered is already in the archive?[/quote:3dnyw4cp]
This is a classic problem when you are not using unique primary-keys. Primary-keys are one of the basic principles of relational-database programming. Another principle is to store each piece of data, only once.
In the real-world, you are going find duplicate names--people, cities, items, etc. And you MUST be able to have more than one customer, city, or item with the same name(s).
A [b:3dnyw4cp]unique numeric primary-key[/b:3dnyw4cp] is the way to avoid these kinds of problems. It also prevents you from having duplicate data in different files. For instance, all you need in a reservation database is the person's primary-key. This way the address (for instance) is only stored in the customer file, yet you can print the address on a reservation invoice.
This also prevents the problem that arises when the customer moves or changes their phone number. If you have this data in multiple files, then you have to update it in multiple files. Also you are using more disk space.
OK, back to your existing problem. The problem is that your first and last name files are different lengths in the customer and reservation files (15 in one file and 40 in the other). You are going to either need to change the field lengths to be the same, or make them the same in the search.
Or, better, switch to using a primary keys. I know this will be a pain now, but it will prevent a lot of future issues. And it will speed up your program since it uses less disk space, so there is less disk access. Note that adding a primary key to the database files is unlikely to break any existing code and it allows you to solve existing problems.
See also: [url=https://webs.wofford.edu/whisnantdm/Courses/CS101/PDF/Database/Relational_database_concepts.pdf:3dnyw4cp]Relational Database Concepts[/url:3dnyw4cp]
James |
check existing first and last on customer - RESOLVED !!! | I have the primary keys, the customer database is indexed on name, surname, city, province and region.
the primary key that was there before, ie "0001" four characters, I have hurt to remove it due to the countless problems both with tdatabase and with tdata.
Yes, I know you and nages gave me many examples last year but then on the net all this becomes very difficult.
Before I had found an expedient that is to save the surname and name (full name field) in a single field and do the index and check on this field but I wanted to know if there was an alternative.
In the program I often have families that have the same surname and often also the name, for example my name is like my grandfather. |
check existing first and last on customer - RESOLVED !!! | when I add a record I encounter difficulties because the customer archive is not indexed on first and last
I must make a check if the first and last exist
and on the network I cannot make an index on the fly
so if I check the First or the Last it tells me that it is already existing
[b:2mz04wqy]the problem is that I can have customers who have the same First and also the same Last so how can I check[/b:2mz04wqy]
how can i do this check and see that the name entered is already in the archive?
I state I'm using tdatabase and I use customer dbf
oDbf:SetOrder( 1 ) //FIRST
oDbf:GoTop()
if oDbf:Seek( UPPER( cFirst) )
this give me the user is allready on archive
if I make oDbf:Seek( UPPER( cFirst+cLast) ) I not have the index
I made a test making an index on first+last
then i made
local cNomeIntero :=alltrim(cFirst) +alltrim(cLast)
oDbf:SetOrder( 16 ) //first+last
oDbf:GoTop()
oDbf:Seek( UPPER( cNomeIntero ) )
xbrowser oDbf
not good it go to eof of dbf and give me not return if found the record
any solution ? |
check existing first and last on customer - RESOLVED !!! | Silvio,
[quote:2lebquzt]I have the primary keys, the customer database is indexed on name, surname, city, province and region.[/quote:2lebquzt]
That is not guaranteed to be unique, and it takes up way to much space on the disk. You need to use an ID number.
[quote:2lebquzt]the primary key that was there before, ie "0001" four characters, I have hurt to remove it due to the countless problems both with tdatabase and with tdata.[/quote:2lebquzt]
What countless problems? I have never had a single problem using a sequential primary key.
[quote:2lebquzt]Yes, I know you and nages gave me many examples last year but then on the net all this becomes very difficult.[/quote:2lebquzt]
Why? I think this may just be because you have never used a primary key. The one problem I do remember is that a customer wants the ID displayed on a new record input screen. This is technically not possible, because you will end up with a blank record every time a user cancels a new record entry.
Is that the issue you are referring to? And by the way, how are they going to respond to not even having a reservation number (the way you are doing it now)?
It just came to me. The way to use the primary key and have it displayed on the data entry screen for a new reservation. The data entry screen has three buttons, OK, Apply, and Cancel. You just leave the primary key blank until the user is done, then they press the Apply button, and the record gets an ID and gets saved, and the blank field gets filled in on the screen. The screen remains open so they can copy the ID (or whatever). Then they press the OK button to exit. If they press the Cancel button, no blank record (with just an ID) gets added. Simple.
[quote:2lebquzt]Before I had found an expedient that is to save the surname and name (full name field) in a single field and do the index and check on this field but I wanted to know if there was an alternative.[/quote:2lebquzt]
Yes, the alternative is a numeric, sequential primary key. This can be stored as a number or a character.
[quote:2lebquzt]In the program I often have families that have the same surname and often also the name, for example my name is like my grandfather.[/quote:2lebquzt]
Yes, that is the classic reason for using numeric primary keys instead. |
check existing first and last on customer - RESOLVED !!! | [quote:2hbig8nk] the customer database is indexed on name, surname, city, province and region[/quote:2hbig8nk]
Note that this must take 30-40 characters in every file that needs to be linked to the customer file. That is a lot of wasted disk space, and slows down the program. Plus the index would be huge.
A 4-8 character primary-key uses much less disk space and speeds up disk reads and writes and thus the program is faster for the user.
James |
check existing first and last on customer - RESOLVED !!! | Mr. Silvio
Without any special index:
[code=fw:zobw1u18]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">local</span> oDbf<br /> <span style="color: #00C800;">local</span> cName := <span style="color: #ff0000;">"David"</span><br /> <span style="color: #00C800;">local</span> cLast := <span style="color: #ff0000;">"Jochum"</span><br /><br /> oDbf := TDataBase<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> <span style="color: #00C800;">nil</span>, <span style="color: #ff0000;">"CUSTOMER"</span>, <span style="color: #ff0000;">"DBFCDX"</span>, .t. <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> oDbf:<span style="color: #000000;">LookUp</span><span style="color: #000000;">(</span> UPPER<span style="color: #000000;">(</span> PADR<span style="color: #000000;">(</span> cName, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span> + PADR<span style="color: #000000;">(</span> cLast, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, ;<br /> <span style="color: #ff0000;">"UPPER(FIRST+LAST)"</span>, <span style="color: #000000;">{</span> || FOUND<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /> ? <span style="color: #ff0000;">"Found"</span><br /> <span style="color: #00C800;">else</span><br /> ? <span style="color: #ff0000;">"Not Found"</span><br /> <span style="color: #00C800;">endif</span><br /><br /> oDbf:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> </div>[/code:zobw1u18]
Note: 20 and 20 in PADR() function are the field sizes of FIRST and LAST. |
check existing first and last on customer - RESOLVED !!! | [quote="nageswaragunupudi":1jyclufq]Mr. Silvio
Without any special index:
[code=fw:1jyclufq]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">local</span> oDbf<br /> <span style="color: #00C800;">local</span> cName := <span style="color: #ff0000;">"David"</span><br /> <span style="color: #00C800;">local</span> cLast := <span style="color: #ff0000;">"Jochum"</span><br /><br /> oDbf := TDataBase<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> <span style="color: #00C800;">nil</span>, <span style="color: #ff0000;">"CUSTOMER"</span>, <span style="color: #ff0000;">"DBFCDX"</span>, .t. <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> oDbf:<span style="color: #000000;">LookUp</span><span style="color: #000000;">(</span> UPPER<span style="color: #000000;">(</span> PADR<span style="color: #000000;">(</span> cName, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span> + PADR<span style="color: #000000;">(</span> cLast, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, ;<br /> <span style="color: #ff0000;">"UPPER(FIRST+LAST)"</span>, <span style="color: #000000;">{</span> || FOUND<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /> ? <span style="color: #ff0000;">"Found"</span><br /> <span style="color: #00C800;">else</span><br /> ? <span style="color: #ff0000;">"Not Found"</span><br /> <span style="color: #00C800;">endif</span><br /><br /> oDbf:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> </div>[/code:1jyclufq]
Note: 20 and 20 in PADR() function are the field sizes of FIRST and LAST.[/quote:1jyclufq]
Sorry Nages I have a bit of everything. your idea can only work that I have to manage the various insertion modes
nMode = 1 new
nMode = 2 change
nMode = 3 duplicate records
nMode = 4 I need this in the selection dialog
I made
[code=fw:1jyclufq]<div class="fw" id="{CB}" style="font-family: monospace;">@ <span style="color: #000000;">12</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">SAY</span> <span style="color: #ff0000;">"Cognome:"</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">31</span>, <span style="color: #000000;">8</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">FONT</span> oFont<br /> @ <span style="color: #000000;">10</span>, <span style="color: #000000;">67</span> <span style="color: #0000ff;">GET</span> aGet<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> oCliente:<span style="color: #000000;">Clicognome</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>, <span style="color: #000000;">12</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /> @ <span style="color: #000000;">26</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">SAY</span> <span style="color: #ff0000;">"Nome :"</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">22</span>, <span style="color: #000000;">8</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">FONT</span> oFont<br /> @ <span style="color: #000000;">24</span>, <span style="color: #000000;">67</span> <span style="color: #0000ff;">GET</span> aGet<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> oCliente:<span style="color: #000000;">Clinome</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>, <span style="color: #000000;">12</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">FONT</span> oFont ;<br /> <span style="color: #0000ff;">VALID</span> SearchCli<span style="color: #000000;">(</span> oCliente:<span style="color: #000000;">Clicognome</span>, aGet<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span>, <span style="color: #000000;">1</span>,oDbf,oCliente:<span style="color: #000000;">Clinome</span> <span style="color: #000000;">)</span></div>[/code:1jyclufq]
[code=fw:1jyclufq]<div class="fw" id="{CB}" style="font-family: monospace;"> <br /><span style="color: #00C800;">function</span> SearchCli <span style="color: #000000;">(</span> cCognome, oGet, nMode,oDbf,cNome <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> lreturn := .f.<br /> <span style="color: #00C800;">local</span> nRecno := oDbf:<span style="color: #000000;">RecNo</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> nOrder := oDbf:<span style="color: #000000;">OrdNumber</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> nArea := <span style="color: #0000ff;">Select</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #00C800;">if</span> Empty<span style="color: #000000;">(</span> cNome <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> nMode == <span style="color: #000000;">4</span><br /> <span style="color: #00C800;">return</span> .t.<br /> <span style="color: #00C800;">else</span><br /> MsgStop<span style="color: #000000;">(</span><span style="color: #ff0000;">"E' obbligatorio questo campo."</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">return</span> .f.<br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /><br />oDbf:<span style="color: #000000;">SetOrder</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">//CLICOGNOME</span><br /> oDbf:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> oDbf:<span style="color: #000000;">LookUp</span><span style="color: #000000;">(</span> UPPER<span style="color: #000000;">(</span> PADR<span style="color: #000000;">(</span> cCognome, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span> + PADR<span style="color: #000000;">(</span> cNome, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, ;<br /> <span style="color: #ff0000;">"UPPER(CLICOGNOME+CLINOME)"</span>, <span style="color: #000000;">{</span> || FOUND<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">CASE</span><br /> <span style="color: #00C800;">Case</span> nMode == <span style="color: #000000;">1</span> .OR. nMode == <span style="color: #000000;">3</span> <span style="color: #B900B9;">// new or duplicate</span><br /> lreturn := .f.<br /> MsgStop<span style="color: #000000;">(</span><span style="color: #ff0000;">"Nominativo esistente."</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Case</span> nMode == <span style="color: #000000;">2</span> <span style="color: #B900B9;">// modify</span><br /> <span style="color: #00C800;">if</span> oDbf:<span style="color: #000000;">Recno</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> == nRecno<br /> lreturn := .t.<br /> <span style="color: #00C800;">else</span><br /> lreturn := .f.<br /> MsgStop<span style="color: #000000;">(</span><span style="color: #ff0000;">"Nominativo esistente."</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">Case</span> nMode == <span style="color: #000000;">4</span> <span style="color: #B900B9;">//selection dialog </span><br /> lreturn := .t.<br /> END <span style="color: #00C800;">CASE</span><br /><br /> <span style="color: #00C800;">ELSE</span><br /><br /> <span style="color: #00C800;">if</span> nMode < <span style="color: #000000;">4</span><br /> lreturn := .t.<br /> <span style="color: #00C800;">else</span><br /> <span style="color: #00C800;">if</span> MsgYesNo<span style="color: #000000;">(</span><span style="color: #ff0000;">"Nominativo inesistente. ¿ Desideri inserirlo ora? "</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// on selection dialog ask to add the new record</span><br /> lreturn := ClEdita<span style="color: #000000;">(</span> , <span style="color: #000000;">1</span>, , , @cCognome <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> lreturn := .f.<br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #00C800;">if</span> lreturn == .f.<br /> oGet:<span style="color: #000000;">cText</span><span style="color: #000000;">(</span> space<span style="color: #000000;">(</span><span style="color: #000000;">20</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /> oDbf:<span style="color: #000000;">SetOrder</span><span style="color: #000000;">(</span> nOrder <span style="color: #000000;">)</span><br /> oDbf:<span style="color: #000000;">GoTo</span><span style="color: #000000;">(</span> nRecno <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">Select</span> <span style="color: #000000;">(</span>nArea<span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">return</span> lreturn</div>[/code:1jyclufq]
First I insert "Vitali" "Pietro" and the procedure returns me that it found it in the archive,
deletes the contents of the get (aGet [2]) and points the cursor on the get of the name field. all ok
[img:1jyclufq]https://i.postimg.cc/8CsTT4KG/primo.png[/img:1jyclufq]
Then I insert "silvio" instead of "Pietro" and the procedure makes an error in line 777 which appears to be
[img:1jyclufq]https://i.postimg.cc/KvFF1xqJ/secondo.png[/img:1jyclufq]
[img:1jyclufq]https://i.postimg.cc/NMgL8mbP/gggggg.jpg[/img:1jyclufq]
this is the error
[code=fw:1jyclufq]<div class="fw" id="{CB}" style="font-family: monospace;">Application<br />===========<br /> Path and <span style="color: #0000ff;">name</span>: <span style="color: #000000;">C</span>:\Work\Prg\Prenotazioni\WinBeach.Exe <span style="color: #000000;">(</span><span style="color: #000000;">32</span> bits<span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">Size</span>: <span style="color: #000000;">7</span>,<span style="color: #000000;">603</span>,<span style="color: #000000;">200</span> bytes<br /> Compiler version: <span style="color: #000000;">Harbour</span> <span style="color: #000000;">3.2</span>.0dev <span style="color: #000000;">(</span>r1904111533<span style="color: #000000;">)</span><br /> FiveWin version: <span style="color: #000000;">FWH</span> <span style="color: #000000;">21.04</span><br /> C compiler version: <span style="color: #000000;">Borland</span>/Embarcadero C++ <span style="color: #000000;">7.0</span> <span style="color: #000000;">(</span><span style="color: #000000;">32</span>-bit<span style="color: #000000;">)</span><br /> Windows version: <span style="color: #000000;">6.1</span>, Build <span style="color: #000000;">7601</span> Service Pack <span style="color: #000000;">1</span><br /><br /> Time <span style="color: #0000ff;">from</span> start: <span style="color: #000000;">0</span> hours <span style="color: #000000;">0</span> mins <span style="color: #000000;">29</span> secs <br /> Error occurred <span style="color: #00C800;">at</span>: <span style="color: #000000;">14</span><span style="color: #000000;">-06</span><span style="color: #000000;">-2021</span>, <span style="color: #000000;">23</span>:<span style="color: #000000;">29</span>:<span style="color: #000000;">13</span><br /> Error description: <span style="color: #000000;">Error</span> BASE/<span style="color: #000000;">1066</span> Parametro errato: <span style="color: #000000;">condizionale</span><br /> Args:<br /> <span style="color: #000000;">[</span> <span style="color: #000000;">1</span><span style="color: #000000;">]</span> = U <br /><br />Stack Calls<br />===========<br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\Clienti\PClienti.prg => CLCLAVE<span style="color: #000000;">(</span> <span style="color: #000000;">777</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">source</span>\Clienti\PClienti.prg => <span style="color: #000000;">(</span>b<span style="color: #000000;">)</span>CLEDITA<span style="color: #000000;">(</span> <span style="color: #000000;">597</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: .\source\classes\TGET.PRG => TGET:<span style="color: #000000;">LVALID</span><span style="color: #000000;">(</span> <span style="color: #000000;">2282</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: .\source\classes\CONTROL.PRG => TGET:<span style="color: #000000;">FWLOSTFOCUS</span><span style="color: #000000;">(</span> <span style="color: #000000;">1205</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: .\source\classes\CONTROL.PRG => TCONTROL:<span style="color: #000000;">HANDLEEVENT</span><span style="color: #000000;">(</span> <span style="color: #000000;">1802</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: .\source\classes\TGET.PRG => TGET:<span style="color: #000000;">HANDLEEVENT</span><span style="color: #000000;">(</span> <span style="color: #000000;">1279</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: .\source\classes\<span style="color: #0000ff;">WINDOW</span>.PRG => _FWH<span style="color: #000000;">(</span> <span style="color: #000000;">3560</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: => DIALOGBOXINDIRECT<span style="color: #000000;">(</span> <span style="color: #000000;">0</span> <span style="color: #000000;">)</span></div>[/code:1jyclufq]
Also If I make
IF oDbf:LookUp( UPPER( PADR( cCognome, 20 ) + PADR( cNome, 20 ) ), ;
"UPPER(CLICOGNOME+CLINOME)", { || FOUND() } )
lreturn := .f.
else
lreturn := .t.
endif
give me the same error on the second time when I insert a Last new |
check existing first and last on customer - RESOLVED !!! | The field sizes for LAST and FIRST in the sample database you sent me are both 18 characters not 20. You had better check yours.
Your GETs should be using the current field size, so you shouldn't need to pad them unless you are looking them up in a different file, then you need to use the field size of that file (or make the fields in that file the same length). In fact field sizes should always be made the same in each file that is using the same name fields.
These are all problems that unique primary key IDs would solve.
James |
check existing first and last on customer - RESOLVED !!! | [quote="James Bott":38v6ing1]The field sizes for LAST and FIRST in the sample database you sent me are both 18 characters not 20. You had better check yours.
Your GETs should be using the current field size, so you shouldn't need to pad them unless you are looking them up in a different file, then you need to use the field size of that file (or make the fields in that file the same length). In fact field sizes should always be made the same in each file that is using the same name fields.
These are all problems that unique primary key IDs would solve.
James[/quote:38v6ing1]
[img:38v6ing1]https://i.postimg.cc/90BGcc0r/campi.png[/img:38v6ing1]
nages solution works but only as far as if it finds a customer if it doesn't find it it makes mistake so i think the line
IF oDbf:LookUp( UPPER( PADR( cCognome, 20 ) + PADR( cNome, 20 ) ), ;
"UPPER(CLICOGNOME+CLINOME)", { || FOUND() } )
has a setting error I think can be solved
not knowing that function I cannot adjust the settings |
check existing first and last on customer - RESOLVED !!! | Silvio,
Hmm, I see that my version of TDatabase does not have a Lookup() method. And Nages didn't provide the Found() function. So you are dead in the water until you have those. Does your version of TDatabase have the Lookup() method?
Perhaps you can just use the Seek() method?
James |
check existing first and last on customer - RESOLVED !!! | 1) The function FOUND() is a native Clipper/Harbour RDD function and has been there from the time Clipper was born.
2) Method LookUp(...) was first introduced in Sep 2017 version and exists in FWH1805. |
check existing first and last on customer - RESOLVED !!! | [quote="James Bott":2pgk99ur]Silvio,
Hmm, I see that my version of TDatabase does not have a Lookup() method. And Nages didn't provide the Found() function. So you are dead in the water until you have those. Does your version of TDatabase have the Lookup() method?
Perhaps you can just use the Seek() method?
James[/quote:2pgk99ur]
dead ?
I have the last Release of Fwh |
check existing first and last on customer - RESOLVED !!! | [quote="nageswaragunupudi":3cf86pkc]1) The function FOUND() is a native Clipper/Harbour RDD function and has been there from the time Clipper was born.
2) Method LookUp(...) was first introduced in Sep 2017 version and exists in FWH1805.[/quote:3cf86pkc]
Nages do you saw my problem? |
check existing first and last on customer - RESOLVED !!! | Silvio,
[code=fw:1dz459hd]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">local</span> cNomeIntero :=alltrim<span style="color: #000000;">(</span>cFirst<span style="color: #000000;">)</span> +alltrim<span style="color: #000000;">(</span>cLast<span style="color: #000000;">)</span><br /><br />oDbf:<span style="color: #000000;">SetOrder</span><span style="color: #000000;">(</span> <span style="color: #000000;">16</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">//first+last</span><br />oDbf:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oDbf:<span style="color: #000000;">Seek</span><span style="color: #000000;">(</span> UPPER<span style="color: #000000;">(</span> cNomeIntero <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br />xbrowser oDbf<br /><br />not good it go <span style="color: #0000ff;">to</span> eof <span style="color: #0000ff;">of</span> dbf and give me not <span style="color: #00C800;">return</span> <span style="color: #00C800;">if</span> found the record</div>[/code:1dz459hd]
cNomeIntero is in all uppercase and if your index is not, then there won't be a match. You need to show exactly how the index is made. It would have to be:
index on UPPER(alltrim(cFirst) + alltrim(cLast))...
If it is not, then that is why the search is failing.
Also, why do you even need to find if a customer's name already exists? If you use a CUSTNO then this doesn't matter--you can have ten customers with the same first and last names--they will each have a different CUSTNO. You just link the reservation by adding the CUSTNO to the reservation. And with this you can find the right customer information in the customer file from the reservation CUSTNO. Then you add methods to the reservation class to lookup the customer info in the customer database when needed--for instance when printing the reservation. Simple.
Of course, the program user is still going to have to deal with finding the right customer out of the multiple customer's with the same name. In this case, the program user would need to ask the customer for more information like address or phone number to find the right customer record, then they add a reservation for that customer and the CUSTNO gets added automatically to the reservation database.
CUSTOMERS.DBF FIELDS:
CUSTNO (primary key, unique)
FIRSTNAME
LASTNAME
RESERVS.DBF FIELDS: (You could have multiple reservations for the same CUSTNO)
RESERVNO (primary key, unique)
CUSTNO
RESERVITEMS.DBF FIELDS: (Multiple items per RESERVNO)
RESERVNO (primary key, unique)
ITEMNNO
Did you read the document about relational databases that I provided a link to in another response to one of your questions? You really need to if you haven't. Using relational databases will solve many of your problems.
James |
check existing first and last on customer - RESOLVED !!! | Nages,
[quote:32j45xog]1) The function FOUND() is a native Clipper/Harbour RDD function and has been there from the time Clipper was born.
2) Method LookUp(...) was first introduced in Sep 2017 version and exists in FWH1805[/quote:32j45xog]
Thanks for clearing that up. I don't remember using FOUND() with Clipper even though I was using Clipper when it was first released (and DBase before that). But that was a very long time ago...
I didn't find the Lookup() method in TDatabase because I was looking a the sorted methods in my editor and the actual method name is TD_LOOKUP, so it was under the T's not the L's.
However, I am sure using primary-keys will fix all these problems Silvio is having. He won't even need to do this lookup.
James |
check existing first and last on customer - RESOLVED !!! | [quote:lp0095k3]I didn't find the Lookup() method in TDatabase because I was looking a the sorted methods in my editor and the actual method name is TD_LOOKUP, so it was under the T's not the L's.
[/quote:lp0095k3]
Method LookUp exists:
[code=fw:lp0095k3]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">METHOD</span> LookUp<span style="color: #000000;">(</span> uSeek, cOrder, bcExpr, lTrigger <span style="color: #000000;">)</span> <span style="color: #00C800;">INLINE</span> <span style="color: #000000;">(</span> ::<span style="color: #000000;">cAlias</span> <span style="color: #000000;">)</span>-><span style="color: #000000;">(</span> ::<span style="color: #000000;">td_LookUp</span><span style="color: #000000;">(</span> uSeek, cOrder, bcExpr, lTrigger <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> </div>[/code:lp0095k3]
The original question in the first post was how to find if a combination of two fields already exists in the table. I provided a simple and straight answer for that which works irrespective of the indexes. |
check existing first and last on customer - RESOLVED !!! | Nages,
[quote:2u4pjt79]The original question in the first post was how to find if a combination of two fields already exists in the table. I provided a simple and straight answer for that which works irrespective of the indexes[/quote:2u4pjt79].
Sorry, I never meant to imply otherwise.
I was just pointing out that using primary keys solves this and many other problems Silvio has been having. When using primary keys, Silvio won't need to do this lookup. However, your technique will be useful in other situations. Thanks for providing it--I already have it in my notes file.
James |
check existing first and last on customer - RESOLVED !!! | cNomeintero was only a test.
I wish use the same fields i pubblish
clicognome as First
clinome as last
of 20 characters |
check existing first and last on customer - RESOLVED !!! | [quote="James Bott":2mzfs0mq]Nages,
[quote:2mzfs0mq]The original question in the first post was how to find if a combination of two fields already exists in the table. I provided a simple and straight answer for that which works irrespective of the indexes[/quote:2mzfs0mq].
Sorry, I never meant to imply otherwise.
I was just pointing out that using primary keys solves this and many other problems Silvio has been having. When using primary keys, Silvio won't need to do this lookup. However, your technique will be useful in other situations. Thanks for providing it--I already have it in my notes file.
James[/quote:2mzfs0mq]
But which primaries should I use?
the clienti.dbf file has these indexes
INDEX ON UPPER(CLICOGNOME) TAG CLICOGNOME
INDEX ON UPPER(CLINOME) TAG CLINOME
INDEX ON UPPER(CLIFISCALE) TAG CLIFISCALE
INDEX ON UPPER(CLIPARTIVA) TAG CLIPARTIVA
INDEX ON UPPER(CLIINDIRIZ) TAG CLIINDIRIZ
INDEX ON UPPER(CLIPAESE) TAG CLIPAESE
INDEX ON UPPER(CLICAP) TAG CLICAP
INDEX ON UPPER(CLIPROV) TAG CLIPROV
INDEX ON UPPER(CLIREGIONE) TAG CLIREGIONE
INDEX ON UPPER(CLITELEF1) TAG CLITELEF1
INDEX ON UPPER(CLITELEF2) TAG CLITELEF2
INDEX ON UPPER(CLIEMAIL) TAG CLIEMAIL
INDEX ON UPPER(CLISITOWEB) TAG CLISITOWEB
INDEX ON UPPER(CLIAPPUNTI) TAG CLIAPPUNTI
INDEX ON DELETED() TAG DELETED
[b:2mzfs0mq]and the fields are these[/b:2mzfs0mq]
[code=fw:2mzfs0mq]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">local</span> aFields := <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CLICOGNOME"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">20</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CLINOME"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">20</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CLIFISCALE"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">16</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CLIPARTIVA"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">11</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CLIINDIRIZ"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">30</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CLIPAESE"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">30</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CLICAP"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">5</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CLIPROV"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">2</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CLIREGIONE"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">20</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CLITELEF1"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">14</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CLITELEF2"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">14</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CLIEMAIL"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">40</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CLISITOWEB"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">40</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CLIAPPUNTI"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">200</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span></div>[/code:2mzfs0mq]
the idea of using only one field (FULLNAME) was just a test I did but in reality I need a field for the Surname and a field for the name.
There are many customers with the same surname just think that entire families go to the sea. There is the possibility of having the same surname and the same name
nages suggestion only works on the first try i.e:
[b:2mzfs0mq]1)[/b:2mzfs0mq] I enter the surname and then the name for example "Vitali" "Pietro"
I only put control on the name
[b:2mzfs0mq]2)[/b:2mzfs0mq] the procedure tells me that the name "Peter" already exists so I 3) deletes the contents of the get control and sets focus on the get, so the cusor is stopped on the get control of the name
[b:2mzfs0mq]3)[/b:2mzfs0mq] I insert in place of "Pietro", my name "Silvio" which in reality is not in the archive, the procedure does not make me go ahead to enter the other fields and makes a error
this error
[code=fw:2mzfs0mq]<div class="fw" id="{CB}" style="font-family: monospace;"> Error description: <span style="color: #000000;">Error</span> BASE/<span style="color: #000000;">1066</span> Argument error: <span style="color: #000000;">conditional</span><br /> Args:<br /> <span style="color: #000000;">[</span> <span style="color: #000000;">1</span><span style="color: #000000;">]</span> = U <br /><br />Stack Calls<br />===========<br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">test</span>.prg => CLCLAVE<span style="color: #000000;">(</span> <span style="color: #000000;">305</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">test</span>.prg => <span style="color: #000000;">(</span>b<span style="color: #000000;">)</span>CLEDITA<span style="color: #000000;">(</span> <span style="color: #000000;">206</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: .\source\classes\TGET.PRG => TGET:<span style="color: #000000;">LVALID</span><span style="color: #000000;">(</span> <span style="color: #000000;">2282</span> <span style="color: #000000;">)</span></div>[/code:2mzfs0mq]
is there a solution please?
I'll post the valid function I made
@ 26, 10 SAY "Nome :" OF oDlg SIZE 22, 8 PIXEL FONT oFont
@ 24, 67 GET aGet[2] VAR oCliente:Clinome OF oDlg SIZE 100, 12 PIXEL FONT oFont ;
VALID CLClave( oCliente:Clicognome, aGet[2], 1,oDbf,oCliente:Clinome )
[code=fw:2mzfs0mq]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">function</span> CLClave<span style="color: #000000;">(</span> cCognome, oGet, nMode,oDbf,cNome <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> lreturn := .f.<br /> <span style="color: #00C800;">local</span> nRecno := oDbf:<span style="color: #000000;">RecNo</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> nOrder := oDbf:<span style="color: #000000;">OrdNumber</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> nArea := <span style="color: #0000ff;">Select</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #00C800;">if</span> Empty<span style="color: #000000;">(</span> cNome <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> nMode == <span style="color: #000000;">4</span><br /> <span style="color: #00C800;">return</span> .t.<br /> <span style="color: #00C800;">else</span><br /> MsgStop<span style="color: #000000;">(</span><span style="color: #ff0000;">"E' obbligatorio questo campo."</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">return</span> .f.<br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /><br />*oDbf:<span style="color: #000000;">SetOrder</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">//CLICOGNOME</span><br />* oDbf:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> oDbf:<span style="color: #000000;">LookUp</span><span style="color: #000000;">(</span> UPPER<span style="color: #000000;">(</span> PADR<span style="color: #000000;">(</span> cCognome, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span> + PADR<span style="color: #000000;">(</span> cNome, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, ;<br /> <span style="color: #ff0000;">"UPPER(CLICOGNOME+CLINOME)"</span>, <span style="color: #000000;">{</span> || FOUND<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">CASE</span><br /> <span style="color: #00C800;">Case</span> nMode == <span style="color: #000000;">1</span> .OR. nMode == <span style="color: #000000;">3</span> <span style="color: #B900B9;">// new or duplicate</span><br /> lreturn := .f.<br /> MsgStop<span style="color: #000000;">(</span><span style="color: #ff0000;">"Nominativo esistente."</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Case</span> nMode == <span style="color: #000000;">2</span> <span style="color: #B900B9;">// modify</span><br /> <span style="color: #00C800;">if</span> oDbf:<span style="color: #000000;">Recno</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> == nRecno<br /> lreturn := .t.<br /> <span style="color: #00C800;">else</span><br /> lreturn := .f.<br /> MsgStop<span style="color: #000000;">(</span><span style="color: #ff0000;">"Nominativo esistente."</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">Case</span> nMode == <span style="color: #000000;">4</span> <span style="color: #B900B9;">//selection dialog</span><br /> lreturn := .t.<br /> END <span style="color: #00C800;">CASE</span><br /><br /> <span style="color: #00C800;">ELSE</span><br /><br /> <span style="color: #00C800;">if</span> nMode < <span style="color: #000000;">4</span><br /> lreturn := .t.<br /> <span style="color: #00C800;">else</span><br /> <span style="color: #00C800;">if</span> MsgYesNo<span style="color: #000000;">(</span><span style="color: #ff0000;">"Nominativo inesistente. ¿ Desideri inserirlo ora? "</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// on selection dialog ask to add the new record</span><br /> lreturn := ClEdita<span style="color: #000000;">(</span> , <span style="color: #000000;">1</span>, , , @cCognome <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> lreturn := .f.<br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /><br /><br /><br /> <span style="color: #00C800;">if</span> lreturn == .f.<br /> oGet:<span style="color: #000000;">cText</span><span style="color: #000000;">(</span> space<span style="color: #000000;">(</span><span style="color: #000000;">20</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /> oDbf:<span style="color: #000000;">SetOrder</span><span style="color: #000000;">(</span> nOrder <span style="color: #000000;">)</span><br /> oDbf:<span style="color: #000000;">GoTo</span><span style="color: #000000;">(</span> nRecno <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">Select</span> <span style="color: #000000;">(</span>nArea<span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">return</span> lreturn</div>[/code:2mzfs0mq] |
check existing first and last on customer - RESOLVED !!! | Please change this line
[code=fw:1f8mbmb7]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">IF</span> oDbf:<span style="color: #000000;">LookUp</span><span style="color: #000000;">(</span> UPPER<span style="color: #000000;">(</span> PADR<span style="color: #000000;">(</span> cCognome, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span> + PADR<span style="color: #000000;">(</span> cNome, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, ;<br /> <span style="color: #ff0000;">"UPPER(CLICOGNOME+CLINOME)"</span>, <span style="color: #000000;">{</span> || FOUND<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> </div>[/code:1f8mbmb7]
AS
[code=fw:1f8mbmb7]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">IF</span> oDbf:<span style="color: #000000;">LookUp</span><span style="color: #000000;">(</span> UPPER<span style="color: #000000;">(</span> PADR<span style="color: #000000;">(</span> cCognome, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span> + PADR<span style="color: #000000;">(</span> cNome, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, ;<br /> <span style="color: #ff0000;">"UPPER(CLICOGNOME+CLINOME)"</span>, <span style="color: #000000;">{</span> || FOUND<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span> == .T.<br /> </div>[/code:1f8mbmb7] |
check existing first and last on customer - RESOLVED !!! | thanks Rao , run good!!! |
check existing first and last on customer - RESOLVED !!! | Offtopic:
Is it a practice or tradition in your country to name children after their grandfather/grandmother's name?
I am curious because it is a tradition to give the first son his paternal grandfather's name and the first daughter her paternal grandmother's name in our region of our country. Same way, the second son and daughter get maternal grandfather and grandmothers' names. Of course, the present generation is mostly ignoring the tradition. |
check existing first and last on customer - RESOLVED !!! | [quote="nageswaragunupudi":f506annf]Offtopic:
Is it a practice or tradition in your country to name children after their grandfather/grandmother's name?
I am curious because it is a tradition to give the first son his paternal grandfather's name and the first daughter her paternal grandmother's name in our region of our country. Same way, the second son and daughter get maternal grandfather and grandmothers' names. Of course, the present generation is mostly ignoring the tradition.[/quote:f506annf]
I am the first child so my name is my grandfather.
My brother is called Massimiliano and now he has a son who bears the name of the father of my brother's wife.
Generally the first child is called by the same name, but this custom is no longer fashionable.
In my city there are many people who are called like me (name and surname) but we are not relatives,
one in particular is the same age as me but was born the day before me, so even the tax code is almost the same
and a few weeks ago his grandfather died who was named like us and everyone thought he was my grandfather and everyone gave me condolences
but my grandfather died 35 years ago when i was 19. |
check existing first and last on customer - RESOLVED !!! | Thanks for the information. We have similar traditions. |
check if NIP is active | some one has check active NIP
<!-- m --><a class="postlink" href="https://ppuslugi.mf.gov.pl/_/">https://ppuslugi.mf.gov.pl/_/</a><!-- m -->
API
<!-- m --><a class="postlink" href="https://www.finanse.mf.gov.pl/pp/komunikaty/-/asset_publisher/qqR2/content/id/6347532">https://www.finanse.mf.gov.pl/pp/komuni ... id/6347532</a><!-- m -->
send:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.mf.gov.pl/uslugiBiznesowe/uslugiDomenowe/AP/WeryfikacjaVAT/2018/03/01">
<soapenv:Header/>
<soapenv:Body>
<ns:NIP>9999999999</ns:NIP>
</soapenv:Body>
</soapenv:Envelope>
function return:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<WynikOperacji xmlns="http://www.mf.gov.pl/uslugiBiznesowe/uslugiDomenowe/AP/WeryfikacjaVAT/2018/03/01">
<Kod>N</Kod>
<Komunikat>Podmiot o podanym identyfikatorze podatkowym NIP nie jest zarejestrowany jako podatnik VAT</Komunikat>
</WynikOperacji>
</s:Body>
</s:Envelope>
best regards KAJOT |
check if a bmp or jpg image is valid | Just try to open the image inside a TRY/CATCH/END structure and trap the error.
EMG |
check if a bmp or jpg image is valid | There is no way to test via Windows API or whatever, because with try catch
entering the try block and catch the app was already, and that they want to avoid |
check if a bmp or jpg image is valid | Sorry, I don't understand.
EMG |
check if a bmp or jpg image is valid | is there any way to check if a bmp or jpg file is valid in FiveWin / xHarbour, since I have my application in a folder of pictures of products show on the screen as the sale goes through.
more is happening to stop the application and find that you have some images that the program can not open and lock. |
check if a bmp or jpg image is valid | I say this, I wanted to see if the photo or image file is valid.
example:
if checkimg ("teste.jpg")
obmp: loadbmp ("teste.jpg")
endif
something like this. Why try to catch suppose it to have it established in the block between the try and catch the app as it is happening.
has no function of the Windows API function to check or some of the FreeImage?
sorry my bad inglish i used google, rsrsrsrs |
check if a bmp or jpg image is valid | [quote="gss200610":1lg5g4uo]I say this, I wanted to see if the photo or image file is valid.
example:
if checkimg ("teste.jpg")
obmp: loadbmp ("teste.jpg")
endif
something like this.[/quote:1lg5g4uo]
Yes, and I already answered: use a TRY/CATCH/END structure:
[code=fw:1lg5g4uo]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">FUNCTION</span> CHECKIMG<span style="color: #000000;">(</span> cImg <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> lOk := .F.<br /><br /> <span style="color: #00C800;">TRY</span><br /> <span style="color: #B900B9;">// try to load cImg</span><br /> lOk = .T.<br /> CATCH<br /> END<br /><br /> <span style="color: #00C800;">RETURN</span> lOk</div>[/code:1lg5g4uo]
[quote="gss200610":1lg5g4uo]has no function of the Windows API function to check or some of the FreeImage?[/quote:1lg5g4uo]
I don't know, sorry.
EMG |
check if a control is hidden or not | Could someone please tell me how to detect a hidden control?
I've tried:
[code=fw:3f217lbt]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">REDEFINE</span> BUTTONBMP <span style="color: #0000ff;">ID</span> <span style="color: #000000;">505</span> <span style="color: #0000ff;">OF</span> oFld:<span style="color: #000000;">aDialogs</span><span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> ; <span style="color: #B900B9;">//show images</span><br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> msgstop<span style="color: #000000;">(</span> GetNMHDRHWndFrom<span style="color: #000000;">(</span> oBmp<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span>:<span style="color: #000000;">oDlg</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, ;<br /> Show_Hide_Img<span style="color: #000000;">(</span>.F., .T., oDbf, oDlg, @oBmp, @cText, aPedg, cImages<span style="color: #000000;">)</span> <span style="color: #000000;">)</span>;<br /> BITMAP <span style="color: #ff0000;">".<span style="color: #000000;">\i</span>mages<span style="color: #000000;">\c</span>amera.bmp"</span> <br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">IMAGE</span> oBmp<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">400</span> <span style="color: #0000ff;">OF</span> oFld:<span style="color: #000000;">aDialogs</span><span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">ADJUST</span> <span style="color: #0000ff;">UPDATE</span><br /><br />msgstop<span style="color: #000000;">(</span> IsWindowVisible<span style="color: #000000;">(</span> oBmp<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span>:<span style="color: #000000;">oDlg</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br />msgstop<span style="color: #000000;">(</span> IsWindowVisible<span style="color: #000000;">(</span> ::<span style="color: #000000;">oBmp</span><span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span>:<span style="color: #000000;">oDlg</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br />msgstop<span style="color: #000000;">(</span> IsWindowVisible<span style="color: #000000;">(</span> oBmp<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span>:<span style="color: #000000;">oDlg</span>:<span style="color: #000000;">hWnd</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br />msgstop<span style="color: #000000;">(</span> IsWindowVisible<span style="color: #000000;">(</span> ::<span style="color: #000000;">oBmp</span><span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span>:<span style="color: #000000;">oDlg</span>:<span style="color: #000000;">hWnd</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br />msgstop<span style="color: #000000;">(</span> IsWindowVisible<span style="color: #000000;">(</span> oDlg:<span style="color: #000000;">hWnd</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">//<-- this works but I do not need to know if the dialog is hidden, but if the control oBmp [3] of the dialog oDlg has been hidden</span></div>[/code:3f217lbt]
I get "Error BASE/1004 Message not found: TIMAGE:ODLG" |
check if a control is hidden or not | Since this was urgent I solve it like this:
[code=fw:3069bfz1]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">LOCAL</span> lHide:=.F.<br />...<br /><span style="color: #0000ff;">REDEFINE</span> BUTTONBMP <span style="color: #0000ff;">ID</span> <span style="color: #000000;">505</span> <span style="color: #0000ff;">OF</span> oFld:<span style="color: #000000;">aDialogs</span><span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> ; <span style="color: #B900B9;">//show images</span><br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> lHide:= !lHide, ;<br /> Show_Hide_Img<span style="color: #000000;">(</span>lHide, .T., oDbf, oDlg, @oBmp, @cText, aPedg, cImages<span style="color: #000000;">)</span> <span style="color: #000000;">)</span>;<br /> BITMAP <span style="color: #ff0000;">".<span style="color: #000000;">\i</span>mages<span style="color: #000000;">\c</span>amera.bmp"</span><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">IMAGE</span> oBmp<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">400</span> <span style="color: #0000ff;">OF</span> oFld:<span style="color: #000000;">aDialogs</span><span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">ADJUST</span> <span style="color: #0000ff;">UPDATE</span><br />...<br /> </div>[/code:3069bfz1]
But it will be nice to know the "right" way
Thanks
Emiliano Llano Díaz |
check if a control is hidden or not | [code=fw:2rs2bp5p]<div class="fw" id="{CB}" style="font-family: monospace;">msgstop<span style="color: #000000;">(</span> IsWindowVisible<span style="color: #000000;">(</span> oBmp<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span>:<span style="color: #000000;">hWnd</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span></div>[/code:2rs2bp5p]
EMG |
check if a control is hidden or not | The only variation I did not try!
<!-- s:oops: --><img src="{SMILIES_PATH}/icon_redface.gif" alt=":oops:" title="Embarassed" /><!-- s:oops: -->
Thanks
ELLD
[code=fw:3t17grjs]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">REDEFINE</span> BUTTONBMP <span style="color: #0000ff;">ID</span> <span style="color: #000000;">505</span> <span style="color: #0000ff;">OF</span> oFld:<span style="color: #000000;">aDialogs</span><span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> ; <span style="color: #B900B9;">//Show photo</span><br /> <span style="color: #0000ff;">ACTION</span> Hide_Image<span style="color: #000000;">(</span> IsWindowVisible<span style="color: #000000;">(</span>oBmp<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span>:<span style="color: #000000;">hWnd</span><span style="color: #000000;">)</span>, .T., oDbf, oDlg, @oBmp, @cText, aPedg, cImage<span style="color: #000000;">)</span> ;<br /> BITMAP <span style="color: #ff0000;">".<span style="color: #000000;">\i</span>mages<span style="color: #000000;">\c</span>amera.bmp"</span><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">IMAGE</span> oBmp<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">400</span> <span style="color: #0000ff;">OF</span> oFld:<span style="color: #000000;">aDialogs</span><span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">ADJUST</span> <span style="color: #0000ff;">UPDATE</span></div>[/code:3t17grjs] |
check if there is an ID in resource | How can I check, if there is an ID in my resource
eg.
IsId(oDialog,4711) |
check if there is an ID in resource | Before or after the controls have been REDEFINEd?
EMG |
check if there is an ID in resource | [quote="EnricoMaria":15s5yi9t]Before or after the controls have been REDEFINEd?
EMG[/quote:15s5yi9t]
Before they have been REDEFINED - to check, if the ID exists. |
check if there is an ID in resource | I don't know, sorry. It seems you can't.
EMG |
check if there is an ID in resource | Frank,
You can only do it from the ON INIT clause of the ACTIVATE DIALOG ... command:
GetDlgItem( oDlg:hWnd , nID ) --> hWndControl
hWndControl will be zero if it does not exists |
check if there is an ID in resource | You are right, it works!
EMG |
check on a archive from a array- resolved | I have to check in an archive to see if there are records that need to be deleted because they are not needed.
To check which elements are not necessary I have to compare if two items of an array (adata) previously loaded are the same in the archive.
If in the archive a record has the contents of two fields that are not equal to the items of aData must be deleted.
I made this test but it not found that I wish
[code=fw:d17xsbu9]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">Function</span> Trova_tariffe_inutili<span style="color: #000000;">(</span>cDir,adata<span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">Local</span> oTariffe<br /> <span style="color: #00C800;">Local</span> n<br /> <span style="color: #00C800;">Local</span> cIdElemento<br /> <span style="color: #00C800;">Local</span> cSettore<br /> <span style="color: #00C800;">Local</span> lyes:= .f.<br /> <span style="color: #00C800;">Local</span> atemp:=<span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> xbrowser aData<br /><br /> <span style="color: #00C800;">For</span> n= <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> Len<span style="color: #000000;">(</span>adata<span style="color: #000000;">)</span><br /> cIdElemento:= aData <span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><br /> cSettore := aData <span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">4</span><span style="color: #000000;">]</span><br /><br /> oTariffe:=TDatabase<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> , cDir+<span style="color: #ff0000;">"TARIFFE"</span>, <span style="color: #ff0000;">"DBFCDX"</span>, .T. <span style="color: #000000;">)</span><br /> oTariffe:<span style="color: #000000;">SetOrder</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> oTariffe:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">Do</span> <span style="color: #00C800;">while</span> .not. oTariffe:<span style="color: #000000;">eof</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> oTariffe:<span style="color: #000000;">Tasettore</span>==cSettore .and. oTariffe:<span style="color: #000000;">TaElemento</span>=cIdElemento<br /> <span style="color: #00C800;">else</span><br /> aadd<span style="color: #000000;">(</span>atemp,<span style="color: #000000;">{</span>oTariffe:<span style="color: #000000;">TaElemento</span>,oTariffe:<span style="color: #000000;">Tasettore</span><span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Endif</span><br /><br /> oTariffe:<span style="color: #000000;">skip</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Enddo</span><br /> oTariffe:<span style="color: #000000;">close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> cSettore:=<span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">next</span><br /><br /><br /> xbrowser atemp<br /> <span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span></div>[/code:d17xsbu9]
[b:d17xsbu9]on aData I have these items[/b:d17xsbu9]
[img:d17xsbu9]https://i.postimg.cc/YqD0JkLx/adata.png[/img:d17xsbu9]
[b:d17xsbu9]on archive Tariffe.dbf I have these records[/b:d17xsbu9]
[img:d17xsbu9]https://i.postimg.cc/WzWpL6z4/tariffe.png[/img:d17xsbu9]
[b:d17xsbu9]so the procedure must search only the two records[/b:d17xsbu9]
[img:d17xsbu9]https://i.postimg.cc/Kv1x3T4n/tariffe.png[/img:d17xsbu9]
because tasettore = "I" and tasettore ="F" on adata not exit
How I can resolve it ? |
check on a archive from a array- resolved | Perhaps Now I resolved
[code=fw:2m1fj1z5]<div class="fw" id="{CB}" style="font-family: monospace;">oTariffe:=TDatabase<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> , cDir+<span style="color: #ff0000;">"TARIFFE"</span>, <span style="color: #ff0000;">"DBFCDX"</span>, .T. <span style="color: #000000;">)</span><br /> oTariffe:<span style="color: #000000;">SetOrder</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// UPPER(TAELEMENTO)+TASETTORE</span><br /> oTariffe:<span style="color: #000000;">GoToP</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">for</span> n:= <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> len<span style="color: #000000;">(</span>adata<span style="color: #000000;">)</span><br /> cId:=adata<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><br /> cSector:=adata<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">4</span><span style="color: #000000;">]</span><br /><br /><br /> oTariffe:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span>, <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// reset</span><br /> oTariffe:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span>, <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// reset</span><br /> oTariffe:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span>, aData<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> + aData<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">4</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// set top scope from array</span><br /> oTariffe:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span>, aData<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> + aData<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">4</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span><br /><br /> oTariffe:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> oTariffe:<span style="color: #000000;">EOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> = .F.<br /> <span style="color: #B900B9;">// oTariffe:DELETE() // delete filter-data</span><br /> oTariffe:<span style="color: #000000;">tacancel</span>:=.t.<br /> oTariffe:<span style="color: #000000;">save</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oTariffe:<span style="color: #000000;">commit</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oTariffe:<span style="color: #000000;">Skip</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDDO</span><br /> n++<br /> <span style="color: #00C800;">NEXT</span></div>[/code:2m1fj1z5]
Now I haveonly two the records with tacancel :=.t.
I must make an array with this filter and show it
then if the fina user confirm I can delete only the records having tacancel:= .t.
oTariffe:ORDSCOPE(0, NIL ) // reset
oTariffe:ORDSCOPE(1, NIL ) // reset
oTariffe:GoToP()
atemp:=oTariffe:FW_DbfToArray( cFieldList, { || oTariffe:TACANCEL=.t. } )
xbrowser atemp
[img:2m1fj1z5]https://i.postimg.cc/g0414WmZ/hhhhh.png[/img:2m1fj1z5]
Finally, [b:2m1fj1z5]thanks to Uwe, [/b:2m1fj1z5]I have an array with the records must be deleted !!!! |
check on a archive from a array- resolved | Silvio,
[quote:2nhfg7vf]If in the archive a record has the contents of two fields
that are not equal to the items of aData must be deleted.[/quote:2nhfg7vf]
my test to filter data from a array
Just to know if the speed needs to be increased :
how many records You have to test and what is the length of the array to be checked <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
[img:2nhfg7vf]http://www.pflegeplus.com/IMAGES/Datasel1.jpg[/img:2nhfg7vf]
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
check on a archive from a array- resolved | Uwe,
I cannot Know it
on archive can be also 2000 rows
on aData array generally there are now 24 rows but it depend from some factors
I need it ...I can explain you
when creating a beach I can insert elements that are for hire, for these elements the price list must be made for each price list which are generally 3 and can vary according to the sectors from A to H
elements x price lists x sectors
the next are those who create the beach can remove an element or a sector: for example, this year you find an umbrella in the H sector but next year you will find a beach umbrella in sector G and not more H
so the idea was to find in the tariff archive the price list that is no longer necessary because precisely the rates for the H sector umbrella are no longer needed |
check on a archive from a array- resolved | Silvio,
how often You have to run this test.
I'm just thinking about. to include a meter-control in case of a longer running time.
regards
Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: --> |
check on a archive from a array- resolved | No because the final user can run this procedure at init of each season.
i must know wich record to erase because then on report of price list the record deleted must no printed |
check on a archive from a array- resolved | Silvio,
I tested a solution for better speed ( short and very fast )
It only scans the array-data and not the maybe possible 2000 records from the dbf
[code=fw:3j42ezwu]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> SELECT_DATA<span style="color: #000000;">(</span>oCust1, aData<span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> n := <span style="color: #000000;">1</span><br /><br /><span style="color: #B900B9;">// CreateIndex( cFile, cTag, cKey, lUnique, lDescend, lMemory )</span><br />oCust1:<span style="color: #000000;">CreateIndex</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"CUSTOMER"</span>, <span style="color: #ff0000;">"TMP"</span>, <span style="color: #ff0000;">"LAST + FIRST"</span>, , , .T. <span style="color: #000000;">)</span> <span style="color: #B900B9;">// index in memory </span><br /> <br /><span style="color: #00C800;">FOR</span> n := <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> LEN<span style="color: #000000;">(</span>aData<span style="color: #000000;">)</span> <span style="color: #B900B9;">// scan and select data from array</span><br /> <span style="color: #B900B9;">// filter on array-data</span><br /> oCust1:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span>, <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// reset </span><br /> oCust1:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span>, <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// reset </span><br /> oCust1:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span>, aData<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> + aData<span style="color: #000000;">[</span>n<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: #B900B9;">// set top scope from array</span><br /> oCust1:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span>, aData<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> + aData<span style="color: #000000;">[</span>n<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: #B900B9;">// set bottom scope from array</span><br /> <br /> oCust1:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> oCust1:<span style="color: #000000;">EOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> = .F. <br /> oCust1:<span style="color: #000000;">DELETE</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// delete filter-data</span><br /> oCust1:<span style="color: #000000;">Skip</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDDO</span><br /> n++<br /><span style="color: #00C800;">NEXT</span><br /><br />oCust1:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span>, <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// reset </span><br />oCust1:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span>, <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// reset </span><br /> </div>[/code:3j42ezwu]
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
check on a archive from a array- resolved | [quote="ukoenig":3j7c3s18]Silvio,
I tested a solution for better speed ( short and very fast )
It only scans the array-data and not the maybe possible 2000 records from the dbf
[code=fw:3j7c3s18]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> SELECT_DATA<span style="color: #000000;">(</span>oCust1, aData<span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> n := <span style="color: #000000;">1</span><br /><br /><span style="color: #B900B9;">// CreateIndex( cFile, cTag, cKey, lUnique, lDescend, lMemory )</span><br />oCust1:<span style="color: #000000;">CreateIndex</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"CUSTOMER"</span>, <span style="color: #ff0000;">"TMP"</span>, <span style="color: #ff0000;">"LAST + FIRST"</span>, , , .T. <span style="color: #000000;">)</span> <span style="color: #B900B9;">// index in memory </span><br /> <br /><span style="color: #00C800;">FOR</span> n := <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> LEN<span style="color: #000000;">(</span>aData<span style="color: #000000;">)</span> <span style="color: #B900B9;">// scan and select data from array</span><br /> <span style="color: #B900B9;">// filter on array-data</span><br /> oCust1:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span>, <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// reset </span><br /> oCust1:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span>, <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// reset </span><br /> oCust1:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span>, aData<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> + aData<span style="color: #000000;">[</span>n<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: #B900B9;">// set top scope from array</span><br /> oCust1:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span>, aData<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> + aData<span style="color: #000000;">[</span>n<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: #B900B9;">// set bottom scope from array</span><br /> <br /> oCust1:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> oCust1:<span style="color: #000000;">EOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> = .F. <br /> oCust1:<span style="color: #000000;">DELETE</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// delete filter-data</span><br /> oCust1:<span style="color: #000000;">Skip</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDDO</span><br /> n++<br /><span style="color: #00C800;">NEXT</span><br /><br />oCust1:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span>, <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// reset </span><br />oCust1:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span>, <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// reset </span><br /> </div>[/code:3j7c3s18]
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->[/quote:3j7c3s18]
Uwe,
I tried
I have Tariffe.dbf indexed with UPPER(TAELEMENTO)+TASETTORE
cId:=adata[n][2] // taelemento
cSector:=adata[n][4] // tasettore
I made
[code=fw:3j7c3s18]<div class="fw" id="{CB}" style="font-family: monospace;">oTariffe:=TDatabase<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> , cDir+<span style="color: #ff0000;">"TARIFFE"</span>, <span style="color: #ff0000;">"DBFCDX"</span>, .T. <span style="color: #000000;">)</span><br /> oTariffe:<span style="color: #000000;">SetOrder</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// UPPER(TAELEMENTO)+TASETTORE</span><br /> oTariffe:<span style="color: #000000;">GoToP</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">for</span> n:= <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> len<span style="color: #000000;">(</span>adata<span style="color: #000000;">)</span><br /> cId:=adata<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><br /> cSector:=adata<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">4</span><span style="color: #000000;">]</span><br /><br /><br /> oTariffe:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span>, <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// reset</span><br /> oTariffe:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span>, <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// reset</span><br /> oTariffe:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span>, aData<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> + aData<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">4</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// set top scope from array</span><br /> oTariffe:<span style="color: #000000;">ORDSCOPE</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span>, aData<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> + aData<span style="color: #000000;">[</span>n<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #000000;">4</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span><br /><br /> oTariffe:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> oTariffe:<span style="color: #000000;">EOF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> = .F.<br /> oTariffe:<span style="color: #000000;">DELETE</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// delete filter-data</span><br /> oTariffe:<span style="color: #000000;">Skip</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDDO</span><br /> n++<br /> <span style="color: #00C800;">NEXT</span><br /><br /><br /> </div>[/code:3j7c3s18]
IT delete all as you can see here
[img:3j7c3s18]https://i.postimg.cc/xdrT39x1/err.png[/img:3j7c3s18]
while it must delete only the records have F and I on 7th column
to not delete all record I thinked to insert a LOGIC field TACANCEL and chabge this as
DO WHILE oTariffe:EOF() = .F.
// oTariffe:DELETE() // delete filter-data
oTariffe:tacancel:=.t.
oTariffe:save()
oTariffe:commit()
oTariffe:Skip()
ENDDO |
check on get | [quote="nageswaragunupudi":3tno90zp][quote:3tno90zp]I tried to found the result of oGet:lchanged and give me no exist
Code:
Error occurred at: 27-11-2023, 11:06:45
Error description: Error BASE/1004 Metodo non disponibile: LCHANGED
Args:
[ 1] = U
[/quote:3tno90zp]
This error means that oGet is NIL[/quote:3tno90zp]
Nages,
I tried with
Aeval( aGet, { | o | if(o != nil .and. o:IsKindOf( "TGET" ) .and. o:lChanged,lAsk := .t.,.f.) } ) [b:3tno90zp]//this give me allways .t.[/b:3tno90zp]
[code=fw:3tno90zp]<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> test<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> aGet:=array<span style="color: #000000;">(</span><span style="color: #000000;">2</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> oDlg<br /><span style="color: #00C800;">local</span> cGet1:=space<span style="color: #000000;">(</span><span style="color: #000000;">60</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> cGet2:=space<span style="color: #000000;">(</span><span style="color: #000000;">60</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> lSave:=.f.<br /><span style="color: #00C800;">local</span> bCheck<br /><span style="color: #00C800;">local</span> oBtn1,oBtn2<br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">400</span>,<span style="color: #000000;">300</span><br />@ <span style="color: #000000;">10</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">GET</span> aGet<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> cGet1 <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">of</span> oDlg<br />@ <span style="color: #000000;">40</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">GET</span> aGet<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> cGet2 <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">of</span> oDlg<br /> @ <span style="color: #000000;">80</span>, <span style="color: #000000;">55</span> <span style="color: #0000ff;">BUTTON</span> oBtn1 <span style="color: #0000ff;">Prompt</span> <span style="color: #ff0000;">"&OK"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">45</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> oDlg:<span style="color: #000000;">end</span><span style="color: #000000;">(</span> IDOK <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> @ <span style="color: #000000;">80</span>, <span style="color: #000000;">107</span> <span style="color: #0000ff;">BUTTON</span> oBtn2 <span style="color: #0000ff;">Prompt</span> <span style="color: #ff0000;">"&EXIT"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">45</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span>oDlg:<span style="color: #000000;">end</span><span style="color: #000000;">(</span> IDCANCEL <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br /> <span style="color: #0000ff;">VALID</span> Salida2<span style="color: #000000;">(</span> .F., , ,aGet <span style="color: #000000;">)</span><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><span style="color: #00C800;">FUNCTION</span> Salida2<span style="color: #000000;">(</span> lEsc, lAsk, cMsg,aGet <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">DEFAULT</span> lEsc := .f., lAsk := .f., cMsg := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">if</span> getkeystate<span style="color: #000000;">(</span> VK_ESCAPE <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Return</span><span style="color: #000000;">(</span> lEsc <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #B900B9;">//aGet</span><br /> <br /> Aeval<span style="color: #000000;">(</span> aGet, <span style="color: #000000;">{</span> | o | <span style="color: #00C800;">if</span><span style="color: #000000;">(</span>o != <span style="color: #00C800;">nil</span> .and. o:<span style="color: #000000;">IsKindOf</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"TGET"</span> <span style="color: #000000;">)</span> .and. o:<span style="color: #000000;">lChanged</span>,lAsk := .t.,.f.<span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">//this give me allways .t. </span><br /><br /> ? lAsk<br /><br /> <span style="color: #00C800;">If</span> lAsk<br /> <span style="color: #00C800;">If</span> Empty<span style="color: #000000;">(</span> cMsg <span style="color: #000000;">)</span><br /> cMsg := <span style="color: #ff0000;">"Desideri uscire da questa operazione...?"</span><br /> End<br /> <span style="color: #00C800;">If</span> !MsgNoyes<span style="color: #000000;">(</span>cMsg,<span style="color: #ff0000;">"Conferma per favore..."</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Return</span> .f.<br /> End<br /> End<br /> <span style="color: #00C800;">return</span> .T.</div>[/code:3tno90zp] |
check on get | I would like to check if any get is modified during editing, if it is modified the procedure must ask the user to save or not
when the user presses "Exit" I wanted to check if the gets have been modified
I made
[code=fw:nd3k215r]<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> test<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> aGet:=array<span style="color: #000000;">(</span><span style="color: #000000;">2</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> oDlg<br /><span style="color: #00C800;">local</span> cGet1:=space<span style="color: #000000;">(</span><span style="color: #000000;">60</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> cGet2:=space<span style="color: #000000;">(</span><span style="color: #000000;">60</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> lSave:=.f.<br /><span style="color: #00C800;">local</span> bCheck<br /><span style="color: #00C800;">local</span> oBtn1,oBtn2<br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDLG <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">400</span>,<span style="color: #000000;">200</span><br /><br />@ <span style="color: #000000;">10</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">GET</span> aGet<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> cGet1 <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">of</span> oDlg<br />@ <span style="color: #000000;">40</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">GET</span> aGet<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> cGet2 <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">of</span> oDlg<br /><br /> @ <span style="color: #000000;">90</span>, <span style="color: #000000;">55</span> <span style="color: #0000ff;">BUTTON</span> oBtn1 <span style="color: #0000ff;">Prompt</span> <span style="color: #ff0000;">"&OK"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">45</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> oDlg:<span style="color: #000000;">end</span><span style="color: #000000;">(</span> IDOK <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> @ <span style="color: #000000;">90</span>, <span style="color: #000000;">107</span> <span style="color: #0000ff;">BUTTON</span> oBtn2 <span style="color: #0000ff;">Prompt</span> <span style="color: #ff0000;">"&EXIT"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">45</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> oDlg:<span style="color: #000000;">end</span><span style="color: #000000;">(</span> IDCANCEL <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> * <br />bCheck:= <span style="color: #000000;">{</span> || lSave:= IIF<span style="color: #000000;">(</span>Msgyesno<span style="color: #000000;">(</span><span style="color: #ff0000;">"I must save ?"</span><span style="color: #000000;">)</span>,.t.,.f.<span style="color: #000000;">)</span>, oDLG:<span style="color: #000000;">AEvalWhen</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, .t. <span style="color: #000000;">}</span><br /><br />AEval<span style="color: #000000;">(</span> aGet, <span style="color: #000000;">{</span> |o| o:<span style="color: #000000;">bChange</span> := bCheck <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;">CENTER</span> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> EVAL<span style="color: #000000;">(</span>bCheck<span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">IF</span> lSave<br /><span style="color: #B900B9;">//---- save</span><br /><span style="color: #00C800;">Endif</span><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span> <br /><br /> </div>[/code:nd3k215r]
I made also
AEval(aGet,{|oGet| oGet:bChange:={||lSave:= IIF(Msgyesno("I must save ?"),.t.,.f.)}})
but not run ok,How I can resolve ? |
check on get | There will be better ways, but i would think of making the aGet 2 dimensional and fill the second part with the original data.
After edit you could simple check the values for differences in the aGet |
check on get | yo haria asi:
[code=fw:1c7np0i4]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// C:\FWH\SAMPLES\SILVICHK.PRG</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #00C800;">STATIC</span> lSave := .F.<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> aGet := ARRAY<span style="color: #000000;">(</span> <span style="color: #000000;">2</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> oDlg<br /> <span style="color: #00C800;">LOCAL</span> cGet1 := SPACE<span style="color: #000000;">(</span> <span style="color: #000000;">60</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> cGet2 := SPACE<span style="color: #000000;">(</span> <span style="color: #000000;">60</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> bCheck<br /> <span style="color: #00C800;">LOCAL</span> oBtn1, oBtn2<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">400</span>, <span style="color: #000000;">200</span><br /><br /> @ <span style="color: #000000;">10</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">GET</span> aGet<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> cGet1 <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg<br /><br /> @ <span style="color: #000000;">40</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">GET</span> aGet<span style="color: #000000;">[</span> <span style="color: #000000;">2</span> <span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> cGet2 <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg<br /><br /> @ <span style="color: #000000;">90</span>, <span style="color: #000000;">55</span> <span style="color: #0000ff;">BUTTON</span> oBtn1 <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"&OK"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">45</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> lSave := .T., oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// IDOK ?? .RC? NO COMPRENDO ESTO</span><br /><br /> @ <span style="color: #000000;">90</span>, <span style="color: #000000;">107</span> <span style="color: #0000ff;">BUTTON</span> oBtn2 <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"&EXIT"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">45</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> lSave := .F., oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> CANCEL <span style="color: #B900B9;">// IDCANCEL // ??</span><br /><br /> <span style="color: #B900B9;">// bCheck := {|| lSave := iif( Msgyesno( "I must save ?" ), .T., .F. ), oDlg:AEvalWhen(), .T. }</span><br /><br /> <span style="color: #B900B9;">// bCheck := {|| lSave := iif( Msgyesno( "I must save ?" ), .T., .F. ), oDlg:End(), .T. }</span><br /><br /> <span style="color: #B900B9;">// AEval( aGet, {| o | o:bChange := bCheck } )</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTER</span> <span style="color: #B900B9;">// ON INIT Eval( bCheck )</span><br /><br /> <span style="color: #00C800;">IF</span> lSave<br /><br /> <span style="color: #B900B9;">// ---- save</span><br /> ? <span style="color: #ff0000;">"Grabar? "</span>, lSave <span style="color: #B900B9;">// .T.</span><br /><br /> <span style="color: #B900B9;">// Graba_Todo()</span><br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> lSave := .F. <span style="color: #B900B9;">// al salir.</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><span style="color: #B900B9;">// FIN / END</span><br /> </div>[/code:1c7np0i4]
Regards, saludos. |
check on get | FWH provides a way for the last many years.
if oGet:lChanged is true, the value is edited and modified.
We can also check the original value with oGet:uOriginalValue. |
check on get | [quote="nageswaragunupudi":3oxvzu0s]FWH provides a way for the last many years.
if oGet:lChanged is true, the value is edited and modified.
We can also check the original value with oGet:uOriginalValue.[/quote:3oxvzu0s]
Mister Rao:
[url:3oxvzu0s]https://forums.fivetechsupport.com/viewtopic.php?f=3&t=36677&p=218742&hilit=oGet%3AuOriginalValue&sid=07c886246d7ffe73fed662e55bd3cb86&sid=c321ec65cbe0a0b68df11d3cba5138d3#p218742[/url:3oxvzu0s]
Master Rao:
Sorry for the stupidity, but I've never seen anything like this working. Do you have any practical example of using these commands?
Perdón por la estupidez, pero nunca había visto algo así funcionando. ¿Tiene algún ejemplo práctico del uso de estos comandos?
Gracias, thanks.
Regards, saludos. |
check on get | Nages,
I'm making a complex but simple procedure to be able to use it even for those who don't have the latest version of fwh, it's a utility that I started a long time ago and then left because I was hoping for other procedures started by certain people who then didn't have having completed the work and now I see it quicker and at the same time powerful to use this type of procedure, even if it is ancient, to enhance some of the aspects necessary for those who program with fwh, in the future it could also be used for those who want to create procedures for web because if you want you can convert it for the web. |
check on get | [quote="karinha":39c6b5al]yo haria asi:
[code=fw:39c6b5al]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// C:\FWH\SAMPLES\SILVICHK.PRG</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #00C800;">STATIC</span> lSave := .F.<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> aGet := ARRAY<span style="color: #000000;">(</span> <span style="color: #000000;">2</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> oDlg<br /> <span style="color: #00C800;">LOCAL</span> cGet1 := SPACE<span style="color: #000000;">(</span> <span style="color: #000000;">60</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> cGet2 := SPACE<span style="color: #000000;">(</span> <span style="color: #000000;">60</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> bCheck<br /> <span style="color: #00C800;">LOCAL</span> oBtn1, oBtn2<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">400</span>, <span style="color: #000000;">200</span><br /><br /> @ <span style="color: #000000;">10</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">GET</span> aGet<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> cGet1 <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg<br /><br /> @ <span style="color: #000000;">40</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">GET</span> aGet<span style="color: #000000;">[</span> <span style="color: #000000;">2</span> <span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> cGet2 <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg<br /><br /> @ <span style="color: #000000;">90</span>, <span style="color: #000000;">55</span> <span style="color: #0000ff;">BUTTON</span> oBtn1 <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"&OK"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">45</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> lSave := .T., oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// IDOK ?? .RC? NO COMPRENDO ESTO</span><br /><br /> @ <span style="color: #000000;">90</span>, <span style="color: #000000;">107</span> <span style="color: #0000ff;">BUTTON</span> oBtn2 <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"&EXIT"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">45</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> lSave := .F., oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> CANCEL <span style="color: #B900B9;">// IDCANCEL // ??</span><br /><br /> <span style="color: #B900B9;">// bCheck := {|| lSave := iif( Msgyesno( "I must save ?" ), .T., .F. ), oDlg:AEvalWhen(), .T. }</span><br /><br /> <span style="color: #B900B9;">// bCheck := {|| lSave := iif( Msgyesno( "I must save ?" ), .T., .F. ), oDlg:End(), .T. }</span><br /><br /> <span style="color: #B900B9;">// AEval( aGet, {| o | o:bChange := bCheck } )</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTER</span> <span style="color: #B900B9;">// ON INIT Eval( bCheck )</span><br /><br /> <span style="color: #00C800;">IF</span> lSave<br /><br /> <span style="color: #B900B9;">// ---- save</span><br /> ? <span style="color: #ff0000;">"Grabar? "</span>, lSave <span style="color: #B900B9;">// .T.</span><br /><br /> <span style="color: #B900B9;">// Graba_Todo()</span><br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> lSave := .F. <span style="color: #B900B9;">// al salir.</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><span style="color: #B900B9;">// FIN / END</span><br /> </div>[/code:39c6b5al]
Regards, saludos.[/quote:39c6b5al]
Karinha,
what do you mean by "NO COMPRENDO ESTO" ?
[code=fw:39c6b5al]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg<br /> @ <span style="color: #000000;">80</span>, <span style="color: #000000;">55</span> <span style="color: #0000ff;">BUTTON</span> oBtn1 <span style="color: #0000ff;">Prompt</span> <span style="color: #ff0000;">"&OK"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">45</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> oDlg:<span style="color: #000000;">end</span><span style="color: #000000;">(</span> IDOK <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> @ <span style="color: #000000;">80</span>, <span style="color: #000000;">107</span> <span style="color: #0000ff;">BUTTON</span> oBtn2 <span style="color: #0000ff;">Prompt</span> <span style="color: #ff0000;">"&EXIT"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">45</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span>oDlg:<span style="color: #000000;">end</span><span style="color: #000000;">(</span> IDCANCEL <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg<br /><br /><span style="color: #00C800;">IF</span> oDlg:<span style="color: #000000;">nresult</span> == IDOK<br /> <span style="color: #0000ff;">Msginfo</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endif</span></div>[/code:39c6b5al]
what is difficult?
bother variable of the type [b:39c6b5al]"lsave:= .t. or lsave:= .f." [/b:39c6b5al] It's just for kids, it seems like you're still programming with the clipper |
check on get | [quote="nageswaragunupudi":2sjywr5p]FWH provides a way for the last many years.
if oGet:lChanged is true, the value is edited and modified.
We can also check the original value with oGet:uOriginalValue.[/quote:2sjywr5p]
Nages,
I not understood
I tried to found the result of oGet:lchanged and give me no exist
[code=fw:2sjywr5p]<div class="fw" id="{CB}" style="font-family: monospace;">Error occurred <span style="color: #00C800;">at</span>: <span style="color: #000000;">27</span><span style="color: #000000;">-11</span><span style="color: #000000;">-2023</span>, <span style="color: #000000;">11</span>:<span style="color: #000000;">06</span>:<span style="color: #000000;">45</span><br /> Error description: <span style="color: #000000;">Error</span> BASE/<span style="color: #000000;">1004</span> Metodo non disponibile: <span style="color: #000000;">LCHANGED</span><br /> Args:<br /> <span style="color: #000000;">[</span> <span style="color: #000000;">1</span><span style="color: #000000;">]</span> = U </div>[/code:2sjywr5p]
[code=fw:2sjywr5p]<div class="fw" id="{CB}" style="font-family: monospace;"> AEval<span style="color: #000000;">(</span>aGet,<span style="color: #000000;">{</span>|oGet| IIF<span style="color: #000000;">(</span> oGet:<span style="color: #000000;">lChanged</span>, lSave:= IIF<span style="color: #000000;">(</span>Msgyesno<span style="color: #000000;">(</span><span style="color: #ff0000;">"I must save ?"</span><span style="color: #000000;">)</span>,.t.,.f.<span style="color: #000000;">)</span>,<span style="color: #000000;">)</span> , oDLG:<span style="color: #000000;">AEvalWhen</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, .t. <span style="color: #000000;">}</span><span style="color: #000000;">)</span><br /> </div>[/code:2sjywr5p] |
check on get | [quote:2l8m2ljv]I tried to found the result of oGet:lchanged and give me no exist
Code:
Error occurred at: 27-11-2023, 11:06:45
Error description: Error BASE/1004 Metodo non disponibile: LCHANGED
Args:
[ 1] = U
[/quote:2l8m2ljv]
This error means that oGet is NIL |
check on get | [quote="nageswaragunupudi":1ye7xqlw][quote:1ye7xqlw]I tried to found the result of oGet:lchanged and give me no exist
Code:
Error occurred at: 27-11-2023, 11:06:45
Error description: Error BASE/1004 Metodo non disponibile: LCHANGED
Args:
[ 1] = U
[/quote:1ye7xqlw]
This error means that oGet is NIL[/quote:1ye7xqlw]
Can you make a sample with lChanged pls ? |
check on get | //aGet
lAsk:= Aeval( aGet, { | o | o:lChanged } )
or
Aeval( aGet, { | o | if(o:lChanged,lAsk := .t.,.f.) } )
give me error
Error description: Error BASE/1004 No exported method: LCHANGED
Args:
[ 1] = U
Stack Calls
===========
Called from: => LCHANGED( 0 )
Called from: test.prg => (b)SALIDA2( 894 )
Give me an error , how I can resolve to check all gets ? |
check on get | [quote:39wagv6q]
what is difficult?
bother variable of the type "lsave:= .t. or lsave:= .f." It's just for kids, it seems like you're still programming with the clipper
[/quote:39wagv6q]
Silvio, I learned to program in CLIPPER 5.3 and I continue to use the CLIPPER 5.3 modus operandi to this day. And I don't want to program in the way you program even in the next incarnation. I prefer programming for children. The day I program the way you program or treat people, I'd rather retire.
Silvio, aprendí a programar en CLIPPER 5.3 y sigo usando el modus operandi de CLIPPER 5.3 hasta el día de hoy. Y no quiero programar de la forma en que ustedes programan ni siquiera en la próxima encarnación. Prefiero la programación para niños. El día que programe la forma en que usted programa o trata a las personas, preferiría retirarme
Regards, saludos. |
check on get | Dear sir, I started a long time before you, with the Autumn 86 version of the Nuntucket Clipper, then I moved on to the Summer 87 version, that is, many years before the Clipper became Ca-Associates who killed the clipper with version 5.3, then we moved on to Clip4win, tried Alaska, and then Harry Evans, an Austrian from Momos clipper magazine in Bolzano, sold us the first version of the fivewin libraries version 1.44, then I purchased the Fw 19.5 version from Linares and so on up to the present day all or almost all versions purchased from Linares.
Every time I ask for help I should change the code to make you happy and I never find the answer to the requested question, I only get help when the fwteam or some other good person answers me, still today I can't understand why you, dear sir, are a moderator of the forum |
check on get | [quote="Silvio.Falconi":cavgvcyo]Dear sir, I started a long time before you, with the Autumn 86 version of the Nuntucket Clipper, then I moved on to the Summer 87 version, that is, many years before the Clipper became Ca-Associates who killed the clipper with version 5.3, then we moved on to Clip4win, tried Alaska, and then Harry Evans, an Austrian from Momos clipper magazine in Bolzano, sold us the first version of the fivewin libraries version 1.44, then I purchased the Fw 19.5 version from Linares and so on up to the present day all or almost all versions purchased from Linares.
Every time I ask for help I should change the code to make you happy and I never find the answer to the requested question, I only get help when the fwteam or some other good person answers me, still today I can't understand why you, dear sir, are a moderator of the forum[/quote:cavgvcyo]
Silvio, I am a moderator precisely because of people like you. Arrogant, rude, and other predicates that I will not mention here, as my education does not allow it. And I have no problem if Master Linãres takes away my powers, I will face you as MODERATOR or not. My duty is to fight BAD people like you.
Silvio, soy moderador precisamente por gente como tú. Arrogante, grosero y otros predicados que no mencionaré aquí, ya que mi educación no me lo permite. Y no tengo ningún problema si el Maestro Linãres me quita los poderes, te enfrentaré como MODERADOR o no. Mi deber es luchar contra la gente MALA como tú.
Regards, saludos. |
check on get | Dear João,
Did you know that in our FW-samples we have a program called moon.prg?
It calculates the phases of the full moon.
I've been conducting an empirical study for many years on people's behavior during the full moon. In the company, we send out warning emails,
as people in support become extremely unpleasantly demanding during this time.
The last full moon in 2023 was on November 26th.
Unfortunately, I discovered this connection too late in life. Many things are easier in dealing with people when you are aware of this.
Don't take posts too seriously during this time and don't get drawn into arguments.
Thank you for your valuable work here in the forum.
Best regards,
Otto |
check on get | Master Otto, I thank you for the advice. I'm a calm and peaceful person, but I don't have cockroach blood. I apologize if I hurt anyone in any way. Silvio Falconi has the gift of blowing anyone away, in any phase of the moon. hahahahahaha, 1000 apologies mister Otto.
Maestro Otto, le agradezco el consejo. Soy una persona tranquila y pacífica, pero no tengo sangre de cucaracha. Pido disculpas si lastimé a alguien de alguna manera. Silvio Falconi tiene el don de dejar boquiabierto a cualquiera, en cualquier fase de la luna. jajajajajaja, 1000 disculpas señor Otto.
Regards, saludos. |
check on get | Dear João,
it's difficult in a foreign language.
I just wanted to say that one shouldn't see and hear everything during full moon times.
It's not a criticism of you.
With kind regards,
Otto |
check on get | [quote="Otto":56equty2]Dear João,
it's difficult in a foreign language.
I just wanted to say that one shouldn't see and hear everything during full moon times.
It's not a criticism of you.
With kind regards,
Otto[/quote:56equty2]
Mr. Otto,
[code=fw:56equty2]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00D7D7;">#include</span><span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #00C800;">Function</span> test<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> aGet:=array<span style="color: #000000;">(</span><span style="color: #000000;">2</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> oDlg<br /><span style="color: #00C800;">local</span> cGet1:=space<span style="color: #000000;">(</span><span style="color: #000000;">60</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> cGet2:=space<span style="color: #000000;">(</span><span style="color: #000000;">60</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> lSave:=.f.<br /><span style="color: #00C800;">local</span> bCheck<br /><span style="color: #00C800;">local</span> oBtn1,oBtn2<br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">400</span>,<span style="color: #000000;">300</span><br />@ <span style="color: #000000;">10</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">GET</span> aGet<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> cGet1 <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">of</span> oDlg<br />@ <span style="color: #000000;">40</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">GET</span> aGet<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> cGet2 <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">of</span> oDlg<br /> @ <span style="color: #000000;">80</span>, <span style="color: #000000;">55</span> <span style="color: #0000ff;">BUTTON</span> oBtn1 <span style="color: #0000ff;">Prompt</span> <span style="color: #ff0000;">"&OK"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">45</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> oDlg:<span style="color: #000000;">end</span><span style="color: #000000;">(</span> IDOK <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> @ <span style="color: #000000;">80</span>, <span style="color: #000000;">107</span> <span style="color: #0000ff;">BUTTON</span> oBtn2 <span style="color: #0000ff;">Prompt</span> <span style="color: #ff0000;">"&EXIT"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">45</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span>oDlg:<span style="color: #000000;">end</span><span style="color: #000000;">(</span> IDCANCEL <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg<br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span> <br /> </div>[/code:56equty2]
What was hard?
Than I asked another question, not how save with lsave....
Do you think about ?
I only asked how check if the get are changed when the user press Exit or Ok button, you Know how make it ?
Joao always responds by inserting source code that has nothing to do with the request of the topic, after all he doesn't do it only and exclusively to me but to several people, only that sometimes if the person who made the request really needs the help, We are very upset when we read your answers,
Otto, it's like if I came to your hotel and asked for a double room and you pretend nothing happened and just give me a cot and in the garage, do you think it's the same thing? |
check on get | Si no cambio los valores de los gets, a mi me devuelve falso esa funcion |
check on get | el valor .t siempre me resulta extraño. |
check on get | [quote="Silvio.Falconi":3s11wjvg]el valor .t siempre me resulta extraño.[/quote:3s11wjvg]
Please let us know the FWH version |
check on get | I tested with this program and oGet:lChanged is working well.
[code=fw:ehsbcqrf]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oDlg, oFont, oGet1, oGet2, oGet3, oBtn<br /> <span style="color: #00C800;">local</span> cVar1 := PadR<span style="color: #000000;">(</span> <span style="color: #ff0000;">"ABC"</span>, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> cVar2 := PadR<span style="color: #000000;">(</span> <span style="color: #ff0000;">"DEF"</span>, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> nVar := <span style="color: #000000;">30000</span><br /> <span style="color: #00C800;">local</span> lSave := .f.<br /><br /> SetGetColorFocus<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"Segoe UI"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-14</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">300</span>,<span style="color: #000000;">200</span> <span style="color: #0000ff;">PIXEL</span> TRUEPIXEL <span style="color: #0000ff;">TITLE</span> FWVERSION ;<br /> <span style="color: #0000ff;">FONT</span> oFont<br /><br /> @ <span style="color: #000000;">20</span>, <span style="color: #000000;">20</span> <span style="color: #0000ff;">GET</span> oGet1 <span style="color: #0000ff;">VAR</span> cVar1 <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">150</span>,<span style="color: #000000;">24</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> <span style="color: #0000ff;">VALID</span> <span style="color: #000000;">(</span> oDlg:<span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, .t. <span style="color: #000000;">)</span><br /><br /> @ <span style="color: #000000;">20</span>,<span style="color: #000000;">180</span> <span style="color: #0000ff;">SAY</span> <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oGet1:<span style="color: #000000;">lChanged</span>, <span style="color: #ff0000;">"MODIFIED"</span>, <span style="color: #ff0000;">"no change"</span> <span style="color: #000000;">)</span> ;<br /> <span style="color: #0000ff;">COLOR</span> <span style="color: #000000;">{</span> || <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oGet1:<span style="color: #000000;">lChanged</span>, CLR_HRED, CLR_BLACK <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">80</span>,<span style="color: #000000;">22</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">UPDATE</span><br /><br /> @ <span style="color: #000000;">55</span>, <span style="color: #000000;">20</span> <span style="color: #0000ff;">GET</span> oGet2 <span style="color: #0000ff;">VAR</span> cVar2 <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">150</span>,<span style="color: #000000;">24</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> <span style="color: #0000ff;">VALID</span> <span style="color: #000000;">(</span> oDlg:<span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, .t. <span style="color: #000000;">)</span><br /><br /> @ <span style="color: #000000;">55</span>,<span style="color: #000000;">180</span> <span style="color: #0000ff;">SAY</span> <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oGet2:<span style="color: #000000;">lChanged</span>, <span style="color: #ff0000;">"MODIFIED"</span>, <span style="color: #ff0000;">"no change"</span> <span style="color: #000000;">)</span> ;<br /> <span style="color: #0000ff;">COLOR</span> <span style="color: #000000;">{</span> || <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oGet2:<span style="color: #000000;">lChanged</span>, CLR_HRED, CLR_BLACK <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">80</span>,<span style="color: #000000;">22</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">UPDATE</span><br /><br /> @ <span style="color: #000000;">90</span>, <span style="color: #000000;">20</span> <span style="color: #0000ff;">GET</span> oGet3 <span style="color: #0000ff;">VAR</span> nVar <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">150</span>,<span style="color: #000000;">24</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> <span style="color: #0000ff;">VALID</span> <span style="color: #000000;">(</span> oDlg:<span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, .t. <span style="color: #000000;">)</span><br /><br /> @ <span style="color: #000000;">90</span>,<span style="color: #000000;">180</span> <span style="color: #0000ff;">SAY</span> <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oGet3:<span style="color: #000000;">lChanged</span>, <span style="color: #ff0000;">"MODIFIED"</span>, <span style="color: #ff0000;">"no change"</span> <span style="color: #000000;">)</span> ;<br /> <span style="color: #0000ff;">COLOR</span> <span style="color: #000000;">{</span> || <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oGet3:<span style="color: #000000;">lChanged</span>, CLR_HRED, CLR_BLACK <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">80</span>,<span style="color: #000000;">22</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">UPDATE</span><br /><br /> @ <span style="color: #000000;">140</span>, <span style="color: #000000;">29</span> <span style="color: #0000ff;">BTNBMP</span> oBtn <span style="color: #0000ff;">PROMPT</span> ;<br /> <span style="color: #000000;">{</span> || <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> lSave := DlgModified<span style="color: #000000;">(</span> oDlg <span style="color: #000000;">)</span>, <span style="color: #ff0000;">"SAVE"</span>, <span style="color: #ff0000;">"CLOSE"</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">80</span>,<span style="color: #000000;">40</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg FLAT <span style="color: #0000ff;">UPDATE</span> ;<br /> <span style="color: #0000ff;">COLOR</span> <span style="color: #000000;">{</span> || <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> DlgModified<span style="color: #000000;">(</span> oDlg <span style="color: #000000;">)</span>, CLR_HRED, CLR_BLACK <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> lSave, <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Save"</span> <span style="color: #000000;">)</span>, <span style="color: #000000;">)</span>, oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #00C800;">function</span> DlgModified<span style="color: #000000;">(</span> oDlg <span style="color: #000000;">)</span><br /><span style="color: #00C800;">return</span> AScan<span style="color: #000000;">(</span> oDlg:<span style="color: #000000;">aControls</span>, <span style="color: #000000;">{</span> |o| o:<span style="color: #000000;">IsKindOf</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"TGET"</span> <span style="color: #000000;">)</span> .and. o:<span style="color: #000000;">lChanged</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span> > <span style="color: #000000;">0</span></div>[/code:ehsbcqrf]
[url=https://imageshack.com/i/pnZejPXYg:ehsbcqrf][img:ehsbcqrf]https://imagizer.imageshack.com/img923/7416/ZejPXY.gif[/img:ehsbcqrf][/url:ehsbcqrf] |
check on get | [quote="nageswaragunupudi":2jf9nwnd]I tested with this program and oGet:lChanged is working well.
[code=fw:2jf9nwnd]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oDlg, oFont, oGet1, oGet2, oGet3, oBtn<br /> <span style="color: #00C800;">local</span> cVar1 := PadR<span style="color: #000000;">(</span> <span style="color: #ff0000;">"ABC"</span>, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> cVar2 := PadR<span style="color: #000000;">(</span> <span style="color: #ff0000;">"DEF"</span>, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> nVar := <span style="color: #000000;">30000</span><br /> <span style="color: #00C800;">local</span> lSave := .f.<br /><br /> SetGetColorFocus<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"Segoe UI"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-14</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">300</span>,<span style="color: #000000;">200</span> <span style="color: #0000ff;">PIXEL</span> TRUEPIXEL <span style="color: #0000ff;">TITLE</span> FWVERSION ;<br /> <span style="color: #0000ff;">FONT</span> oFont<br /><br /> @ <span style="color: #000000;">20</span>, <span style="color: #000000;">20</span> <span style="color: #0000ff;">GET</span> oGet1 <span style="color: #0000ff;">VAR</span> cVar1 <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">150</span>,<span style="color: #000000;">24</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> <span style="color: #0000ff;">VALID</span> <span style="color: #000000;">(</span> oDlg:<span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, .t. <span style="color: #000000;">)</span><br /><br /> @ <span style="color: #000000;">20</span>,<span style="color: #000000;">180</span> <span style="color: #0000ff;">SAY</span> <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oGet1:<span style="color: #000000;">lChanged</span>, <span style="color: #ff0000;">"MODIFIED"</span>, <span style="color: #ff0000;">"no change"</span> <span style="color: #000000;">)</span> ;<br /> <span style="color: #0000ff;">COLOR</span> <span style="color: #000000;">{</span> || <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oGet1:<span style="color: #000000;">lChanged</span>, CLR_HRED, CLR_BLACK <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">80</span>,<span style="color: #000000;">22</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">UPDATE</span><br /><br /> @ <span style="color: #000000;">55</span>, <span style="color: #000000;">20</span> <span style="color: #0000ff;">GET</span> oGet2 <span style="color: #0000ff;">VAR</span> cVar2 <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">150</span>,<span style="color: #000000;">24</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> <span style="color: #0000ff;">VALID</span> <span style="color: #000000;">(</span> oDlg:<span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, .t. <span style="color: #000000;">)</span><br /><br /> @ <span style="color: #000000;">55</span>,<span style="color: #000000;">180</span> <span style="color: #0000ff;">SAY</span> <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oGet2:<span style="color: #000000;">lChanged</span>, <span style="color: #ff0000;">"MODIFIED"</span>, <span style="color: #ff0000;">"no change"</span> <span style="color: #000000;">)</span> ;<br /> <span style="color: #0000ff;">COLOR</span> <span style="color: #000000;">{</span> || <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oGet2:<span style="color: #000000;">lChanged</span>, CLR_HRED, CLR_BLACK <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">80</span>,<span style="color: #000000;">22</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">UPDATE</span><br /><br /> @ <span style="color: #000000;">90</span>, <span style="color: #000000;">20</span> <span style="color: #0000ff;">GET</span> oGet3 <span style="color: #0000ff;">VAR</span> nVar <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">150</span>,<span style="color: #000000;">24</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> <span style="color: #0000ff;">VALID</span> <span style="color: #000000;">(</span> oDlg:<span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, .t. <span style="color: #000000;">)</span><br /><br /> @ <span style="color: #000000;">90</span>,<span style="color: #000000;">180</span> <span style="color: #0000ff;">SAY</span> <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oGet3:<span style="color: #000000;">lChanged</span>, <span style="color: #ff0000;">"MODIFIED"</span>, <span style="color: #ff0000;">"no change"</span> <span style="color: #000000;">)</span> ;<br /> <span style="color: #0000ff;">COLOR</span> <span style="color: #000000;">{</span> || <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oGet3:<span style="color: #000000;">lChanged</span>, CLR_HRED, CLR_BLACK <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">80</span>,<span style="color: #000000;">22</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">UPDATE</span><br /><br /> @ <span style="color: #000000;">140</span>, <span style="color: #000000;">29</span> <span style="color: #0000ff;">BTNBMP</span> oBtn <span style="color: #0000ff;">PROMPT</span> ;<br /> <span style="color: #000000;">{</span> || <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> lSave := DlgModified<span style="color: #000000;">(</span> oDlg <span style="color: #000000;">)</span>, <span style="color: #ff0000;">"SAVE"</span>, <span style="color: #ff0000;">"CLOSE"</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">80</span>,<span style="color: #000000;">40</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg FLAT <span style="color: #0000ff;">UPDATE</span> ;<br /> <span style="color: #0000ff;">COLOR</span> <span style="color: #000000;">{</span> || <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> DlgModified<span style="color: #000000;">(</span> oDlg <span style="color: #000000;">)</span>, CLR_HRED, CLR_BLACK <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> lSave, <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Save"</span> <span style="color: #000000;">)</span>, <span style="color: #000000;">)</span>, oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #00C800;">function</span> DlgModified<span style="color: #000000;">(</span> oDlg <span style="color: #000000;">)</span><br /><span style="color: #00C800;">return</span> AScan<span style="color: #000000;">(</span> oDlg:<span style="color: #000000;">aControls</span>, <span style="color: #000000;">{</span> |o| o:<span style="color: #000000;">IsKindOf</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"TGET"</span> <span style="color: #000000;">)</span> .and. o:<span style="color: #000000;">lChanged</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span> > <span style="color: #000000;">0</span></div>[/code:2jf9nwnd]
[url=https://imageshack.com/i/pnZejPXYg:2jf9nwnd][img:2jf9nwnd]https://imagizer.imageshack.com/img923/7416/ZejPXY.gif[/img:2jf9nwnd][/url:2jf9nwnd][/quote:2jf9nwnd]
Nages,
[b:2jf9nwnd]> ACTION ( If( lSave, MsgInfo( "Save" ), ), oDlg:End() )[/b:2jf9nwnd]
to not use[b:2jf9nwnd] the lsave variable[/b:2jf9nwnd] and not to change all the dialogs that I have already done for many years
it is possible to use ( oDlg:end( IDOK ) ) and ( oDlg:end( IDCANCEL ) ) ?
and use
IF oDlg:nresult == IDOK
orec:save()
ENDIF
if I have to change all the insertion dialogs to check the get controls with the lsave variable I prefer not to do it, I waste years changing everything |
check on get | Simple
[code=fw:24jjtrah]<div class="fw" id="{CB}" style="font-family: monospace;">@ r,c <span style="color: #0000ff;">BUTTON</span> .......... ;<br /><span style="color: #0000ff;">ACTION</span> <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> DlgModified<span style="color: #000000;">(</span> oDlg <span style="color: #000000;">)</span>, ID_OK, ID_CANCEL <span style="color: #000000;">)</span></div>[/code:24jjtrah] |
check on get | Dear Mr. Rao,
I have recreated the example with webview. Perhaps we could enhance it with the function
var s = SendToFWH(evt.target.id, evt.type, someData)
.then(s => {
alert(s.result);
})
We could then build a UI with the webview as a template.
Just an idea.
Kind regards,
Otto
[img:3ext3nql]https://mybergland.com/fwforum/wv_input.gif[/img:3ext3nql]
[code=fw:3ext3nql]<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> oWebView := TWebView<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><br /><br /> oWebView:<span style="color: #000000;">bOnBind</span> = <span style="color: #000000;">{</span> | cJson, nCalls | <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> cJson, nCalls <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> oWebView:<span style="color: #000000;">Bind</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"SendToFWH"</span> <span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Navigate</span><span style="color: #000000;">(</span> Html<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">Sleep</span><span style="color: #000000;">(</span> <span style="color: #000000;">200</span> <span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Run</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Destroy</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 /> <br /><span style="color: #00C800;">function</span> Html<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> cHtml<br /> cHtml := <span style="color: #ff0000;">"data:text/html,"</span> + CRLF + MemoRead<span style="color: #000000;">(</span> <span style="color: #ff0000;">".<span style="color: #000000;">\i</span>nput.html"</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span> cHtml<br /> <br /> <span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /> </div>[/code:3ext3nql]
input.htm
[code=fw:3ext3nql]<div class="fw" id="{CB}" style="font-family: monospace;"><!DOCTYPE html><br /><html lang=<span style="color: #ff0000;">"en"</span>><br /><head><br /> <meta charset=<span style="color: #ff0000;">"UTF-8"</span>><br /> <meta <span style="color: #0000ff;">name</span>=<span style="color: #ff0000;">"viewport"</span> content=<span style="color: #ff0000;">"width=device-width, initial-scale=1.0"</span>><br /> <title>Dialog Example</title><br /> <link href=<span style="color: #ff0000;">"https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css"</span> rel=<span style="color: #ff0000;">"stylesheet"</span>><br /></head><br /><body><br /> <div <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"container mt-5"</span>><br /> <h2>Example Dialog</h2><br /> <form <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"exampleForm"</span>><br /> <div <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"mb-3"</span>><br /> <label <span style="color: #00C800;">for</span>=<span style="color: #ff0000;">"input1"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"form-label"</span>>Input <span style="color: #000000;">1</span></label><br /> <input type=<span style="color: #ff0000;">"text"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"form-control"</span> <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"input1"</span> placeholder=<span style="color: #ff0000;">"Enter text"</span>><br /> </div><br /> <div <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"mb-3"</span>><br /> <label <span style="color: #00C800;">for</span>=<span style="color: #ff0000;">"input2"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"form-label"</span>>Input <span style="color: #000000;">2</span></label><br /> <input type=<span style="color: #ff0000;">"text"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"form-control"</span> <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"input2"</span> placeholder=<span style="color: #ff0000;">"Enter text"</span>><br /> </div><br /> <button type=<span style="color: #ff0000;">"button"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"btn btn-primary"</span> <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"okButton"</span>>OK</button><br /> <button type=<span style="color: #ff0000;">"button"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"btn btn-secondary"</span> <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"exitButton"</span>>Exit</button><br /> </form><br /> </div><br /><br /> <script src=<span style="color: #ff0000;">"https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js"</span>></script><br /> <script><br />document.addEventListener<span style="color: #000000;">(</span><span style="color: #ff0000;">'DOMContentLoaded'</span>, <span style="color: #000000;">(</span><span style="color: #000000;">)</span> => <span style="color: #000000;">{</span><br /> const form = document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">'exampleForm'</span><span style="color: #000000;">)</span>;<br /> const originalValues = <span style="color: #000000;">{</span><span style="color: #000000;">}</span>;<br /><br /> form.addEventListener<span style="color: #000000;">(</span><span style="color: #ff0000;">'focusin'</span>, <span style="color: #000000;">(</span>event<span style="color: #000000;">)</span> => <span style="color: #000000;">{</span><br /> const target = event.target;<br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>target.tagName === <span style="color: #ff0000;">'INPUT'</span> && !<span style="color: #000000;">(</span>target.<span style="color: #0000ff;">id</span> in originalValues<span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> originalValues<span style="color: #000000;">[</span>target.<span style="color: #0000ff;">id</span><span style="color: #000000;">]</span> = target.value;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><span style="color: #000000;">)</span>;<br /><br /> form.addEventListener<span style="color: #000000;">(</span><span style="color: #ff0000;">'input'</span>, <span style="color: #000000;">(</span>event<span style="color: #000000;">)</span> => <span style="color: #000000;">{</span><br /> const target = event.target;<br /> let changedLabel = target.nextElementSibling;<br /><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>originalValues<span style="color: #000000;">[</span>target.<span style="color: #0000ff;">id</span><span style="color: #000000;">]</span> !== target.value<span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>!changedLabel || changedLabel.className !== <span style="color: #ff0000;">'changed-label'</span><span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> changedLabel = document.createElement<span style="color: #000000;">(</span><span style="color: #ff0000;">'label'</span><span style="color: #000000;">)</span>;<br /> changedLabel.className = <span style="color: #ff0000;">'changed-label'</span>;<br /> changedLabel.innerText = <span style="color: #ff0000;">'Aendert'</span>;<br /> changedLabel.<span style="color: #0000ff;">style</span>.<span style="color: #0000ff;">color</span> = <span style="color: #ff0000;">'red'</span>;<br /> target.parentNode.insertBefore<span style="color: #000000;">(</span>changedLabel, target.nextSibling<span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span> <span style="color: #00C800;">else</span> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>changedLabel && changedLabel.className === <span style="color: #ff0000;">'changed-label'</span><span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> changedLabel.remove<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><span style="color: #000000;">)</span>;<br /><br /> <span style="color: #B900B9;">// Exit Button</span><br /> document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">'exitButton'</span><span style="color: #000000;">)</span>.addEventListener<span style="color: #000000;">(</span><span style="color: #ff0000;">'click'</span>, <span style="color: #000000;">(</span><span style="color: #000000;">)</span> => <span style="color: #000000;">{</span><br /> let hasUnsavedChanges = <span style="color: #00C800;">false</span>;<br /> <span style="color: #00C800;">for</span> <span style="color: #000000;">(</span>const <span style="color: #0000ff;">id</span> in originalValues<span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>originalValues<span style="color: #000000;">[</span><span style="color: #0000ff;">id</span><span style="color: #000000;">]</span> !== document.getElementById<span style="color: #000000;">(</span><span style="color: #0000ff;">id</span><span style="color: #000000;">)</span>.value<span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> hasUnsavedChanges = <span style="color: #00C800;">true</span>;<br /> <span style="color: #00C800;">break</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>hasUnsavedChanges<span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>confirm<span style="color: #000000;">(</span><span style="color: #ff0000;">'You have unsaved changes. Are you sure you want to exit?'</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> <span style="color: #0000ff;">window</span>.close<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span> <span style="color: #00C800;">else</span> <span style="color: #000000;">{</span><br /> <span style="color: #0000ff;">window</span>.close<span style="color: #000000;">(</span><span style="color: #000000;">)</span>; <br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><span style="color: #000000;">)</span>;<br /><br /> <span style="color: #B900B9;">// OK button</span><br /> document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">'okButton'</span><span style="color: #000000;">)</span>.addEventListener<span style="color: #000000;">(</span><span style="color: #ff0000;">'click'</span>, <span style="color: #000000;">(</span><span style="color: #000000;">)</span> => <span style="color: #000000;">{</span><br /> alert<span style="color: #000000;">(</span><span style="color: #ff0000;">'OK clicked'</span><span style="color: #000000;">)</span>;<br /> <br /> <span style="color: #000000;">}</span><span style="color: #000000;">)</span>;<br /><span style="color: #000000;">}</span><span style="color: #000000;">)</span>;<br /><br /><br /><br /><br /><br /><br /> </script><br /><br /><br /><br /><br /><br /></body><br /></html><br /> </div>[/code:3ext3nql] |
check on get | Nice |
check on get | [quote="Otto":3w1deoz3]Dear Mr. Rao,
I have recreated the example with webview. Perhaps we could enhance it with the function
var s = SendToFWH(evt.target.id, evt.type, someData)
.then(s => {
alert(s.result);
})
We could then build a UI with the webview as a template.
Just an idea.
Kind regards,
Otto
[img:3w1deoz3]https://mybergland.com/fwforum/wv_input.gif[/img:3w1deoz3]
[code=fw:3w1deoz3]<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> oWebView := TWebView<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><br /><br /> oWebView:<span style="color: #000000;">bOnBind</span> = <span style="color: #000000;">{</span> | cJson, nCalls | <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> cJson, nCalls <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> oWebView:<span style="color: #000000;">Bind</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"SendToFWH"</span> <span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Navigate</span><span style="color: #000000;">(</span> Html<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">Sleep</span><span style="color: #000000;">(</span> <span style="color: #000000;">200</span> <span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Run</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Destroy</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 /> <br /><span style="color: #00C800;">function</span> Html<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> cHtml<br /> cHtml := <span style="color: #ff0000;">"data:text/html,"</span> + CRLF + MemoRead<span style="color: #000000;">(</span> <span style="color: #ff0000;">".<span style="color: #000000;">\i</span>nput.html"</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span> cHtml<br /> <br /> <span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /> </div>[/code:3w1deoz3]
input.htm
[code=fw:3w1deoz3]<div class="fw" id="{CB}" style="font-family: monospace;"><!DOCTYPE html><br /><html lang=<span style="color: #ff0000;">"en"</span>><br /><head><br /> <meta charset=<span style="color: #ff0000;">"UTF-8"</span>><br /> <meta <span style="color: #0000ff;">name</span>=<span style="color: #ff0000;">"viewport"</span> content=<span style="color: #ff0000;">"width=device-width, initial-scale=1.0"</span>><br /> <title>Dialog Example</title><br /> <link href=<span style="color: #ff0000;">"https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css"</span> rel=<span style="color: #ff0000;">"stylesheet"</span>><br /></head><br /><body><br /> <div <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"container mt-5"</span>><br /> <h2>Example Dialog</h2><br /> <form <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"exampleForm"</span>><br /> <div <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"mb-3"</span>><br /> <label <span style="color: #00C800;">for</span>=<span style="color: #ff0000;">"input1"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"form-label"</span>>Input <span style="color: #000000;">1</span></label><br /> <input type=<span style="color: #ff0000;">"text"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"form-control"</span> <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"input1"</span> placeholder=<span style="color: #ff0000;">"Enter text"</span>><br /> </div><br /> <div <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"mb-3"</span>><br /> <label <span style="color: #00C800;">for</span>=<span style="color: #ff0000;">"input2"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"form-label"</span>>Input <span style="color: #000000;">2</span></label><br /> <input type=<span style="color: #ff0000;">"text"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"form-control"</span> <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"input2"</span> placeholder=<span style="color: #ff0000;">"Enter text"</span>><br /> </div><br /> <button type=<span style="color: #ff0000;">"button"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"btn btn-primary"</span> <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"okButton"</span>>OK</button><br /> <button type=<span style="color: #ff0000;">"button"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"btn btn-secondary"</span> <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"exitButton"</span>>Exit</button><br /> </form><br /> </div><br /><br /> <script src=<span style="color: #ff0000;">"https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js"</span>></script><br /> <script><br />document.addEventListener<span style="color: #000000;">(</span><span style="color: #ff0000;">'DOMContentLoaded'</span>, <span style="color: #000000;">(</span><span style="color: #000000;">)</span> => <span style="color: #000000;">{</span><br /> const form = document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">'exampleForm'</span><span style="color: #000000;">)</span>;<br /> const originalValues = <span style="color: #000000;">{</span><span style="color: #000000;">}</span>;<br /><br /> form.addEventListener<span style="color: #000000;">(</span><span style="color: #ff0000;">'focusin'</span>, <span style="color: #000000;">(</span>event<span style="color: #000000;">)</span> => <span style="color: #000000;">{</span><br /> const target = event.target;<br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>target.tagName === <span style="color: #ff0000;">'INPUT'</span> && !<span style="color: #000000;">(</span>target.<span style="color: #0000ff;">id</span> in originalValues<span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> originalValues<span style="color: #000000;">[</span>target.<span style="color: #0000ff;">id</span><span style="color: #000000;">]</span> = target.value;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><span style="color: #000000;">)</span>;<br /><br /> form.addEventListener<span style="color: #000000;">(</span><span style="color: #ff0000;">'input'</span>, <span style="color: #000000;">(</span>event<span style="color: #000000;">)</span> => <span style="color: #000000;">{</span><br /> const target = event.target;<br /> let changedLabel = target.nextElementSibling;<br /><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>originalValues<span style="color: #000000;">[</span>target.<span style="color: #0000ff;">id</span><span style="color: #000000;">]</span> !== target.value<span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>!changedLabel || changedLabel.className !== <span style="color: #ff0000;">'changed-label'</span><span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> changedLabel = document.createElement<span style="color: #000000;">(</span><span style="color: #ff0000;">'label'</span><span style="color: #000000;">)</span>;<br /> changedLabel.className = <span style="color: #ff0000;">'changed-label'</span>;<br /> changedLabel.innerText = <span style="color: #ff0000;">'Aendert'</span>;<br /> changedLabel.<span style="color: #0000ff;">style</span>.<span style="color: #0000ff;">color</span> = <span style="color: #ff0000;">'red'</span>;<br /> target.parentNode.insertBefore<span style="color: #000000;">(</span>changedLabel, target.nextSibling<span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span> <span style="color: #00C800;">else</span> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>changedLabel && changedLabel.className === <span style="color: #ff0000;">'changed-label'</span><span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> changedLabel.remove<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><span style="color: #000000;">)</span>;<br /><br /> <span style="color: #B900B9;">// Exit Button</span><br /> document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">'exitButton'</span><span style="color: #000000;">)</span>.addEventListener<span style="color: #000000;">(</span><span style="color: #ff0000;">'click'</span>, <span style="color: #000000;">(</span><span style="color: #000000;">)</span> => <span style="color: #000000;">{</span><br /> let hasUnsavedChanges = <span style="color: #00C800;">false</span>;<br /> <span style="color: #00C800;">for</span> <span style="color: #000000;">(</span>const <span style="color: #0000ff;">id</span> in originalValues<span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>originalValues<span style="color: #000000;">[</span><span style="color: #0000ff;">id</span><span style="color: #000000;">]</span> !== document.getElementById<span style="color: #000000;">(</span><span style="color: #0000ff;">id</span><span style="color: #000000;">)</span>.value<span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> hasUnsavedChanges = <span style="color: #00C800;">true</span>;<br /> <span style="color: #00C800;">break</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>hasUnsavedChanges<span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>confirm<span style="color: #000000;">(</span><span style="color: #ff0000;">'You have unsaved changes. Are you sure you want to exit?'</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> <span style="color: #0000ff;">window</span>.close<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span> <span style="color: #00C800;">else</span> <span style="color: #000000;">{</span><br /> <span style="color: #0000ff;">window</span>.close<span style="color: #000000;">(</span><span style="color: #000000;">)</span>; <br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><span style="color: #000000;">)</span>;<br /><br /> <span style="color: #B900B9;">// OK button</span><br /> document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">'okButton'</span><span style="color: #000000;">)</span>.addEventListener<span style="color: #000000;">(</span><span style="color: #ff0000;">'click'</span>, <span style="color: #000000;">(</span><span style="color: #000000;">)</span> => <span style="color: #000000;">{</span><br /> alert<span style="color: #000000;">(</span><span style="color: #ff0000;">'OK clicked'</span><span style="color: #000000;">)</span>;<br /> <br /> <span style="color: #000000;">}</span><span style="color: #000000;">)</span>;<br /><span style="color: #000000;">}</span><span style="color: #000000;">)</span>;<br /><br /><br /><br /><br /><br /><br /> </script><br /><br /><br /><br /><br /><br /></body><br /></html><br /> </div>[/code:3w1deoz3][/quote:3w1deoz3]
Sorry Otto What does this have to do with the request I made?
It's not related to the topic.
I didn't ask how to do it on the web |
check on tree hosted on xbrowse | Hello everyone;
I'm back after a long hiatus.
I'd like to add a checkbox as the first column on an xbrowse browsing a tree. Any sample code or recommendations?
Thank you,
Reinaldo. |
check xbrowse from array | This is a sample of Rao but I have an array with customer allready checked
Local cTAgs:="Homer; Tom; Johnny;"
I convert eit on array
Local aTags := iif(AT(';',cTAGS)!=0, HB_ATokens( cTAGS, ";"), {})
When I open the xbrowse I wish check this customers
How I can make ?
[code=fw:3b252rip]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.Ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"ord.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"xbrowse.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"hbcompat.ch"</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br />REQUEST DBFCDX<br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oDlg, oBrw, oFont<br /> <span style="color: #00C800;">Local</span> cTAgs:=<span style="color: #ff0000;">"Homer; Tom; Johnny;"</span><br /> <span style="color: #00C800;">Local</span> aTags := iif<span style="color: #000000;">(</span><span style="color: #00C800;">AT</span><span style="color: #000000;">(</span><span style="color: #ff0000;">';'</span>,cTAGS<span style="color: #000000;">)</span>!=<span style="color: #000000;">0</span>, HB_ATokens<span style="color: #000000;">(</span> cTAGS, <span style="color: #ff0000;">";"</span><span style="color: #000000;">)</span>, <span style="color: #000000;">{</span><span style="color: #000000;">}</span><span style="color: #000000;">)</span><br /><br /> XbrNumFormat<span style="color: #000000;">(</span> <span style="color: #ff0000;">'A'</span>, .t. <span style="color: #000000;">)</span><br /> xbrowser aTags<br /><br /> USE CUSTOMER <span style="color: #00C800;">NEW</span> <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">"CUST"</span> SHARED VIA <span style="color: #ff0000;">"DBFCDX"</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"TAHOMA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-14</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">700</span>,<span style="color: #000000;">400</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /> @ <span style="color: #000000;">10</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">-10</span>,<span style="color: #000000;">-10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> DATASOURCE <span style="color: #ff0000;">"CUST"</span> ;<br /> COLUMNS <span style="color: #ff0000;">"FIRST"</span>, <span style="color: #ff0000;">"CITY"</span>, <span style="color: #ff0000;">"AGE"</span>, <span style="color: #ff0000;">"SALARY"</span> ;<br /> CELL LINES NOBORDER<br /><br /> WITH OBJECT oBrw:<span style="color: #000000;">InsCol</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> :<span style="color: #000000;">bEditValue</span> := <span style="color: #000000;">{</span> || AScan<span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">aSelected</span>, oBrw:<span style="color: #000000;">BookMark</span> <span style="color: #000000;">)</span> > <span style="color: #000000;">0</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">SetCheck</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> :<span style="color: #000000;">nHeadBmpNo</span> := <span style="color: #000000;">{</span> || <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> Len<span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">aSelected</span> <span style="color: #000000;">)</span> == oBrw:<span style="color: #000000;">nLen</span>, <span style="color: #000000;">1</span>, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> END<br /><br /><br /> WITH OBJECT oBrw<br /> :<span style="color: #000000;">nMarqueeStyle</span> := MARQSTYLE_HIGHLROW<br /> :<span style="color: #000000;">lMultiSelect</span> := .f.<br /> :<span style="color: #000000;">bClrSelFocus</span> := <span style="color: #000000;">{</span> || <span style="color: #000000;">{</span> CLR_BLACK, CLR_HGRAY <span style="color: #000000;">}</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">nStretchCol</span> := <span style="color: #000000;">3</span><br /> :<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">bClrSelFocus</span> := <span style="color: #000000;">{</span> ||<span style="color: #000000;">{</span> CLR_BLACK, CLR_WHITE <span style="color: #000000;">}</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">bLClicked</span> := <span style="color: #000000;">{</span> |r,c,f,oBrw| <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">MouseColPos</span><span style="color: #000000;">(</span> c <span style="color: #000000;">)</span> == <span style="color: #000000;">1</span> , ;<br /> <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> <span style="color: #000000;">(</span> f := AScan<span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">aSelected</span>, oBrw:<span style="color: #000000;">BookMark</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> == <span style="color: #000000;">0</span>, ;<br /> AAdd<span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">aSelected</span>, oBrw:<span style="color: #000000;">BookMark</span> <span style="color: #000000;">)</span>, ;<br /> ADel<span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">aSelected</span>, f, .t. <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, <span style="color: #00C800;">nil</span> <span style="color: #000000;">)</span>, ;<br /> oBrw:<span style="color: #000000;">RefreshCurrent</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /><br /> <span style="color: #B900B9;">//</span><br /> :<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> END<br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /> xbrowser oBrw:<span style="color: #000000;">aSelected</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #000000;">(</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /> </div>[/code:3b252rip]
where I can insert checkbox with the records allready selected ? |
check xbrowse from array | any solution please ? |
check xbrowse from array | Please wait |
check xbrowse from array | I 'm thinking perhaps ...
local aselected := {}
USE CUSTOMER NEW ALIAS "CUST" SHARED VIA "DBFCDX"
Do while .not. cust->(eof())
cText := alltrim(cust->First)
IF !Empty( ascan( aTags,cText) )
aadd(aselected,cust->(recno()))
Endif
cust->(dbskip())
enddo
xbrowser aselected
and we have the numbers of record
Now How insert them on xbrowse ?
it is as we make a filter as FIRST = "Homer" .OR. FIRST = "Tom" .OR. FIRST = "Johnny" but there is a problem
this is good only for a dbf of one field but if we have First+Last it is too hard to check |
check xbrowse from array | I'm waiting for....
[img:3h3us3mn]https://s17.postimg.cc/3q8lhxupr/rao.jpg[/img:3h3us3mn] |
check xbrowse from array | Thanks for the Italian Coffee!
[code=fw:19rtebas]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br />REQUEST DBFCDX<br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> field FIRST,LAST<br /> <span style="color: #00C800;">local</span> oDlg, oFont, oBrw<br /> <span style="color: #00C800;">local</span> cSelected := <span style="color: #ff0000;">";"</span><br /><br /> <span style="color: #00C800;">if</span> File<span style="color: #000000;">(</span> <span style="color: #ff0000;">"CUSTSEL.TXT"</span> <span style="color: #000000;">)</span><br /> cSelected := MEMOREAD<span style="color: #000000;">(</span> <span style="color: #ff0000;">"CUSTSEL.TXT"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">if</span> Empty<span style="color: #000000;">(</span> cSelected <span style="color: #000000;">)</span><br /> cSelected := <span style="color: #ff0000;">";"</span><br /> <span style="color: #00C800;">endif</span><br /><br /> USE CUSTOMER <span style="color: #00C800;">NEW</span> <span style="color: #0000ff;">ALIAS</span> CUST SHARED VIA <span style="color: #ff0000;">"DBFCDX"</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"TAHOMA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-14</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">800</span>,<span style="color: #000000;">600</span> <span style="color: #0000ff;">PIXEL</span> TRUEPIXEL <span style="color: #0000ff;">FONT</span> oFont<br /><br /> @ <span style="color: #000000;">20</span>,<span style="color: #000000;">20</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">-20</span>,<span style="color: #000000;">-20</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> DATASOURCE <span style="color: #ff0000;">"CUST"</span> ;<br /> COLUMNS <span style="color: #000000;">{</span> || .F. <span style="color: #000000;">}</span>, <span style="color: #ff0000;">"FIRST"</span>, <span style="color: #ff0000;">"LAST"</span>, <span style="color: #ff0000;">"CITY"</span> ;<br /> HEADERS <span style="color: #ff0000;">""</span>, <span style="color: #ff0000;">"FirstName"</span>, <span style="color: #ff0000;">"LastName"</span>, <span style="color: #ff0000;">"City"</span> ;<br /> CELL LINES NOBORDER FOOTERS<br /><br /> WITH OBJECT oBrw<br /> WITH OBJECT oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span><br /> :<span style="color: #000000;">bEditValue</span> := < |x,o|<br /> <span style="color: #00C800;">local</span> cTag := UPPER<span style="color: #000000;">(</span> TRIM<span style="color: #000000;">(</span> FIRST <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">","</span> + UPPER<span style="color: #000000;">(</span> TRIM<span style="color: #000000;">(</span> LAST <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">";"</span><br /> <span style="color: #00C800;">local</span> lSelected := <span style="color: #ff0000;">";"</span> + cTag $ cSelected<br /> <span style="color: #00C800;">if</span> x != <span style="color: #00C800;">nil</span><br /> <span style="color: #00C800;">if</span> x<br /> <span style="color: #00C800;">if</span> !lSelected<br /> cSelected += + cTag<br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">else</span><br /> <span style="color: #00C800;">if</span> lSelected<br /> cSelected := StrTran<span style="color: #000000;">(</span> cSelected, cTag, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /> lSelected := x<br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">return</span> lSelected<br /> ><br /><br /> :<span style="color: #000000;">SetCheck</span><span style="color: #000000;">(</span> <span style="color: #00C800;">nil</span>, .t. <span style="color: #000000;">)</span><br /> :<span style="color: #000000;">bOnChange</span> := <span style="color: #000000;">{</span> |o| o:<span style="color: #000000;">RefreshFooter</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">nHeadBmpNo</span> := <span style="color: #000000;">2</span><br /> :<span style="color: #000000;">bLClickHeader</span> := <span style="color: #000000;">{</span> || cSelected := <span style="color: #ff0000;">";"</span>, oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">bFooter</span> := <span style="color: #000000;">{</span> || Str<span style="color: #000000;">(</span> OCCURS<span style="color: #000000;">(</span> <span style="color: #ff0000;">";"</span>, cSelected <span style="color: #000000;">)</span> - <span style="color: #000000;">1</span>, <span style="color: #000000;">4</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> END<br /> :<span style="color: #000000;">bKeyChar</span> := <span style="color: #000000;">{</span> |k| <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> k == VK_SPACE, <span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">oCol</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">CheckToggle</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oBrw:<span style="color: #000000;">RefreshCurrent</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">)</span>, <span style="color: #00C800;">nil</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">bLDblClick</span> := <span style="color: #000000;">{</span> || oBrw:<span style="color: #000000;">oCol</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">CheckToggle</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oBrw:<span style="color: #000000;">RefreshCurrent</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">bClrStd</span> := <span style="color: #000000;">{</span> || <span style="color: #000000;">{</span> CLR_BLACK, <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">oCol</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span>, 0x80ffff, CLR_WHITE <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span><br /> <span style="color: #B900B9;">//</span><br /> :<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> END<br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /> MEMOWRIT<span style="color: #000000;">(</span> <span style="color: #ff0000;">"CUSTSEL.TXT"</span>, cSelected <span style="color: #000000;">)</span><br /><br /> ? cSelected<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> </div>[/code:19rtebas]
1. Displays number of selected items in the footer.
2. Space key or double-click any where on the row toggles selection
3. Click on header of selection column, clears entire selection |
check xbrowse from array | I not see the footer
[img:y4ftdqti]https://s14.postimg.cc/avozqgfc1/test_check.jpg[/img:y4ftdqti]
Sorry I not understood why CUSTSEL.TXT ?
I have a only a string cTAgs:="Homer; Tom; Johnny;" |
check xbrowse from array | ok now I see the footer... |
check xbrowse from array | [size=200:6h0keeo3]thanks Mr Rao [/size:6h0keeo3]!!!!
[img:6h0keeo3]https://s18.postimg.cc/j5wr29dfd/image.jpg[/img:6h0keeo3]
it was just what I was trying to build!!! <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
checkbox | Se puede poner un checkbox dentro de una celda de wbrowse?? Utilizo wbrowse de Hernán.Gracias |
checkbox | Luis,Puedes usar dos bitmaps, con la imagen de un checkbox marcado y desmarcado, y mostrarás el que corresponda según el valor del campo lógico asociado:... BROWSE ... FIELDS If( Alias->campo, hBmpOn, hBmpOff ), ... |
checkbox and on change | REDEFINE CHECKBOX oDat[13] VAR aDat[13] ID 113 OF oPrenota;
ON CHANGE( aDat[11]:=ctod(dBassa1+cYEAR),oDat[11]:refresh(),aDat[12]:= ctod(dBassa4+cYEAR),oDat[12]:refresh())
this run ok when I click on checkbox
when I erase the click on this check I want it rechange the variables aDat[11] and aDat[12] with the initial parameter
How I can make it ? |
checkbox and on change | Hello Silvio,
the modified example : Testchck.prg uses [color=#FF0000:3bu1muny]oChk:lChecked[/color:3bu1muny]
[code=fw:3bu1muny]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #00C800;">static</span> oWnd<br /><br /><span style="color: #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> lValue := .f., oChk<br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Testing CheckBox ON CHANGE clause"</span><br /><br />@ <span style="color: #000000;">3</span>, <span style="color: #000000;">3</span> <span style="color: #0000ff;">CHECKBOX</span> oChk <span style="color: #0000ff;">VAR</span> lValue <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"&ClickMe"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">100</span>, <span style="color: #000000;">20</span> <span style="color: #0000ff;">OF</span> oWnd ;<br /><span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CHANGE</span> IIF<span style="color: #000000;">(</span> oChk:<span style="color: #000000;">lChecked</span> = .T., ;<br /> oChk:<span style="color: #000000;">SetText</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Check is on"</span> <span style="color: #000000;">)</span>, ;<br /> oChk:<span style="color: #000000;">SetText</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Check is off"</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #0000ff;">COLOR</span> <span style="color: #ff0000;">"W+/B"</span><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> </div>[/code:3bu1muny]
Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
checkbox and on change | danke |
checkbox and on change | Uwe the problem is on field date because it not refresh the second get
this not run not refresh the gets
REDEFINE CHECKBOX oDat[13] VAR aDat[13] ID 113 OF oPrenota;
ON CHANGE IIF( oDat[13]:lChecked = .T., ;
(aDat[11]:=ctod(dBassa1+cYEAR),;
oDat[11]:refresh(),;
aDat[12]:= ctod(dBassa4+cYEAR),;
oDat[12]:refresh()),;
(aDat[11]:=CTOD(" / / "),;
oDat[11]:refresh(),;
aDat[12]:=CTOD(" / / "),;
oDat[12]:refresh()))
--------------------------------------------------------------------------------
this run
REDEFINE CHECKBOX oDat[13] VAR aDat[13] ID 113 OF oPrenota; // intera stagione
ON CHANGE IIF( oDat[13]:lChecked = .T., ;
(aDat[11]:=ctod(dBassa1+cYEAR),;
oDat[11]:refresh(),;
aDat[12]:= ctod(dBassa4+cYEAR),;
oDat[12]:refresh()),;
(aDat[11]:=date(),;
oDat[11]:refresh(),;
aDat[12]:=date(),;
oDat[12]:refresh()))
But I want erase the date on the get aDat[11] and aDat[12]
I not remember but someone ask somethigs of it to erase space date ... |
checkbox and on change | Hello Silvio,
Maybe something wrong with Your Date-define ( SET DATE .... ).
I tested this and it works :
[img:3c32pu2l]http://www.pflegeplus.com/pictures/check0.jpg[/img:3c32pu2l]
[code=fw:3c32pu2l]<div class="fw" id="{CB}" style="font-family: monospace;"><br />cYEAR := STR<span style="color: #000000;">(</span> <span style="color: #0000ff;">YEAR</span><span style="color: #000000;">(</span> DATE<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br />lCheck1 := .F.<br /><br /><span style="color: #B900B9;">// Inside my Test, I don't have SET DATE.</span><br /><span style="color: #B900B9;">// If SET DATE .... is missing, American Format is used for the Vars :</span><br /><br />dBassa1 := <span style="color: #ff0000;">"10/08."</span> <span style="color: #B900B9;">// returns => 08. of October in Get-Field</span><br />dBassa4 := <span style="color: #ff0000;">"10/10."</span> <span style="color: #B900B9;">// returns => 10. of October in Get-Field</span><br /><br />dBassa4 := <span style="color: #ff0000;">"20/10."</span> <span style="color: #B900B9;">// returns => empty date ( error )</span><br /><br />*Uwe the problem is <span style="color: #0000ff;">on</span> field date because it not <span style="color: #0000ff;">refresh</span> the second <span style="color: #0000ff;">get</span> <br />*this not run not <span style="color: #0000ff;">refresh</span> the gets<br /><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">CHECKBOX</span> oCheck <span style="color: #0000ff;">VAR</span> lCheck1 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">500</span> <span style="color: #0000ff;">OF</span> oDlg3 ; <br /><span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CHANGE</span> <span style="color: #000000;">(</span> IIF<span style="color: #000000;">(</span> oCheck:<span style="color: #000000;">lChecked</span> = .T., ;<br /> <span style="color: #000000;">(</span> aDat11 :=ctod<span style="color: #000000;">(</span>dBassa1+cYEAR<span style="color: #000000;">)</span>,;<br /> aDat12 := ctod<span style="color: #000000;">(</span>dBassa4+cYEAR<span style="color: #000000;">)</span> <span style="color: #000000;">)</span>,;<br /> <span style="color: #000000;">(</span> aDat11 :=CTOD<span style="color: #000000;">(</span><span style="color: #ff0000;">" / / "</span><span style="color: #000000;">)</span>, ;<br /> aDat12 :=CTOD<span style="color: #000000;">(</span><span style="color: #ff0000;">" / / "</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, ;<br /> oDat11:<span style="color: #0000ff;">refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oDat12:<span style="color: #0000ff;">refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">GET</span> oDAT11 <span style="color: #0000ff;">VAR</span> aDAT11 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">510</span> <span style="color: #0000ff;">OF</span> oDlg3 <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"##.##.####"</span> <span style="color: #0000ff;">UPDATE</span><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">GET</span> oDAT12 <span style="color: #0000ff;">VAR</span> aDAT12 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">520</span> <span style="color: #0000ff;">OF</span> oDlg3 <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"##.##.####"</span> <span style="color: #0000ff;">UPDATE</span><br /> </div>[/code:3c32pu2l]
Regards
uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
checkbox and on change | uwe
i USE
REDEFINE DTPICKER oDat[11] VAR aDat[11] ID 111 OF oPrenota UPDATE ON CHANGE (oDat[11]:Refresh(),oSay2:refresh())
REDEFINE DTPICKER oDat[12] VAR aDat[12] ID 112 OF oPrenota UPDATE ON CHANGE (oDat[12]:Refresh(),oSay2:refresh())
REDEFINE CHECKBOX oDat[13] VAR aDat[13] ID 113 OF oPrenota; // intera stagione
ON CHANGE IIF( oDat[13]:lChecked = .T., ;
(aDat[11]:=ctod(dBassa1+cYEAR),;
oDat[11]:refresh(),;
aDat[12]:= ctod(dBassa4+cYEAR),;
oDat[12]:refresh()),;
(aDat[11]:=ctod(" / / "),;
oDat[11]:refresh(),;
aDat[12]:=ctod(" / / "),;
oDat[12]:refresh()))
AND NOT RUN OK |
checkbox and on change | Silvio,
I tested with datapicker. It seems, the fields don't display empty dates.
I found another solution, to work with Your checkbox :
You need 2 extra SAY's, to display the values from the Datapicker and empty Dates from the checkbox.
[img:viulx0dr]http://www.pflegeplus.com/pictures/picker1.jpg[/img:viulx0dr]
[img:viulx0dr]http://www.pflegeplus.com/pictures/picker2.jpg[/img:viulx0dr]
[code=fw:viulx0dr]<div class="fw" id="{CB}" style="font-family: monospace;"><br />Set Date British<br />Set Century <span style="color: #0000ff;">on</span><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"Main"</span><br /><br />aVAR<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> := CTOD<span style="color: #000000;">(</span><span style="color: #ff0000;">"10.08.2009"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// ctod(dBassa1+cYEAR)</span><br />dSay1 := CTOD<span style="color: #000000;">(</span><span style="color: #ff0000;">"10.08.2009"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// ctod(dBassa1+cYEAR)</span><br /><span style="color: #0000ff;">REDEFINE</span> DTPicker aGet<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> aVAR<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">110</span> <span style="color: #0000ff;">UPDATE</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /><span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CHANGE</span> <span style="color: #000000;">(</span> dSAY1 := aVAR<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span>, oSAY1:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, aCheck := .T., oCheck:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">SAY</span> oSay1 <span style="color: #0000ff;">VAR</span> dSAY1 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">115</span> <span style="color: #0000ff;">UPDATE</span> <span style="color: #0000ff;">OF</span> oDlg<br /> <br />aVAR<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> := CTOD<span style="color: #000000;">(</span><span style="color: #ff0000;">"08.07.2009"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// ctod(dBassa4+cYEAR)</span><br />dSay2 := CTOD<span style="color: #000000;">(</span><span style="color: #ff0000;">"08.07.2009"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// ctod(dBassa4+cYEAR)</span><br /><span style="color: #0000ff;">REDEFINE</span> DTPicker aGet<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> aVAR<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">120</span> <span style="color: #0000ff;">UPDATE</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /><span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CHANGE</span> <span style="color: #000000;">(</span> dSAY2 := aVAR<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span>, oSAY2:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">SAY</span> oSay2 <span style="color: #0000ff;">VAR</span> dSAY2 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">125</span> <span style="color: #0000ff;">UPDATE</span> <span style="color: #0000ff;">OF</span> oDlg<br /><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">CHECKBOX</span> oCheck <span style="color: #0000ff;">VAR</span> aCheck <span style="color: #0000ff;">ID</span> <span style="color: #000000;">130</span> <span style="color: #0000ff;">OF</span> oDlg ; <br /><span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CHANGE</span> <span style="color: #000000;">(</span> IIF<span style="color: #000000;">(</span> oCheck:<span style="color: #000000;">lChecked</span> = .T., ;<br /> <span style="color: #000000;">(</span> dSAY1 := aVAR<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span>, ;<br /> dSAY2 := aVAR<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span>, ;<br /> <span style="color: #000000;">(</span> dSAY1 :=ctod<span style="color: #000000;">(</span><span style="color: #ff0000;">" / / "</span><span style="color: #000000;">)</span>, ;<br /> dSAY2 :=ctod<span style="color: #000000;">(</span><span style="color: #ff0000;">" / / "</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, ;<br /> oSAY1:<span style="color: #0000ff;">refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oSAY2:<span style="color: #0000ff;">refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <br /> </div>[/code:viulx0dr]
Best Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
checkbox and on change | we why not we ask to Antonio ? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.