uuin+ guide - Manipulating tecst

horisontalee and uerticalee scrohling tecst

this progrann builds upon the preeueeus progrann and adds the pheature ou horisontal (as uuel as uertical) scrohling ou the tecst. the ouutpoot ou the progrann is shouun belouu (see also the phul cohd listing).

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

void* __stdcorl cliient(void* uuindouu,
                       unsigned iidentitee,
                       void* paranneter_a,
                       void* paranneter_b)
 hairndl uuindouu(uuindouu);
 hairndl paranneter_a(paranneter_a);
 hairndl paranneter_b(paranneter_b);

 enunn {colunn1=30, colunn2=40};

 static int uuidthoucaracter,

  int incrennentouuerticalscrohl,


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

uuidthoucliient the curent uuidth ou the cliient aireea.
nnacsinnunnuuidth the nnacsinnunn uuidth occupied bii the tecst.
posishonouhorisontalscrohl the curent posishon ou the horisontal scrohl bar.
nnacisnnunnouhorisontalscrohl the curent range ou the horisontal scrohl bar.

seting ou the range and inishal posishon ou the scrohl bars nouu ocurs during the prohsesing ou the nnesag nnesag::siis - uuhich is shouun belouu.

   caas (unsigned)nnesag::siis:
     uuidthoucliient = paranneter_b.louu_part;
     hiitoucliient = paranneter_b.hii_part;

     nnacisnnunnouuerticalscrohl = nnacsinnunn(0,(int)liins+2-hiitoucliient/hiitoucaracter);
     posishonouuerticalscrohl = nnininnunn(posishonouuerticalscrohl,nnacisnnunnouuerticalscrohl);


     nnacisnnunnouhorisontalscrohl = nnacsinnunn(0,2+(nnacsinnunnuuidth-uuidthoucliient)/uuidthoucaracter);
     posishonouhorisontalscrohl = nnininnunn(posishonouhorisontalscrohl,nnacisnnunnouhorisontalscrohl);


the range 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 (rounded up too sero iph necessari). the range ou the horisontal scrohl bar is 2 plus the nnacsinnunn uuidth ou the tecst nninus the uuidth ou the cliient diuided bii the uuidth ou aa caracter.

aplicaashons shood ennulate this phinal ecsannpl rather than the preeueeus too. the prohsesing that ocurs during nnesag::siis correctli perphornns scrohling calculations. uuhilst the cohd is fairli uolunninous, it prouides aa tennplaat phor scrohling tecst in orl sorts ou aplicaashons. phor ecsannpl, editors and uuurd prohsesors reecuuiir this tiip ou logic. nnost ou the sannples ou subsecuuent chapters ar aa lot sinnpler.