Hey guys! Is there any possibility of opening a procedure through a parameter received when opening my executable? in this case the parameter is coming as a string, example:
‘FormCadastroUser’
Hey guys! Is there any possibility of opening a procedure through a parameter received when opening my executable? in this case the parameter is coming as a string, example:
‘FormCadastroUser’
sure, check
COMMAND (return command line)
in the docs
CommandString = COMMAND('') !Get all command parameters
CommandItself = COMMAND('0') !Get the command itself
SecondParm = COMMAND('2') !Get second parameter from command line
As an example Mark’s LibMaker allows calling with some parameters on the Command Line and then calls certain Routines or Procedures. Excerpt with some clutter removed…
PreAccept:CommandLine ROUTINE
FileName = CLIP(LEFT(COMMAND('READ'))) !Call READ=FileName.DLL
IF LEN(CLIP(FileName))
DO FileAdded
ELSE POST(Event:Accepted,?AddFile)
END
IF COMMAND('WRITE') AND RECORDS(ExportQ) !Call READ=FileName.DLL WRITE=FileName.LIB
FileName = COMMAND('WRITE')
WriteLib()
IF ~COMMAND('/CLOSE') ! assume user has automated system running and doesn't want UI
MESSAGE('[' & CLIP(FileName) &'] written','MG Library Maker', SYSTEM{PROP:Icon})
END
END
IF COMMAND('/CLOSE')
POST(EVENT:CloseWindow)
END
I’m sorry, I’m translating the language to English, maybe I wasn’t clear.
Assuming that the second parameter was the name of a clw (procedure), I would like to open the Screen / Procedure that I received from the parameter.
Just to reinforce, here we use the Clarion template for our applications.
You’re talking about opening Clarion to a procedure in a generated .clw, or a procedure inside an app?
We are trying to create a “Favorite” access, where we have several screens inside an EXE.
In the Menu (another executable), we have a list of favorable modules, each module being the RUN Menu (executable), the idea is to pass as a parameter the screen that the called executable needs to open. Example below:
ProcOpen = COMMAND(‘0’) ! Suppose you are receiving ‘CadastroUsuarios’ as a parameter
!----------------------------- In the executable I have several clw (procedures), so basically I would have to do it manually
CASE ProcOpen
OF ‘CadastroUsuarios’’
CadastroUsuarios()
OF ‘CadastroCidades’
CadastroCidades()
END
The doubt is, is there any way for me to just open a procedure without having to CASE my received parameter to know which screen to open?
**NOTE: Let the process be dynamic, without having to adjust the CASE every time you have a new screen.
Two real choices that I can think of, both use a template.
You can have a template that builds the case statement you are already using. That way you don’t have to maintain it in hand-code.
You can also build a queue of procedure names and the address of the procedure. Then execute the procedure by address. I believe there is an old Clarion Mag article that describes how to do this.
thanks I’ll see here
OK, you threw me off with the word “.clw” in your description.
Personally, I’d go with a hardcoded list of procedure names, generated by a template or hand code.
If you go the route of attempting to get a procedure by address based on a parameter, then that opens possibilities that you don’t intend, depending on your users.
“Favorites” sounds very much like Capesoft’s Tearoff template. I’ve used it, and it’s pretty neat. A little bit quirky, but it works.
See EVALUATE and BIND
Really, it seems to be the closest solution to what we need.
Thanks !