Wednesday, March 18, 2020

How to Hide the Tabs of the TPageControl Delphi Control

How to Hide the Tabs of the TPageControl Delphi Control The TPageControl Delphi control displays a set of pages used to make a multiple-page dialog box. Each page - a tab sheet - hosts its own controls. The user selects a page (makes it visible) by clicking the page’s tab that appears at the top of the control. Hiding PageControl Tabs If you need to create a wizard-like user interface where you have Next and Previous buttons appearing to move a user forward and backward through a set of pages (dialogs), hide the tabs of the PageControl and thus disallow selecting a particular page by means of the users mouse. The trick is in setting the TabVisible property to false for each of the sheets (TTabSheet object) of the page control. Activating the page by using either the ActivePage or the ActivePageIndex PageControl properties will not raise the OnChange and OnChanging events. To programmatically set the active page, use the SelectNextPage method: Â  //Hide PageControl Tabsvarpage : integer;beginfor page : 0 to PageControl1.PageCount - 1 dobeginPageControl1.Pages[page].TabVisible : false;end;//select the first tabPageControl1.ActivePageIndex : 0;(*Or set Active Page directlyPageControl1.ActivePage : TabSheet1;Note: the above two do NOT raise theOnChanging and OnChange events*)end;procedure TForm1.PageControl1Changing(Sender: TObject;var AllowChange: Boolean) ;begin//no change if on the last pageAllowChange : PageControl1.ActivePageIndex -1 PageControl1.PageCount;end;//Select Previous Tabprocedure TForm1.PreviousPageButtonClick(Sender: TObject) ;beginPageControl1.SelectNextPage(false,false) ;end;//Select Next Tabprocedure TForm1.NextPageButtonClick(Sender: TObject) ;beginPageControl1.SelectNextPage(true,false) ;end; Using this technique will de-clutter the form, leading to a more streamlined interface, but ensure that the arrangement of controls on each tab doesnt force the user to move frequently between tabs.

Sunday, March 1, 2020

Edmontosaurus - Facts and Figures

Edmontosaurus - Facts and Figures Name: Edmontosaurus (Greek for Edmonton lizard); pronounced ed-MON-toe-SORE-us Habitat: Swamps of North America Historical Period: Late Cretaceous (70-65 million years ago) Size and Weight: About 40 feet long and 3 tons Diet: Plants Distinguishing Characteristics: Muscular jaws with numerous teeth; duck-like bill About Edmontosaurus Originally unearthed in Canada (hence its name, honoring the city of Edmonton), Edmontosaurus was a widely distributed plant-eating dinosaur whose strong jaws and numerous teeth could crunch through the toughest conifers and cycads. With its occasionally bipedal stance and medium height, this three-ton hadrosaur (duck-billed dinosaur) probably ate leaves from the low-lying branches of trees, and also got down on all fours when necessary to browse ground-level vegetation. The taxonomic history of Edmontosaurus would make for a good-sized novel. The genus itself was formally named in 1917, but various fossil specimens had been making the rounds well before that; as far back as 1871, the famous paleontologist Edward Drinker Cope described this dinosaur as Trachodon. Over the next few decades, genera like Claosaurus, Hadrosaurus, Thespesius and Anatotitan were thrown around pretty much indiscriminately, some erected to accommodate Edmontosaurus remains and some having new species stuffed under their umbrella. The confusion persists even today; for example, some paleontologists still refer to Anatotitan (the giant duck), even though a strong case can be made that this was actually an Edmontosaurus species. In a stunning feat of retroactive detective work, one paleontologist investigating a bite mark on an Edmontosaurus skeleton determined that it was inflicted by a full-grown Tyrannosaurus Rex. Since the bite was clearly not fatal (theres evidence of bone growth after the wound was incurred), this counts as solid evidence that a) Edmontosaurus was a regular item on T. Rexs dinner menu, and b) T. Rex did occasionally hunt for its food, rather than contenting itself with scavenging already-dead carcasses. Recently, paleontologists discovered a partially mummified Edmontosaurus skeleton bearing an unexpected feature: a fleshy, round, rooster-like comb on top of this dinosaurs head. As yet, its unknown whether all Edmontosaurus individuals possessed this comb, or just one sex, and we cant yet conclude that this was a common feature among other Edmontosaurus-like hadrosaurs.