PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD18] Still going wrong
[WD18] Still going wrong
Débuté par Ola, 20 avr. 2014 22:02 - 9 réponses
Posté le 20 avril 2014 - 22:02
Hi All

One of the biggest continuous annoyances I am running every day into with WD is the miserable copying of program code. The tab settings of copied code is lost when pasting. And the bigger the program block, the bigger the tab mess after copying. Even a simple copying process of just a few lines requires many tab correction operations to make the code look "right". A lot of unnecessary extra work, which definitely does not make WD "10 times faster"...

I wonder whether this has been corrected in WD19?

Best regards
Ola
Posté le 21 avril 2014 - 00:17
Hello Ola

This does not happen for me, although there are some minor issues with lining up code that seem to be font driven.

The problem for you could be that you have the "Indent" option ticked in the Display > Edit options for code. I run with this unticked and a tab width of 2 and have no problems.

Regards
Al
Posté le 21 avril 2014 - 09:06
Hi Ola,

no problems at all here as well! Tabs (= indents) and formatting are preserved. Never ever had any problems with that. I assume you installed a custom 'copy manager' program that destroys the formatting? Look into the settings of that copy manager or, if there are no settings, just uninstall it.
Posté le 21 avril 2014 - 13:11
hmmm... I have in several projects the same problem

But if I copy/paste much code, I deactivate in the "code edit options" -> "code" pane -> Intend (pasted code is edited and intend to fit layout), paste my code, then I reactivate the option.

yours
Alexander Predl
Posté le 21 avril 2014 - 14:05
Hi

I do not have the problem on copy and paste, probably because (if I remember correctly) I have the option to automatically adjust the tabs when pasting checked...

However, if/when at some point the tabs are incorrect, for ANY reason, a simple CTRL+R followed by enter is all I need to reformat the whole current code.

Best regards
Posté le 22 avril 2014 - 10:53
Hi All,

Many thanks for the replies.

@Al, you hit the nail on the head.
@Alexander, you are also on the right track.
Main menu -> Tools -> Options -> Options of the code editor -> Automatic actions for code paste -> "Indent (Pasted code is edited and indented to fit layout)" is the correct setting place for this, but -- maybe not very surprisingly in the case of Windev -- this setting actually executes the reverse of what is promises, i.e., it must NOT be crossed in order to get some sensible copying results!
Maybe this bug was one of the 1998 (give or take a few) new bugs introduced with version 18 or 17 (which I never used), because I do not remember having had this problem, at least not as bad, in version 16.

@Fabrice
Control-R is supposed to fix the indenting, but actually it will mess it up if the code you are working on has one-liner IF structures that do not end with an "END" statement.

@Guenter
No copy manager installed in my system.

best regards
Ola
Posté le 22 avril 2014 - 12:52
Hi Ola

Quote
Ola



@Fabrice

Control-R is supposed to fix the indenting, but actually it will mess it up if the code you are working on has one-liner IF structures that do not end with an "END" statement.

I do not have this problem either because using this kind of IF is a VERY bad idea, as it's nearly impossible to see what's going on in the debugger on a line such as the one you are describing.

So ALL of my IF statement are multiline, and ALL of them have an END statement... And I strongly advise that you do the same :-)

Best regards
Posté le 22 avril 2014 - 16:58
Hi Fabrice,

I couldn't agree more, could I?:-)
And I think that the syntax checker should actually enforce the using of END.

I was actually astonished to see this kind of syntax is possible in WD.

In Clarion they had a clever trick: you could use a period instead of "END", so ending an IF structure was as simple as ending a normal sentence, regardless whether it was a one- or many-liner.

Best regards
Ola
Posté le 22 avril 2014 - 19:56
Hi Ola

it is a holdover from a loooooooong time ago, and is still here (AFAIK) only because pcsoft is making a point of keeping old code usable... But it should definitely get a "good practices" warning in the compiler :-)

Best regards
Posté le 23 avril 2014 - 07:45
Hi Fabrice, I'm used to writing single-line IF-THEN-ELSE statements from all MS-Basics (QBasic, VB, etc) and imho it makes my code more readable. Maybe only for me. But it is standard for most BASCs I do know and these are quite a few. It saves me from a dozen ENDs and figuring out which IF belongs to which END. The new collapsing feature for code inside an IF-THEN-ELSE-END structure saves me from counting the ENDs or going up with the cursor to look which IF aligns with a certain END - but only from v18 up. Worse, if code of a loop is longer than screen size one's losing the whole picture. Note that you can add several statements in a single-line IF-THEN-ELSE command line and separate them using semicolons in WINDEV. If I really would want to use the debugger on those statements, it's a nobrainer to convert them to debuggable structures.
[attachment 890 Ashampoo_Snap_2014.04.23_07h40m44s_001_.png]