|
Post by Admin on Aug 4, 2021 10:45:30 GMT
|
|
renez
New Member
Posts: 14
|
Post by renez on Aug 4, 2021 11:07:05 GMT
Hi Dimitris,
Works fine now. Thanks. It will simplify my coding.
Regards, René
|
|
renez
New Member
Posts: 14
|
Post by renez on Aug 19, 2021 10:03:37 GMT
Hi Dimitris,
Found a minor issue with Gui4Cli.exe. Following situation. I am editing multiple files (one main .gui and several .gc files) in SciEd. Only the main .gui has a G4C header. The others .gc files do not have a G4C header.
Than (by mistake) I select in SciEd the 'Save and Run as gui' for e.g. 'print.gc'. On the Gui4cli console, the correct message appears regarding the missing G4C header. Good.
But from that moment on, I can not save any further changes made in that specific 'print.gc' file in SciEd.
The error messages are: *ERROR* [11:40:30] File: "D:/Programming/Gui4Cli/gui/sciED/gui/sciUtil.gc" Line: 489 Encoding error, Did not find required G4C header *ERROR* [11:40:30] File: "D:/Programming/Gui4Cli/gui/sciED/gui/sciUtil.gc" Line: 489 Item was not found, Gui "D:/Programming/Gui4Cli/myPrograms/zBeaFibu/print.gc"
* System Error: The process cannot access the file because it is being used by another process. -> File D:/Programming/Gui4Cli/myPrograms/zBeaFibu/print.gc *ERROR* [11:41:04] File: "D:/Programming/Gui4Cli/gui/sciED/sciED.gui" Line: 243 Execution aborted, $$RETCODE = 15
I checked which process has a lock on file 'print.gc' and as expected it's Gui4cli.exe itself. Seems Gui4cli.exe does not free the handler in such cases.
The only solution I found so far is to quit Gui4cli.exe (and in this case SciEd too).
Regards, René
|
|
renez
New Member
Posts: 14
|
Post by renez on Aug 19, 2021 16:43:08 GMT
Hi All,
Could somebody please verify if it's just my system, my coding or a bug? On my system it never deletes the second entry here ie. 2011
Thanks a lot. René --------------
G4C lvDeleteIssue
xOnLoad use lv #this idLv from=2010; to=2020; delOlder=2015 for n $from $to lv add $n endfor say "What's in:" gosub #this listLv lv goto first say "Delete if older than: $delOlder" while $$lv.valid = 1 if $%year < $delOlder; lv delete current; endif lv goto next endwhile say "What's left (is the year $($from + 1) gone?:" gosub #this listLv guiquit #this
xRoutine listLv lv goto first while $$lv.valid = 1 say $%year lv goto next endwhile
xListview 0 0 0 0 "" "" lvVar id idLv attr lvcolum "#year/type/number"
|
|
|
Post by Admin on Aug 19, 2021 19:24:33 GMT
Hi Rene,
Yes... I was forgetting to CloseHandle() - fixed it.
Thanks! Dimitris
|
|
|
Post by Admin on Aug 19, 2021 20:12:41 GMT
Hi Rene,
If you delete a record, the current record changes, so if you "lv go next" you'll skip a record. The 2011 remains because it's the 2nd record.
It's hard to describe so I added some "say" statements so you can see what's happening
lv goto first say "Delete if older than: $delOlder" while $$lv.valid = 1 say "checking year $%year" if $%year < $delOlder; say " --> deleting $%year" lv delete current; say " --> new current rec = $%year" endif lv goto next endwhile
The best way to do what you want is to select all the records you want to delete and then, in the end, "lv delete selected"
Dimitris
|
|
renez
New Member
Posts: 14
|
Post by renez on Aug 19, 2021 20:33:07 GMT
Hi Dimitris,
Thanks a lot for testing and your explanation. I should have consulted the manual first because it's well documented: Listview DELETE: 'Will delete the current line from the current listview. The previous line will become the current line'. Now it's logical to me. Sorry for disturbing and thanks for the good coding tip.
René
|
|
fer
New Member
Posts: 22
|
Post by fer on Aug 21, 2021 14:12:08 GMT
Hoi René,
Besides Dimitris' solution a small change of your code solves your problem
----original code------ while $$lv.valid = 1 if $%year < $delOlder; lv delete current; endif lv goto next endwhile
----new code----- while $$lv.valid = 1 if $%year < $delOlder lv delete current else lv goto next endif endwhile
Nice to see another ancient G4C user, it's still my favourite programming language.
fer
|
|
renez
New Member
Posts: 14
|
Post by renez on Aug 21, 2021 15:40:11 GMT
Thanks Fer,
I use now this implementation too in cases where the user might click in the listview during my walkthru. I know I can disable the listview (mostly I do that), but in certain cases the user is allowed to intervene. In other cases (hidden lv's) I use the 'select' first and delete afterwards solution from Dimitris, could be even faster (but not verified).
René
|
|
xer0x
New Member
Posts: 1
|
Post by xer0x on Sept 7, 2021 17:59:41 GMT
Hello, stumbled upon it suddenly, is totally new for me just for curiosity, is there source code for it?
|
|
|
Post by Admin on Sept 8, 2021 5:23:26 GMT
Hi,
I was going to upload it (I had in the past), but it's a personal program so it's kind of a mess.
It's written in C. If you are interested, I'll upload it.
Dimitris
|
|