I need a litle help, please.
I would like include a validator in a wxTextCtrl created by wxCrafter.
Seeing validate sample i found:
Code: Select all
m_numericTextDouble = new wxTextCtrl
(
this,
wxID_ANY,
"",
wxDefaultPosition,
wxDefaultSize,
wxTE_RIGHT,
wxMakeFloatingPointValidator
(
3,
&g_data.m_doubleValue,
wxNUM_VAL_THOUSANDS_SEPARATOR |
wxNUM_VAL_NO_TRAILING_ZEROES
)
);
But I don’t know how make in wxCrafter.
I tryed this:
In the wxTextCtrl’s attributes there is a Subclass combo.
Herein, I input:
Class Name: wxTextCtrl
Include File: globalNum.h
Style: wxTE_RIGTH, wxMakeFloatingPointValidator(2, &g_valueFloat, wxNUM_VAL_THOUSANDS_SEPARATOR | wxNUM_VAL_NO_TRAILING_ZEROES )
Then, I add globalNum.h file in the project with:
Code: Select all
#include “wx/valnum.h”
// Global variable for wxMakeFloatingValidator
float g_valueFloat;
Code: Select all
/bin/sh -c '/usr/bin/make -j8 -e -f Makefile'
----------Building project:[ crafter_validate - Debug ]----------
make[1]: Entering directory '/home/marcel/dev/wxSamples/crafter_validate'
/usr/bin/g++ -c "/home/marcel/dev/wxSamples/crafter_validate/main.cpp" -g -O0 -Wall -I/home/marcel/dev/wx31/buildgtk3r/lib/wx/include/gtk3-unicode-3.1 -I/home/marcel/dev/wx31/include -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -DWXUSINGDLL -D__WXGTK__ -pthread -o ./Debug/main.cpp.o -I. -I.
/usr/bin/g++ -c "/home/marcel/dev/wxSamples/crafter_validate/wxcrafter.cpp" -g -O0 -Wall -I/home/marcel/dev/wx31/buildgtk3r/lib/wx/include/gtk3-unicode-3.1 -I/home/marcel/dev/wx31/include -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -DWXUSINGDLL -D__WXGTK__ -pthread -o ./Debug/wxcrafter.cpp.o -I. -I.
/usr/bin/g++ -c "/home/marcel/dev/wxSamples/crafter_validate/MainDialog.cpp" -g -O0 -Wall -I/home/marcel/dev/wx31/buildgtk3r/lib/wx/include/gtk3-unicode-3.1 -I/home/marcel/dev/wx31/include -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -DWXUSINGDLL -D__WXGTK__ -pthread -o ./Debug/MainDialog.cpp.o -I. -I.
/usr/bin/g++ -o ./Debug/crafter_validate @"crafter_validate.txt" -L. -L/home/marcel/dev/wx31/buildgtk3r/lib -pthread -Wl,-rpath,/home/marcel/dev/wx31/buildgtk3r/lib -lwx_gtk3u_xrc-3.1 -lwx_gtk3u_html-3.1 -lwx_gtk3u_qa-3.1 -lwx_gtk3u_adv-3.1 -lwx_gtk3u_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx_baseu-3.1
./Debug/wxcrafter.cpp.o:(.bss+0x0): multiple definition of `g_valueFloat'
./Debug/main.cpp.o:(.bss+0x0): first defined here
./Debug/MainDialog.cpp.o:(.bss+0x0): multiple definition of `g_valueFloat'
./Debug/main.cpp.o:/home/marcel/dev/wx31/include/wx/imagjpeg.h:26: first defined here
collect2: error: ld returned 1 exit status
crafter_validate.mk:76: recipe for target 'Debug/crafter_validate' failed
make[1]: *** [Debug/crafter_validate] Error 1
make[1]: Leaving directory '/home/marcel/dev/wxSamples/crafter_validate'
Makefile:4: recipe for target 'All' failed
make: *** [All] Error 2
====2 errors, 0 warnings====
Thanks.
My environment:
OS debian stretch 64bits
g++ (Debian 5.3.1-14) 5.3.1 20160409
wxWidgets 3.1.0 self compiled
CodeLite 9.1.5 binary package