V - some Linux/Windows observations
Hello again,
For the record and in case it helps someone like me who's learning V some
things I've found when writing my (basic) V apps and compiling under BC5.01
and egcs 2.91.x:
1) Loading text into dialog box text input fields (see comments):
static CommandObject DefaultCmds[]=
{
{C_Frame,frStart,0,"",NoList,CA_NoSpace | CA_NoBorder,isSens,NoFrame,0,0},
{C_Label,t0Lbl,0,"Start time ",NoList,CA_None,isSens,frStart,0,0},
{C_TextIn,t0Inp,0,dlgtext.start,NoList,CA_None,isSens,frStart,t0Lbl,0},
{C_Frame,frStop,0,"",NoList,CA_NoSpace |
CA_NoBorder,isSens,NoFrame,0,frStart},
{C_Label,t1Lbl,0,"Stop time ",NoList,CA_None,isSens,frStop,0,0},
{C_TextIn,t1Inp,0,dlgtext.stop,NoList,CA_None,isSens,frStop,t1Lbl,0},
{C_Frame,frStep,0,"",NoList,CA_NoSpace |
CA_NoBorder,isSens,NoFrame,0,frStop},
{C_Label,stepLbl,0,"Initial step",NoList,CA_None,isSens,frStep,0,0},
{C_TextIn,stepInp,0,dlgtext.step,NoList,CA_None,isSens,frStep,stepLbl,0},
{C_Frame,frTol,0,"",NoList,CA_NoSpace |
CA_NoBorder,isSens,NoFrame,0,frStep},
{C_Label,tolLbl,0,"Tolerance ",NoList,CA_None,isSens,frTol,0,0},
{C_TextIn,tolInp,0,dlgtext.tol,NoList,CA_None,isSens,frTol,tolLbl,0},
{C_Frame,frR,0,"",NoList,CA_NoSpace |
CA_NoBorder,isSens,NoFrame,frStart,0},
{C_Label,rLbl,0,"Rate of increase ",NoList,CA_None,isSens,frR,0,0},
{C_TextIn,rInp,0,dlgtext.c0,NoList,CA_None,isSens,frR,rLbl,0},
{C_Frame,frN0,0,"",NoList,CA_NoSpace |
CA_NoBorder,isSens,NoFrame,frStop,frR},
{C_Label,N0Lbl,0,"Initial Population",NoList,CA_None,isSens,frN0,0,0},
{C_TextIn,N0Inp,0,dlgtext.c1,NoList,CA_None,isSens,frN0,N0Lbl,0},
{C_Button,M_OK,M_OK," OK ", NoList,
CA_DefaultButton,isSens,NoFrame,0,frTol},
{C_Button,M_Cancel,M_Cancel," Cancel ",
NoList,CA_None,isSens,NoFrame,M_OK,frTol},
{C_EndOfList,0,0,0,0,CA_None,0,0,0}
};
...other code
void ConstsDlg::SetDlgVals()
{
sprintf(dlgtext.c0,"%f",inputs->the_consts[0]);
sprintf(dlgtext.c1,"%f",inputs->the_consts[1]);
sprintf(dlgtext.start,"%f",inputs->start);
sprintf(dlgtext.stop,"%f",inputs->stop);
sprintf(dlgtext.step,"%f",inputs->step);
sprintf(dlgtext.tol,"%g",inputs->tol);
//the above is all that is required to load the text into the input
//fields in the dialog box under windows, but not under X.
//The code below (which to be fair are the proper V methods) is
//required to get the same effect (pre-loaded input into text input
//fields) under X
SetString(t0Inp,dlgtext.start);
SetString(t1Inp,dlgtext.stop);
SetString(stepInp,dlgtext.step);
SetString(tolInp,dlgtext.tol);
SetString(rInp,dlgtext.c0);
SetString(N0Inp,dlgtext.c1);
}
2. Control spacing - I know this is in the FAQ, but I had the reverse
problem, i.e. spacing was fine under windows but very off under X. Labels
were of a much smaller height than the text input fields under X and so
didn't line up horizonatlly with the input fields for which they were
labels. Following the FAQ, frames sorted it out (see CommandObject above).
3. Anyone thought about using autoconf/automake for V? I can get my little
apps to use it (but in a non-portable way :( I specify the v library
directly rather then get it to check that the library and headers are
avaialable...) and guessed it would be a Good Thing to use for the entire V
distribution if someone was familiar enough with these tools...
Here's my configure.in and Makefile.am for the app I've been putting
together (this is under Linux - I just use a plain BC5.01 prject under
Windows, but I think automake and autoconf are available under windows using
cygwin) (amateurish I know, but they may help someone):
configure.in:
AC_INIT(play1.cpp)
AM_INIT_AUTOMAKE(play1,0.1)
AC_PROG_CXX
AC_OUTPUT(Makefile)
Makefile.am:
bin_PROGRAMS=tryit
tryit_SOURCES=dde.cpp chiroddecanvas.cpp chiroddecmdwin.cpp
main_interface.cpp play1.cpp chirodlgs.cpp dde.hpp chiroddecanvas.hpp
chiroddecmdwin.hpp main_interface.hpp play1.hpp chirodlgs.hpp
INCLUDES=-I/usr/local/v/includex
LDFLAGS=-L/usr/X11R6/lib -L/usr/local/v/lib -lXm -lXmu -lXt -lXext -lX11 -lV
(note I have /usr/local/v/lib in my ld.so.conf so the app can find libV.so
when running)
Pardon my rambles,
Martin
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
Reply to: