Displaying Helix Core Server forms
Helix Core Server
client commands that collect a large amount of input from the user (such
as p4 branch
, p4 change
,
p4 label
) use ASCII forms. To interact with your end
user, your client application program can display
Helix Core Server
ASCII forms such as changelists, client specification, and so on. To
display a form and collect user input, call ClientUser::Edit()
, which
puts the form into a temporary file and invokes the text editor that is
configured for the client machine.
All form-related commands accept the batch mode flags -o and -i:
- -o causes the form to be passed to
ClientUser::OutputInfo()
. - -i causes the form to be read with
ClientUser::InputData()
.
These flags allow changes to the form to occur between separate
invocations of the p4
application, rather than during
a single invocation. (For details about the -o and -i global options, see
the P4 Command Reference.)
All form-related commands can return a form descriptor. Your application
can use this descriptor to parse forms into constituent variables and to
format them from their constituent variables. The specstring
protocol variable enables this support in the server. Form descriptors
are best used with the tag
protocol variable, which causes
the form data to appear using ClientUser::OutputStat()
rather than OutputInfo()
.
Select the protocol with ClientApi::SetProtocol()
as follows:
client.SetProtocol( "specstring", "" ); client.SetProtocol( "tag", "" );
Your application can override the OutputStat()
method
in a class derived from ClientUser
. The
Helix C/C++ API
calls this derived method, passing it the output from the command.