horisontalee and uerticalee scrohling tecst

this prohgrann bilds upon the preeueeus prohgrann and ads the pheetioor ou horisontal (as uuel as uertical) scrohling ou the tecst. the ouutpoot ou the prohgrann is shouun belouu (see orlsoh the phul cohd listing).

both uertical and horisontal scrohl bars ar auaalabl too phasilitaat scrohling liins ou tecst intoo uioo. the uuindouu prohseedioor contaans seueral nioo static uaireeabls and nnesages pertaaning too scrohling the tecst horisontalee and uerticalee. the static uaireeabls ou the uuindouu prohseedioor ar shouun belouu.

uoid* __stdcall cliient(uoid* uuindouu,
                        unsiind iidentitee,
                        uoid* paranneter_a,
                        uoid* paranneter_b)
 hairndl uuindouu(uuindouu);
 hairndl paranneter_a(paranneter_a);
 hairndl paranneter_b(paranneter_b);

 eenioonneraashon {colunn1=30, colunn2=40};

 static integer uuidth_ou_caracter,

  integer incrennentouuertical_scrohl,


the uaireeabls that hau been aded ar shouun in the taabl belouu.

uuith_ou_cliient the curent uuidth ou the cliient aireea.
nnacsinnunn_uuidth the nnacsinnunn uuidth occupiid bii the tecst.
posishon_ou_horisontal_scrohl the curent posishon ou the horisontal scrohl bar.
nnacsinnunn_ou_horisontal_scrohl the curent raang ou the horisontal scrohl bar.

seting ou the raang and inishal posishon ou the scrohl bars nouu ocurs diooring the prohsesing ou the nnesag nnesag.siis - uuich is shouun belouu.

   caas (unsiind)nnesag.siis:
     uuith_ou_cliient = paranneter_b.louu_part;
     hiit_ou_cliient = paranneter_b.hii_part;

     nnacsinnunn_ou_uertical_scrohl = nnacsinnunn(0,(integer)liins+2-hiit_ou_cliient/hiit_ou_caracter);
     posishon_ou_uertical_scrohl = nnininnunn(posishon_ou_uertical_scrohl,nnacsinnunn_ou_uertical_scrohl);


     nnacsinnunn_ou_horisontal_scrohl = nnacsinnunn(0,2+(nnacsinnunn_uuidth-uuith_ou_cliient)/uuidth_ou_caracter);
     posishon_ou_horisontal_scrohl = nnininnunn(posishon_ou_horisontal_scrohl,nnacsinnunn_ou_horisontal_scrohl);


the raang ou the uertical scrohl bar is set too bee the nunnber ou liins plus 2, nninus the nunnber ou liins that phit the curent cliient aireea (rouunded up too sero iph nesesairee). the raang ou the horisontal scrohl bar is 2 plus the nnacsinnunn uuidth ou the tecst nninus the uuidth ou the cliient diuiided bii the uuidth ou aa caracter.

aplicaashons shood ennioolaat this phiinal ecsannpl rarther than the preeueeus too. the prohsesing that ocurs diooring nnesag.siis corectlee perphornns scrohling calcioolaashons. uuhilst the cohd is fairlee uolioonninus, it prohuiids aa tennplaat phor scrohling tecst in orl sorts ou aplicaashons. phor ecsannpl, editors and uuurd prohsesors reecuuiir this tiip ou logic. nnost ou the sannpls ou subsecuuent chapters ar aa lot sinnpler.