Deactivating display of default message in FW Message Bar

Deactivating display of default message in FW Message Bar

Postby PatrickWeisser » Sun Sep 23, 2007 7:54 am

Hello All,

Does anyone know a way to stop the message bar from reverting back to the string it was initialized with whenever the user moves the mouse? I'm using:

oMainAppWnd:oMsgBar:SetMsg( "New message" )

... to update what I want to have displayed, and I would like it to stay that way until I change it again with a subsequent SetMsg() call. I know I can create an entirely new message bar to replace the existing one which would have a new default string, but that is much slower and creates a noticeable flashing in the message bar area.

Thanks!
User avatar
PatrickWeisser
 
Posts: 53
Joined: Fri Mar 23, 2007 4:10 am
Location: Seattle, WA, USA

Postby James Bott » Sun Sep 23, 2007 8:54 am

Patrick,

Try this:

oWnd:oMsgBar:cMsgDef:="Message"
oWnd:oMsgBar:setMsg("yyy")

Where "Message" is the one you want displayed. "yyy" is just a dummy.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby PatrickWeisser » Sun Sep 23, 2007 9:34 pm

Hey thanks James, that worked perfectly! Thank's also for your encouragement in using more Object Oriented coding techniques. I'm making use of it in some small experimental ways as I become more comfortable with it. So far what has impressed me most is the use of inheritance when I need to customize just one or two methods of a FiveWin class (such as the tget class). And I'm very grateful that Antonio included so much of the class source code with FiveWin. In addition to allowing me to make some minor changes I may need, it also serves as an incredible OOP teaching tool.

-Patrick
User avatar
PatrickWeisser
 
Posts: 53
Joined: Fri Mar 23, 2007 4:10 am
Location: Seattle, WA, USA

Postby James Bott » Sun Sep 23, 2007 10:13 pm

Patrick,

>Hey thanks James, that worked perfectly!

Good. I don't fully understand the message bar message system. It seems that setMsg() only displays the new message until there is a refresh() or systemrefresh(). This does allow displaying a temporary message during a process, then it reverts back to the original message. Sometimes this might be useful, and other times not.

>Thank's also for your encouragement in using more Object Oriented coding techniques. I'm making use of it in some small experimental ways...

Well, I am glad to hear you are experiementing. There is so much to be gained from using OOP. It is a little daunting at first, but once you get the hang of it, your productivity skyrockets.

>So far what has impressed me most is the use of inheritance when I need to customize just one or two methods of a FiveWin class (such as the tget class).

Ah, yes inheritance is great. Polymorphism (same naming) is also. You can pass around various objects and call the same method (e.g. edit(), print(), delete(), etc.). Incredibly useful!

I also encourge you to try creating business objects. Unlike FW objects which are mostly interface objects, business objects emulate thier real-world counterparts like items, customers, invoices, etc. We are accustomed to thinking of these in terms of just data (fields in a database), but they also may have behaviors (methods) like an invoice might have an acceptPayment() method which updates the balance due and also maybe the customer file. Note that you could have an object embedded in another object, like a customer object could be embedded in the invoice object. The you could something like:

Code: Select all  Expand view
method acceptPayment( nAmount, dDate ) class TInvoice
    local oCustomer
    oCustomer:= TCustomer():new()
    oCustomer:acceptPayment( nAmount, dDate )
    oCustomer:end()
   
    ::balance:= ::balance - nAmount
    ::lastPaid:= dDate
    ::save()

return self


So, now to accept a payment on an invoice all you do is:

Code: Select all  Expand view
   oInvoice:=TInvoice():new( cInvno)
   oInvoice:acceptPayment( nAmount, dDate )
   oInvoice:end()


Both the invoice file and the customer file are updated automatically.

Check out the book on business objects shown on my website. You can get it used sometimes for as little as one cent! Highly recommended.

http://ourworld.compuserve.com/homepage ... rogram.htm

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby hua » Mon Sep 24, 2007 1:51 am

