#include <CtrlLib/CtrlLib.h> using namespace Upp; struct U64Convert : Convert { Value Format(const Value& q) const override { return FormatUInt64((uint64)(int64)q); } Value Scan(const Value& text) const override { uint64 x; bool overflow = false; String s = ~text; if(ScanUint<char, byte, uint64, 10>(x, s)) return (int64)x; return ErrorValue("Invalid number"); } int Filter(int chr) const override { return CharFilterDigit(chr); } }; GUI_APP_MAIN { TopWindow win; EditField h; h.SetConvert(Single<U64Convert>()); win << h.HSizePos().TopPos(0); uint64 x = UINT64_MAX; h <<= (int64)x; win.Run(); x = (int64)~h; DDUMP(x); }
Report message to a moderator