Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Maximum Objects
Message
De
24/09/1999 04:06:23
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
23/09/1999 20:59:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00267418
Message ID:
00268381
Vues:
29
>Hi John,
>
>>What is the maximum number of controls could be contained in a form?
>
>Well, a form is a dbf, thus the imposed 2gig limit, I'm not sure how many records that is, so adding at run-time and design-time would have 2 different limits, if any at run - time. Right now, I'm adding objects at run-time in a do while loop, its at about 21,000. I'll let you know if it ever crashes. Jim or Cetin, how do you add objects at desing time, thouht its possible. That would be interesting to try.


Adding objects is not much different than doing at runtime + you have more options like "cloneobject" and "readmethod", "writemethod". For example if I should build a ruler at top, I only create Label01, LineMajor01, LineMinor01 manually, select on form and then clone them. A very simple sample :)
*buildruler.prg
aselobj(aSelected) && Creates an array referencing selected objects on form
aselobj(aContainer,1) 
*Creates an array of 1 element referencing 
*container of selected objects on form
oLabel = _getref(@aSelected,"label01") && Find label referencer in array
oMajor = _getref(@aSelected),"linemajor01")
oMinor = _getref(@aSelected),"lineminor01")
lnRulerUnits = 20 && 20 unit ruler
lnUnit = 30       && 30 pixels units

with  aContainer[1] && Parent -form or another type of container 
  for ix = 2 to lnRulerUnits 
    oLabel.CloneObject("Label"+padl(ix,2,"0"))
    oMajor.CloneObject("LineMajor"+padl(ix,2,"0"))
      with eval(".Label"+padl(ix,2,"0"))
        .Left = (ix - 1) * lnUnit + oLabel.left
        .Caption = padl(ix,2,"0")
      endwith
      with eval(".LineMajor"+padl(ix,2,"0"))
        .Left = (ix - 1) * lnUnit + oMajor.left
      endwith
    if ix < lnRulerUnits
      oMinor.CloneObject("Label"+padl(ix,2,"0")) 
      with eval(".LineMinor"+padl(ix,2,"0"))
        .Left = (ix - 1) * lnUnit + oMinor.left
      endwith
    endif
  endfor
  .Setall("Visible",.t.)
endwith

* This sample also has method code
* Assume you're adding controls to grid columns
* and want to assign keypress code from already there text1.keypress
aselobj(aSelected) && Just assuming grid(s) are selected w/o check
for each oGrid in aSelected
   for each oColumn in oGrid.Columns
       with oColumn
          .Addobject("myTextBox","TextBox")
          .myTextbox.writemethod("KeyPress",.Text1.ReadMethod("KeyPress"))
          .CurrentControl = "myTextBox"
          .Sparse = .f.
       endwith
   endfor
endfor
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform