本文整理汇总了C++中CConsoleBase::SetCursorHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ CConsoleBase::SetCursorHeight方法的具体用法?C++ CConsoleBase::SetCursorHeight怎么用?C++ CConsoleBase::SetCursorHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConsoleBase
的用法示例。
在下文中一共展示了CConsoleBase::SetCursorHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitConsoleL
LOCAL_C void InitConsoleL()
{
// create a full screen console object
CConsoleBase* console;
console = Console::NewL(KTxtTitle, TSize(KConsFullScreen,KConsFullScreen));
CleanupStack::PushL(console);
//Gets the size of the console
TSize screenSize = console->ScreenSize();
test.Printf(_L("Screen size %d %d\r\n"),screenSize.iWidth,screenSize.iHeight);
// Gets the cursor's x-position
TInt x = console->WhereX();
// Gets the cursor's y-position
TInt y = console->WhereY();
test_Equal(x, 0);
test_Equal(y, 0);
test.Printf(_L("**1** Cursor positions x: %d y: %d\r\n"),x, y);
// Sets the cursor's x-position
for(TInt i=0; i<4; i++)
{
console->SetPos(screenSize.iWidth + i);
x = console->WhereX();
test_Equal(x, screenSize.iWidth -3);
}
test.Printf(_L("**2** Cursor positions x: %d y: %d\r\n"),x, y);
// Clears the console and set cursor to position 0,0
console->ClearScreen();
test_Equal(console->WhereX(), 0);
test_Equal(console->WhereY(), 0);
// Sets the cursor's x-position and y-position
for(TInt j=0; j<4; j++)
{
console->SetPos(screenSize.iWidth - j, screenSize.iHeight - j);
x = console->WhereX();
y = console->WhereY();
test_Equal(x, screenSize.iWidth -3);
test_Equal(y, screenSize.iHeight -3);
}
test.Printf(_L("**3** Cursor positions x: %d y: %d\r\n"),x, y);
console->SetPos(0,0);
x = console->WhereX();
y = console->WhereY();
test_Equal(x, 0);
test_Equal(y, 0);
test.Printf(_L("**4** Cursor positions x: %d y: %d\r\n"),x, y);
console->SetPos(screenSize.iWidth/2,screenSize.iHeight/2);
x = console->WhereX();
y = console->WhereY();
test.Printf(_L("**5** Cursor positions x: %d y: %d\r\n"),x, y);
// Sets the percentage height of the cursor
console->SetCursorHeight(50);
// Gets the current cursor position relative to the console window
TPoint cursorPos = console->CursorPos();
test.Printf(_L("CursorPos iX: %d iY: %d\r\n"),cursorPos.iX, cursorPos.iY);
// Puts the cursor at the specified position relative
// to the current cursor position
TPoint relPos;
relPos.iX = screenSize.iWidth/4;
relPos.iY = screenSize.iHeight/4;
console->SetCursorPosRel(relPos);
cursorPos = console->CursorPos();
test.Printf(_L("CursorPosRel iX: %d iY: %d\r\n"),cursorPos.iX, cursorPos.iY);
// Puts the cursor at the absolute position in the window
cursorPos.iX = screenSize.iWidth/6;
cursorPos.iY = screenSize.iHeight/6;
console->SetCursorPosAbs(cursorPos);
cursorPos = console->CursorPos();
test.Printf(_L("CursorPosAbs iX: %d iY: %d\r\n"),cursorPos.iX, cursorPos.iY);
// Sets a new console title
console->SetTitle(KTxtNewTitle);
// Writes the content of the specified descriptor to the console window
console->Write(KTxtWrite);
cursorPos.iX = cursorPos.iX + 6;
console->SetCursorPosAbs(cursorPos);
// Clears the console from the current cursor position to the end of the line
console->ClearToEndOfLine();
// Clears the console and set cursor to position 0,0
console->ClearScreen();
TUint keyModifiers = console->KeyModifiers();
test.Printf(_L("keyModifiers %d"),keyModifiers);
TKeyCode keyCode = console->KeyCode();
ReadConsole(console);
SimulateKeyPress(EStdKeyEnter);
keyCode = console->Getch();
//.........这里部分代码省略.........
示例2: ProcessMainL
/**
* Subroutine performing pre-processing tasks for testexecute execution
* Also, responsible for triggering the state machine through instance of ScriptMaster
* @param aScheduler - Instance of ActiveScheduler created through MainL()
* @param aSysDrive - Default system drive letter to be used for all script parsing
*/
LOCAL_C void ProcessMainL(CActiveScheduler* aScheduler, const TDriveName aSysDrive)
{
TDriveName defaultSysDrive(aSysDrive);
TDriveName testSysDrive(KTEFLegacySysDrive);
TInt waitForLoggingTime = 0;
TBuf<KMaxTestExecuteNameLength> htmlLogPath;
// Create a object of the Parser for TestExecute.ini
CTestExecuteIniData* parseTestExecuteIni = NULL;
TRAPD(err, parseTestExecuteIni = CTestExecuteIniData::NewL(defaultSysDrive));
if (err == KErrNone)
{
CleanupStack::PushL(parseTestExecuteIni);
// Extract all the key values within the object
parseTestExecuteIni->ExtractValuesFromIni();
}
// Read and parse the command line for the flags
// -d -slf -help and -v
TBuf<KMaxTestExecuteCommandLength> commandLine;
TDesC* selTestCfgFileData = NULL; //the pointer to the data of in the .tcs file
ReadCommandLineL(commandLine);
// Make lower case because we parse it for flags and search for ".script"
commandLine.LowerCase();
TBool separateLogFiles(EFalse); // -slf
TBool justInTime(EFalse); // -d
TBool graphicalWindowServer(EFalse); // -gws
TBool helpRequest(EFalse); // -help
TBool versionRequest(EFalse); // -v
TBool includeSelectiveCases(EFalse); // -tci
TBool excludeSelectiveCases(EFalse); // -tcx
TBool pipe(EFalse) ;
// Set up the bools from the command line
ParseCommandLine(commandLine,separateLogFiles,justInTime,graphicalWindowServer,includeSelectiveCases, excludeSelectiveCases,pipe, helpRequest,versionRequest,*parseTestExecuteIni,err);
// If -d then set Just In Time debugging. Panicks break into debug on emulator
(justInTime) ? (User::SetJustInTime(ETrue)) : (User::SetJustInTime(EFalse));
// Hooks for creating the Graphical Window server
#ifdef GWS
#endif
// Create a console
_LIT(KMessage,"TestExecute Script Engine");
CConsoleBase* console = Console::NewL(KMessage,TSize(KConsFullScreen,KConsFullScreen));
CleanupStack::PushL(console);
console->SetCursorHeight(0);
RConsoleLogger consoleLogger(*console);
CScriptControl::iRunScriptFailCount=0;
// A lex for getting the first command line argument, ie the script file path
TLex lex(commandLine);
TPtrC scriptFilePath(lex.NextToken());
TInt ret = KErrNotFound;
if (scriptFilePath.CompareF(KNull) != 0)
{
_LIT(KTEFSwitchPrefix, "-");
if(scriptFilePath.Mid(0,1).CompareF(KTEFSwitchPrefix) == 0)
{
// If the first command line argument is not the script file path but a optional switches
// Then set the script file path for the execution to be 'blank'
scriptFilePath.Set(KNull);
}
else
{
TBuf<KBuffSize> tempScriptPath(scriptFilePath);
// Check whether script name is provided along with folder path in the command line
// If not, take the path from testexecute.ini & name from the command line
ret=scriptFilePath.FindC(KTEFColon);
if(ret==KErrNotFound)
{
if (parseTestExecuteIni != NULL)
{
TBuf<KMaxTestExecuteNameLength> tempBuffer;
parseTestExecuteIni->GetKeyValueFromIni(KTEFDefaultScriptPath, tempBuffer);
// If the relative script file path does not refer to the root,
// we will look for DefaultScriptDir entry in testexecute.ini
// If available prepend it to the relative path
// else if the relative path refers to root,
// then set the default system drive, i.e. c:
// else leaving it as it is (considering invalid path)
if (scriptFilePath.Left(1).CompareF(KTEFSlash) != 0 &&
tempBuffer.Length() > 0)
scriptFilePath.Set(tempBuffer);
else if (scriptFilePath.Left(1).CompareF(KTEFSlash) == 0)
scriptFilePath.Set(defaultSysDrive);
else
scriptFilePath.Set(KNull);
}
else
{
// If the file path is not provided in command line as well as in testexecute.ini
//.........这里部分代码省略.........