I too am starting to experiment with OOP. I like it because it tends to make the codes tidier and more readable. At a glance, you can tell what the code is trying to accomplish. However I do find myself confused a lot of times when determining which method should go to which object. Sometimes it's the issue of how to organize objects within objects that got me all tangled up.

But I did get the "aha" moments that James used to mention a couple of times :). For instance, I could sub class the database object and design it in such a way that it's tied to a data dict. Whenever an attempt to open a non-existent dbf or indexes are made, it'll automatically be created on the fly based on settings in the data dict.

Unfortunately second hand book that James recommended can't be bought by me if I order via Amazon as I reside in Malaysia.

Thanks for your articles on OOP James. Sorry for going off-topic here Patrick, hope you wouldn't mind
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Postby James Bott » Mon Sep 24, 2007 2:23 am

Hua,

>I too am starting to experiment with OOP. I like it because it tends to make the codes tidier and more readable. At a glance, you can tell what the code is trying to accomplish.

Very good points. One of the basics of OOP is information hiding. By putting lots of the code into methods, the flow of the program is easier to follow. It is kind of like looking at a collapsed outline.

>However I do find myself confused a lot of times when determining which method should go to which object. Sometimes it's the issue of how to organize objects within objects that got me all tangled up.

Ah, yes, this is difficult at first and only gets better with experience. If you do have these types of questions, feel free to post them here and I will try to help. Others may like to hear about it too.

I find that it helps to first think of the real-world objects (try to forget about thinking in programming terms at first). For instance I am working on a project in the medical field right now. First I try to figure out the terminology (patient, provider, procedure, encounter, billing code, etc.) and how all those terms relate to each other. I write down a description of each one an how it relates to the others in plain words, not code. This does help a lot.

>But I did get the "aha" moments that James used to mention a couple of times . For instance, I could sub class the database object and design it in such a way that it's tied to a data dict. Whenever an attempt to open a non-existent dbf or indexes are made, it'll automatically be created on the fly based on settings in the data dict.

Congradulations on that!

>Unfortunately second hand book that James recommended can't be bought by me if I order via Amazon as I reside in Malaysia.

I'm sorry to hear that. Is this because Amazon will not ship outside the US? Is it a tax issue? Have you tried to find it via other sources?

>Thanks for your articles on OOP James.

I'm glad you found them useful. My hope is that my teaching some OOP techniques will allow others to gain from the benefits of OOP like I have. It is an incredible tool.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby hua » Tue Sep 25, 2007 1:36 am

...I write down a description of each one an how it relates to the others in plain words, not code. This does help a lot

Are using UML to help you with this part?

I'm sorry to hear that. Is this because Amazon will not ship outside the US? Is it a tax issue? Have you tried to find it via other sources?

Oh, they do ship outside US and I have actually bought from Amazon before. It's just that I can only buy brand new books. My guess is second hand books are only for domestic market.

I'm glad you found them useful. My hope is that my teaching some OOP techniques will allow others to gain from the benefits of OOP like I have. It is an incredible tool.

Yeap. The initial planning might takes a longer time before one is able to code but in the long term a lot of time are saved in maintaining those codes.
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Postby James Bott » Tue Sep 25, 2007 4:51 am

Hua,

>Are using UML to help you with this part?

I use CRC cards, which I think is considered pre-UML. You can find more info about CRC cards using Google. This is one nice site:

http://www.agilemodeling.com/artifacts/crcModel.htm

>Oh, they do ship outside US and I have actually bought from Amazon before. It's just that I can only buy brand new books. My guess is second hand books are only for domestic market.

Ah, I see the book is no longer available new. Too bad.

>Yeap. The initial planning might takes a longer time before one is able to code but in the long term a lot of time are saved in maintaining those codes.

True and a very good point. Maintenance is way easier. And OOP makes evolutionary development much easier too. And as we all know, all development is evolutionary.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby hua » Fri Sep 28, 2007 2:06 am

Thanks for the link James
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 30 guests