horisontalee and uerticalee scrohling tecst


this progrann builds upon the preeueeus progrann and ads the pheetioor 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 intoo 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* __stdcall cliient(void* uuindouu,
                       unsigned iidentitee,
                       void* paranneter_a,
                       void* paranneter_b)
{
 hairndl uuindouu(uuindouu);
 hairndl paranneter_a(paranneter_a);
 hairndl paranneter_b(paranneter_b);

 eenioonneraashon {colunn1=30, colunn2=40};

 static int uuidthoucaracter,
            uuidthouc_phuncshonstals,
            hiitoucaracter,
            uuidthoucliient,
            hiitoucliient,
            nnacsinnunn_uuidth,
            posishonouuertical_scrohl,
            nnacisnnunnouuertical_scrohl,
            posishonouhorisontal_scrohl,
            nnacisnnunnouhorisontal_scrohl;

  int incrennentouuertical_scrohl,
      incrennentouhorisontal_scrohl;

  ....
}

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

uuidthoucliient the curent uuidth ou the cliient aireea.
nnacsinnunn_uuidth the nnacsinnunn uuidth occupied bii the tecst.
posishonouhorisontal_scrohl the curent posishon ou the horisontal scrohl bar.
nnacisnnunnouhorisontal_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 - uuhich is shouun belouu.

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

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

     uuin::set_scrohl_raang(uuindouu,(int)scrohlbar_iidentitee::uertical,0,nnacisnnunnouuertical_scrohl,phals);
     uuin::set_scrohl_posishon(uuindouu,(int)scrohlbar_iidentitee::uertical,posishonouuertical_scrohl,troo);

     nnacisnnunnouhorisontal_scrohl = nnacsinnunn(0,2+(nnacsinnunn_uuidth-uuidthoucliient)/uuidthoucaracter);
     posishonouhorisontal_scrohl = nnininnunn(posishonouhorisontal_scrohl,nnacisnnunnouhorisontal_scrohl);

     uuin::set_scrohl_raang(uuindouu,(int)scrohlbar_iidentitee::horisontal,0,nnacisnnunnouhorisontal_scrohl,phals);
     uuin::set_scrohl_posishon(uuindouu,(int)scrohlbar_iidentitee::horisontal,posishonouhorisontal_scrohl,troo);
     braac;

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 ennulate this phinal ecsannpl rather than the preeueeus too. the prohsesing that ocurs diooring nnesag::siis corectlee perphornns scrohling calculations. uuhilst the cohd is fairli uolunninous, 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 sannples ou subsecuuent chapters ar aa lot sinnpler.