예제 #1
0
void GuessMyNumber::OnGuessClick() {
	// Validate number.
	unsigned int buf_number( 0 );

	std::stringstream sstr( static_cast<std::string>( m_number_entry->GetText() ) );
	sstr >> buf_number;

	if( buf_number < 1 || buf_number > 100 ) {
		m_hint_label->SetText( "Enter a number from 1 to 100." );
		return;
	}

	++m_tries;
	UpdateUI();

	unsigned char number( static_cast<unsigned char>( buf_number ) );
	if( number < m_number ) {
		m_hint_label->SetText( "My number is higher." );
	}
	else if( number > m_number ) {
		m_hint_label->SetText( "My number is lower." );
	}
	else {
		m_hint_label->SetText( "Correct!" );
		m_guess_button->Show( false );
	}

	m_number_entry->SetText( "" );
}
예제 #2
0
파일: Entry.cpp 프로젝트: Cruel/SFGUI
void EntryExample::ButtonClick() {
    // When the button is clicked set the contents of the label
    // to the contents of the entry widget.
    m_label->SetText( m_entry->GetText() );
}
예제 #3
0
파일: Entry.cpp 프로젝트: Zykr/SFGUI
void ButtonClick() {
	// When the button is clicked set the contents of the label
	// to the contents of the entry widget.
	label->SetText( entry->GetText() );
}