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  |
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();
}
|
|
|
Goto Forum:
Current Time: Fri Apr 25 23:00:36 CEST 2025
Total time taken to generate the page: 0.00548 seconds
|