NageswaraRao,
>If I understood you correctly, here is the solution:
I found the same solution late last night.
>I do not like to enter into a discussion whether the present Fivewin style is logical or not.
I did not mean to imply that Fivewin's style was wrong. I was just trying to separate the logic from the current FW syntax so I could better understand the preprocessor and also why I couldn't write command syntax that seemed logical to me.
>I am used to writing my code the way Fivewin expects me to write and it does not really bother me.
The problem for me has been remembering the different syntaxes. The rules are not documented anywhere that I am aware of. I would have never guessed that the PROMPT clause was optional when you specified a prompt value, but only sometimes.
I have now come to these conclusions regarding rules for the use of the @ nRow, nCol button syntax:
1) If you wish to use any clause (including PROMPT), then you MUST also use the object name.
2) The PROMPT clause is optional UNLESS you use the object name, then it is required.
3) For all other clauses with an associated value, the clause is required. The PROMPT clause is the only exception and only when there is no object name specified.
Do I have this right?
I'll probably still forget this 6 months from now, so I am going to have to put this in my notes.
To repeat, my original problem is writing debugging code using a button. If I do:
@ 1,10 button oBtn action msgInfo()
Then I must also define the local oBtn, and I must remember to remove both when done debugging.
One solution might be to create a new #xcommand that handles this syntax:
@ 1,10 xbutton action msgInfo()
and preprocesses it using the proper syntax to the standard TButton class. Then I would not have to declare the local.
>I took this as an opportunity to improve my skills of drafting command translates.
That is why I started this thread. I know very little about the preprocessor commands and I would like to understand them better.
I was also hoping that the standard FW xcommand translate could be modified to handle both traditional FW syntax and my desired syntax, but it seems this is not possible.
It does seem that rules like this would have been simpler to remember:
1) The object name is optional
2) All clauses are optional.
3) If there is a clause value, the clause name is required.
I just noticed that other xcommands are different:
xcommand @ <nRow>, <nCol> CHECKBOX [ <oCbx> VAR ] <lVar> ;
[ PROMPT <cCaption> ] ;
In this case it seems that the PROMPT command is always required when a prompt value is specified. So we really need different sets of rules for each command.
Thanks for your input, NageswaraRao.
Regards,
James