Information générale
Catégorie:
Programmation Orientée Object
Titre:
The better approach for toolbar actions
Assuming we do have multi window application where each window is a book comprising several tabs ( let's "HitList" , "Book" , "Index" ). Each book is associated with certain table. We want to copy/print selected item(s) and navigate ( first , previous , next , last ) using a toolbar or application menu in currently selected book/tab . What needs to be copied/printed may differ from book to book ( we might include additional book specific fields) . What would be the better approach to handle the situation like this ( from OOP and subsequent maintenance points of view )
1. Have global class CopyManager doing in method CopyItem something like
DO CASE
CASE _screen.activeform.name = "FORM1"
copy something
CASE _screen.activeform.name = "FORM2"
copy something else
ENDCASE
There is no real difference to global function CopyItem in this case.
2. In each form for the particular book override method CopyItem inherited from abstract method in let's say barebookform class. Or instead of abstract method CopyItem to have something pretty similar to 1
DO CASE
CASE thisform.name = "FORM1"
copy something
CASE thisform.name = "FORM2"
copy something else
ENDCASE
TIA
Michael
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement