Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TopWindow&PopUp, TrayIcon » BUG? EditInt / PromptOK not functioning as thought?
BUG? EditInt / PromptOK not functioning as thought? [message #48076] Sun, 14 May 2017 20:29 Go to previous message
ptkacz is currently offline  ptkacz
Messages: 89
Registered: March 2017
Member
When an EditInt field is populated with a valid value (i.e. 0..999; 4 allowable digits), the PromptOK box displays as expected upon the clicking of a submit button.

When an EditInt field is populated with a number greater than the max allowable value, the field turns red, and the incorrect PromptOK dialog box displays. In order to get the PromptOK window to display with the correct message, the close window button needs to be selected.

What's going on here? Code listed below.


Peter


Bug1.lay
LAYOUT(Bug1Layout, 84, 60)
	ITEM(EditInt, editField, Max(999).Min(0).MaxChars(4).LeftPosZ(8, 64).TopPosZ(8, 19))
	ITEM(Button, submitButton, SetLabel(t_("submit")).LeftPosZ(8, 64).TopPosZ(36, 15))
END_LAYOUT



Bug1.h
#ifndef _Bug1_Bug1_h
#define _Bug1_Bug1_h

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

#define LAYOUTFILE <Bug1/Bug1.lay>
#include <CtrlCore/lay.h>

class Bug1 : public WithBug1Layout<TopWindow> {
public:
	typedef Bug1 CLASSNAME;
	Bug1();
	void buttonClicked(void);
};
#endif



main.cpp
#include "Bug1.h"

Bug1::Bug1()
{
	CtrlLayout(*this, "Bug1 Window");
	
    submitButton << THISBACK(buttonClicked);
}


void Bug1::buttonClicked(void) {
	int value = editField;
	
	if( value > 999 ) {
		PromptOK("Number too big!");
		return;
	}
	else
		PromptOK("Number accepted!");
}


GUI_APP_MAIN
{
	Bug1().Run();
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Bug: TopWindow::IsFullscreen is not working under GTK
Next Topic: How often is Update called? Is there a similiar frequently called method?
Goto Forum:
  


Current Time: Tue Jun 25 19:35:55 CEST 2024

Total time taken to generate the page: 0.02798 seconds