当前位置: 首页>>代码示例>>C++>>正文


C++ CConsoleBase::ClearScreen方法代码示例

本文整理汇总了C++中CConsoleBase::ClearScreen方法的典型用法代码示例。如果您正苦于以下问题:C++ CConsoleBase::ClearScreen方法的具体用法?C++ CConsoleBase::ClearScreen怎么用?C++ CConsoleBase::ClearScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CConsoleBase的用法示例。


在下文中一共展示了CConsoleBase::ClearScreen方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ExecuteL

void CListCommand::ExecuteL(CConsoleBase& aConsole)
	{
	// Connect to the SCR server
	RSoftwareComponentRegistry scr;
	TInt err = scr.Connect();
	if (err != KErrNone)
		{
		aConsole.Printf(_L("\nFailed to connect to the SCR server"));
		User::Leave(err);
		}
	CleanupClosePushL(scr);

	// Create an SCR view
	RSoftwareComponentRegistryView scrView;
	scrView.OpenViewL(scr, iFilter);
	CleanupClosePushL(scrView);

	// Iterate over the matching components
	CComponentEntry* entry = CComponentEntry::NewLC();
	TBool first(ETrue);
	while (scrView.NextComponentL(*entry, iLocale))
		{
		if (first)
			{
			first = EFalse;
			}
		else
			{
			aConsole.Printf(KTxtPressToContinue);
			aConsole.Getch();
			aConsole.ClearScreen();
			}

		aConsole.Printf(_L("\n============= Component Info =============\n"));
		aConsole.Printf(_L("\nComponent ID     : %d"), entry->ComponentId());
		aConsole.Printf(_L("\nComponent name   : %S"), &entry->Name());
		aConsole.Printf(_L("\nVendor name      : %S"), &entry->Vendor());
		aConsole.Printf(_L("\nSoftware type    : %S"), &entry->SoftwareType());
		aConsole.Printf(_L("\nSCOMO state      : %S"), entry->ScomoState() == EActivated ? &KTxtActivated : &KTxtDeactivated );
		aConsole.Printf(_L("\nComponent size   : %d"), entry->ComponentSize());
		aConsole.Printf(_L("\nInstalled drives : %S"), &entry->InstalledDrives());
		aConsole.Printf(_L("\nVersion          : %S"), &entry->Version());
		aConsole.Printf(_L("\n\n=========================================\n"));
		}

	// Disconnect from the SCR server and cleanup the entry
	CleanupStack::PopAndDestroy(3, &scr);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:48,代码来源:command.cpp

示例2: SetUpTestL

void CThreadBase::SetUpTestL( const TDesC& aThreadName )
	{
	// Set's up extra resources.
	CConsoleBase* console = NULL;
	TSize size;

	// Create and name an RTest
	iTest = new(ELeave) RTest(aThreadName);
	iTest->Start(_L("Starting test"));

	// Position our console window
	size = iTest->Console()->ScreenSize();
	size.iWidth = size.iWidth - 4;
	size.iHeight = (size.iHeight / 2) - 3;

	console = Console::NewL(aThreadName, size);
	delete const_cast<RTest*>(iTest)->Console();
	
	iTest->SetConsole(console);
	console->ClearScreen();
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:21,代码来源:threadbase.cpp

示例3: 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();
  
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:t_console.cpp


注:本文中的CConsoleBase::ClearScreen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。