Esempio n. 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( "" );
}
Esempio n. 2
0
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() );
}
Esempio n. 3
0
File: Entry.cpp Progetto: 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() );
}