Dan: Welcome to the small, but exclusive, club whose members try to make use
of Palm's Dynamic UI functionality.
Here's the code snippet I built that works hunkey-dorey fine ... well,
except for the fact that it uses the "system use only" function called
"FrmAddSpaceForObject". You're welcome to plagiarize at will. Note that
this was just a sample program that I built while I was trying to figure out
how to make it work. The "real" code is driven by a User Defined table of
values that I have no control over ... which is why I (actually, my client)
needs a dynamically defined ScrollBar.
// There doesn't seem to be a way to dynamically add a scroll bar.
// This routine defines one, then adds it to the form structure.
ScrollBarPtr barP;
ScrollBarType scrollBar;
scrollBar.bounds.topLeft.x = 152;
scrollBar.bounds.topLeft.y = 21;
scrollBar.bounds.extent.x = 7;
scrollBar.bounds.extent.y = 39;
scrollBar.id = FieldEditTextScrollBar;
scrollBar.attr.usable = true;
scrollBar.attr.visible = false;
scrollBar.attr.hilighted = false;
scrollBar.attr.shown = false;
scrollBar.attr.activeRegion = 0;
scrollBar.value = 0;
scrollBar.minValue = 0;
scrollBar.maxValue = 0;
scrollBar.pageSize = 0;
scrollBar.penPosInCar = 0;
scrollBar.savePos = 0;
// Create space for the new scroll bar in the form structure.
// Note: the Form might move. Be sure to use the new frmP.
barP = &scrollBar;
FrmAddSpaceForObject (&frmP,
&barP,
frmScrollBarObj,
sizeof(ScrollBarType));
// Copy the new scrollbar we defined into the form structure.
MemMove(barP, &scrollBar, sizeof(scrollBar));
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/