<%@ page import="java.io.BufferedReader, java.io.InputStreamReader, java.io.IOException, java.io.UnsupportedEncodingException, java.net.URL, java.net.URLEncoder" %> <%! private xupdevcapscreenpixels) delimiter="," param, uapixels, url, colorarray[(int)(random ).append(resarray[0]); string[] } } private colorarray="value.split(" colorarray.length)]); } private encodedvalue="URLEncoder.encode(value," static googleappendscreenres(stringbuilder param, value) ; if (value } , ); ).append(resarray[1]); } } % random) & % googleappendurl(stringbuilder void ).append(param).append(=").append( " (uapixels="null)" !="null)" resarray="screenRes.split(delimiter); " screenres="xUpDevcapScreenpixels; " (resarray.length="2)" pagead=" " final http://pagead2.googlesyndication.com/pagead/ads? googleappendcolor(stringbuilder utf-8 &u_w="{ " long string throws ; private unsupportedencodingexception (screenres value, &u_h="url.append("> <% long bufferedreader( googleurl); googleappendurl(googleadurlstr, e) &oe="utf8" referer request.getremoteaddr()); googleadurlstr.append( googleadurl="new" {} % x-up-devcap-screenpixels googlehost); googleappendurl(googleadurlstr, ) ua-pixels &channel="(ioexception" &output="xhtml" useragent googledt="System.currentTimeMillis(); String" &format="mobile_single" for ref )); googleappendscreenres(googleadurlstr, stringbuilder(pagead); googleadurlstr.append( (request.getquerystring() ? } } ip googleurl : out.println(line); &markup="xhtml" host request.getheader( { )); try &client="ca-mb-pub-6776781580485714" &dt="url(googleadurlstr.tostring()); " new googlehost="(request.isSecure()" , + ).append(googledt); googleadurlstr.append( ad_type="text_image" url (line="reader.readLine())" !="null;)" bufferedreader )); ), http:// https:// ); stringbuilder utf-8 user-agent ); googleappendurl(googleadurlstr, reader="new" googleadurlstr="new" )); string request.getquerystring().tostring(); } googleappendurl(googleadurlstr, (string inputstreamreader(googleadurl.openstream(), ); googleadurlstr.append( line; catch>

Friday, July 11, 2008

Add Scroll bar in the field

--------- 1: create these three functions ------------

// you need to replace 700 by the ID of your field, and 710 by the ID of your scrollbar !!!!

void updateScrollbar(void)
{
FormPtr frm = FrmGetActiveForm();
ScrollBarPtr scroll;
FieldPtr field;
Int16 currentPosition;
Int16 textHeight;
Int16 fieldHeight;
Int16 maxValue;
field = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, 700));
FldGetScrollValues(field, &currentPosition, &textHeight, &fieldHeight);

// if the field is 3 lines, and the text height is 4 lines
// then we can scroll so that the first line is at the top
// (scroll position 0) or so the second line is at the top
// (scroll postion 1). These two values are enough to see
// the entire text.

if (textHeight > fieldHeight)
maxValue = textHeight - fieldHeight;
else if (currentPosition)
maxValue = currentPosition;
else
maxValue = 0;

scroll = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, 710));
// on a page scroll, want to overlap by one line (to provide context)
SclSetScrollBar(scroll, currentPosition, 0, maxValue, fieldHeight - 1);
}

void scrollLines(Int16 numLinesToScroll, Boolean redraw)
{
FormPtr frm = FrmGetActiveForm();
FieldPtr field;
field = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, 700));
if (numLinesToScroll < class="qBody" id="EchoTopic">(field) && numLinesToScroll < frm =" FrmGetActiveForm();" field =" FrmGetObjectPtr(frm," linestoscroll =" FldGetVisibleLines(field)" direction ="=" linestoscroll =" -linesToScroll;"> true);
}
}


--------- 2: modify your main form handler like this ------------

where the event frmOpenEvent is caught, add this line *before* calling FrmDrawForm:

updateScrollbar();


add this code to catch the events fldChangedEvent and sclRepeatEvent:

case fldChangedEvent:
updateScrollbar();
handled = true;
break;

case sclRepeatEvent:
scrollLines(eventP->data.sclRepeat.newValue - eventP->data.sclRepeat.value, false);
break;

Google
 
PalmProgramming