[ coosaduck @ 03.03.2006. 13:36 ] @
Zanima me kako da kada upisujem slova u edit da se ona zamene zvezdicama ,kao kod konekcije za internet. help me please |
[ coosaduck @ 03.03.2006. 13:36 ] @
[ seymour @ 03.03.2006. 13:55 ] @
Ako je pitanje vezano za TEdit komponentu u Borland Builderu,potrebno je samo da stavis u property PasswordChar TEdit komponente znak *(ako zelis da se skriveni znaci predstave standardno zvezdicom) .Dinamicki bi to bilo:
.... TEdit *Edit1; ///neki primerak TEdit-a .... Edit1->PasswordChar='*'; //recimo u onCreate dogadjaju za formu Naravno ja ti preporucujem da to ipak odradis vizualno u object inspectory. Naravno ako zelis da ti se znaci skrivaju sa recimo #,mozes umesto '*' staviti '#'... [ IDE @ 03.03.2006. 22:00 ] @
pa imas MaskEdit komponentu....
koristi nju... [ X Files @ 04.03.2006. 08:44 ] @
Citat: Edit1->PasswordChar='*'; //recimo u onCreate dogadjaju za formu Nikad u BCB-u ne koristite OnCreate() niti OnDestroy() dogadjaje. Ti dogadjaji postoje zbog kompatibilnosti sa Delphi-jem i u njemu su sasvim legitimni. Kod BCB-a: OnCreate() moze biti pozvana PRE konstruktora a OnDestroy() POSLE destruktora, što je u C++ neozvoljeno, i pravi puno problema kod PRAVOG C++. Ta dva dogadjaja su izvor mnogih problema u BCB-u, pogotovo nakon uvodjenja OldCreateOrder propertija. Umesto OnCreate() koristi PRAVI konstruktor: Code: __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { // konstruktor } a umesto OnDestroy() koristi PRAVI destruktor (koji ces morati sam da napravis jer ga IDE ne pravi): Code: // --- H --- __fastcall ~TForm1(); // --- CPP --- __fastcall TForm1::~TForm1() { // destruktor } [ seymour @ 04.03.2006. 16:16 ] @
Citat: OnCreate() moze biti pozvana PRE konstruktora a OnDestroy() POSLE destruktora, što je u C++ neozvoljeno, i pravi puno problema kod PRAVOG C++. Da li ovde govorimo o portabilnosti aplikacija pisanih u builderu sa drugim prevodiocima i okruzenjima,kao i starim verzijama istog? O pomenutom property help kaze sledece: "When OldCreateOrder is false (the default) the OnCreate event occurs after all constructors are finished and the OnDestroy event occurs before any destructors are called." Sto bi me navelo da ako je false,a sto jeste po defaultu,da se tacno zna kada ce biti pozvan onCreate...Mada,ako si mislio da to stvara problema pri prelasku na neki drugi IDE,onda se slazem;ne treba koristiti te dogadjaje. [ coosaduck @ 04.03.2006. 18:02 ] @
Pa da PassworsChar. Iako sam pocetnik ovo sam morao da vidim.
[ X Files @ 04.03.2006. 18:03 ] @
OnCreate() i OnDestroy() u BCB-u (ne u Delphiju!) imaju dugu istoriju problema
(koji su dokumentovani i u QA). To je odavno identifikovan problem, pa najveci poznavaoci BCB-a stalno pocetnike upozoravaju da ih ne koriste. Sada me mrzi da ti trazim threadove po netu, ali evo jedan iz moje arhive: Citat: Ah ha! The short answer is - don't! OnCreate and OnDestroy are Delphi-isms that should be avoided like the plague in C++ code. Here is Chris Uzdavinis excellent post on this: OnCreate is a terrible decision to use, and it should not be there at all except that Delphi code uses it. Other than the order of being called, there are several other problems as well. In C++ code, I beg and plead people to not use it as if OnCreate didn't exist. In addition to the unpredictable calling order (well, it is predictable but still surprises a lot of people), there are some other significant problems with these events. These are major risks and should not be taken lightly. * derived objects won't have the base OnCreate called when they are created (unless users explicitly call it.) * dynamic instantiation (in program code) of a object will NOT call the OnCreate event. [problem is fixed in bcb 4 or 5 (not sure which), but exists in older versions * there is no initializer list for OnCreate, so if OnCreate is all that is used only objects that have default constructors can be used. If you have non-default constructors that need to be called, you *have* to put the code in the true constructor. If the constructor must pass another pointer member to that constructor, and that pointer is initialized in OnCreate, it is potentially not initialized at the time of the constructor and the application will crash. If your class holds a reference to an object, then you can't use OnCreate to initialize the reference, you MUST use a constructor. * being a normal function, your OnCreate handler can be called multiple times (accidently, of course) which an potentially be disastrous. * Copy construction doesn't call OnCreate at all. (However, in BCB5 copy construction of vcl objects is prevented at compile time, older versions did not.) * THE INITIALIZATION DONE BY FORMCREATE CAN POSSIBLY RUN *BEFORE* YOUR CONSTRUCOTR, WHICH MEANS THAT YOUR ENTIRE PROGRAM BEHAVIOR IS POSSIBLY UNDEFINED. This is an ***EXTREMELY SERIOUS*** problem. [ seymour @ 05.03.2006. 17:24 ] @
Ok u pravu si,samo ja do sada nisam imao takvih problema.Znaci,ipak sve potrebno pisati u konstruktoru,odnosno destruktoru forme.
[ leka @ 06.03.2006. 16:09 ] @
Moram da primetim da pokretac ove niti nije uopste spomenuo koji GUI toolkit koristi, tako da zapravo NIKO nije mogao da mu koncizno odgovori na pitanje bez nekog nagadjanja...
Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.
|