Solved

Extending a component (simple work for you guys)

Posted on 2004-04-15
21
390 Views
Last Modified: 2010-04-05
Hello Experts,

I need to extend the TmsnPopup component so that it contains an extra "invisible" label that I can store additional text in and retrieve it later.

If you have never seen/heard of  the TmsnPopup component then all it basically does is create a lil popup window above your taskbar like you find in MSN Messenger when someone logs in and everything works fine except I need to have the additional "invisible" label added on to it and ofcourse ways to add text and retrieve the text back from it later on :)

you can find the source at http://www.torry.net/vcl/forms/appearence/tmsnpopup.zip

TIA,
Blue220
0
Comment
Question by:blue220
  • 6
  • 6
  • 6
  • +1
21 Comments
 
LVL 1

Expert Comment

by:tanghz
ID: 10832763
Hi I modified that component that it has CustomStr property. You put your string data there.
No point to add invisible component. It just take you more resources.

Give me your email I send it over.
0
 
LVL 7

Expert Comment

by:sftweng
ID: 10833532
tanghz, please see "Help" -> "The Big Mistakes":

"The use of private correspondence to resolve a question at Experts Exchange is prohibited as an abuse of the points system."
0
 

Author Comment

by:blue220
ID: 10833716
Hello tanghz ... the point of having the lable was so it was "Invisible" i cannot accept anything other then that. Also all really need to do is post the parts you changed or added and I will do the same to the component I have and if need be ask further questions at that time.

Thanks,
Blue220
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 10834122
i'm not understanding one thing: what have to be invisible? the label on the popup or the label property in the cmp?

In the first case you simply need to add a public variable to the cmp so you can set and get it whenever you want....

Please can you explain to me better what do you need?

Do this label have to be showed on the popup?
0
 

Author Comment

by:blue220
ID: 10834242
sorry for any confusion will try to explain better... with the normal component there are 2 lables (1 for title and 1 for text) both of these lables should be left as they are and all I want to do is have one more lable added to the component that will be hidden at runtime so this is what we got..

main component (visible ofcourse)
Title Label (visible)
Text Lable (visible)
New Hidden Label (invisible)

the hidden lable should function the same as the other 2 lables except it's not visible at runtime... anyway thats it and that answers ya questions.
0
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 250 total points
ID: 10834246
BTW maybe this is what you need:

in MSNPopup.pas

find the lines
TMSNPopUp = Class(TComponent)
  private
    { Private declarations }
    FURL: String;
    FText: String;
   [...]
   add here:
   FHiddenLabel: String; // you can change the name as you prefere....

then find...
published
    { Published declarations }
    Property Text: String read FText write FText;
    Property URL: String read FURL write FURL;
    Property IconBitmap: TBitmap read FIcon write SetIcon stored True;
   [...]
   add in this section:
   HiddenLabel: String read FHiddenLabel write FHiddenLabel;


well, now save and re-compile the dpk.

HiddenLabel will appear in object inspector
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 10834304
In fact you don't need really text label, but simply a string variable to store some string values....

for example:

msnpopup1.HiddenLabel := 'This is my hidden text label';
msnpopup1.ShowPopUp;


then in some time

ShowMessage(msnpopup1.HiddenLabel);

Hope it helps
0
 
LVL 7

Assisted Solution

by:sftweng
sftweng earned 25 total points
ID: 10834353
blue220: "and ofcourse ways to add text and retrieve the text back from it later on"

Do you mean that you want to be able to display and change the text at runtime rather than compile time? If so, then perhaps Ferruccio68's HiddenLabel string should be a TEdit.
0
 
LVL 1

Assisted Solution

by:tanghz
tanghz earned 25 total points
ID: 10834422
Sorry, I am new to this forum, just try to help others, no other plans.

save your email safely in case it is exposed by my words.

Ferruccio68: you just gave a very interesting answer. What is the differernce with mine?
blue220 needed a hidden label rather than any other form of string properties.
0
 

Author Comment

by:blue220
ID: 10834467
(Ferruccio68) you got it right... I just wanted an extra label that was hidden at runtime. Ofcourse your string variable suggestion would have worked just as well but this works and i'm happy with it so thx for the help... (told you it was easy for you gurus)


(sftweng) It works exactly the way i need it to... the part about adding and retrieving text later on was because I thought you had to use functions to get the text at runtime but obviously I was mistaken about that part and it works just like I need it to :)
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 10834507
--> Ferruccio68: you just gave a very interesting answer. What is the differernce with mine?
The very most important difference here in ex-ex: i never seen your code in this thread, but only your code sharing intent by email. I posted the code!
0
 
LVL 1

Expert Comment

by:tanghz
ID: 10834558
totally faint,
I already made that answer, but ...

That is a string propery added to the component!!!
No Tlabel created or added. it means there is nothing to do labels excep some named as 'FHiddenLabel. I named as 'customstr'.

0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 10834561
blue220: I'm glad and happy to have helped you.

what about accepting the answer now? ;-)

F68 ;-)
0
 
LVL 7

Expert Comment

by:sftweng
ID: 10834570
tanghz, I meant no offense in pointing out the Ex-Ex policy and I suspected that you were not familiar with it.

Ferrucio68's answer is different from yours in at least one major respect - he posted his code here and you did not. Frequently this will lead to collaboration by many people answering in such a way that the best answer is provided to the questioner, through a process of clarification and refinement; that is one of the reasons why private resolution of a problem may not be as effective as an open discussion.
0
 

Author Comment

by:blue220
ID: 10834584
I upped the points to 300 and spilt the question ... the original 250 to Ferruccio68 for his answer and 25 each to sftweng and tanghz for thier support as well... Thx guys.
0
 
LVL 1

Expert Comment

by:tanghz
ID: 10834591
I agree
0
 
LVL 1

Expert Comment

by:tanghz
ID: 10834623
I mean agree to the policy of the forum
and thanks for blue220's points. however, you really need to get clear what is going on here. This is helpful to your future coding in Delphi.
good lucks,
0
 

Author Comment

by:blue220
ID: 10834632
btw sorry this time around tanghz but by the way I ask for help on here you are sure to get one of them :)
0
 

Author Comment

by:blue220
ID: 10834665
what I asked for was a label and thought that is what F68 provided to me ... just like your new here I am new to delphi so don't really know the diff between alot things ... it's all a learning process and I have a longgggggggg way to go :)

cherrs,
blue220
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 10834775
Just to close and clearify this thread:
Sometimes i do some search in Ex-Ex for my needs, and when i find a question answered by email sharing i stay so bad as i was sure to have found my solution but not, just a soap ball....
That's just to say that this is not a game contest (here in Italy we said 'points or not points this evening i'll eat the same') but simply a great place where to increase knowledges, save many time and learn and learn again...
So the best respect to you tanghz, i hope i'll read about you again here in Ex-Ex as i surely have to learn from you also....


0
 
LVL 1

Expert Comment

by:tanghz
ID: 10835108
Hi, you are so gentle and humble, we will learn from each other.
I think I can do the following now:


Application.terminate :)



Good luck to you all.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now