separating interface from backend

Hi,

I am currently using wxTreeCtrl in my app to navigate through files, almost like the "Windows-Explorer" interface. I use the TreeCtrl mainly to do operations such as drag-and-drop, move files between directories, etc. But my code is a bit of a mess because the interface and the backend mechanism are all in the tied up in the code. My code uses the following approach for most tasks:

1. When the user double-clicks on the a label in the TreeCtrl, I display the file in another frame.

2. I get the file to be displayed using the GetItemText method.

3. Then I perform the backend operations to be carried out. For example, if it is a drag and drop operation between two directories, I remove the file-name item from a list for the source directory, append it to the destination directory list

4. Then I actually move the file between the directories using Python commands.

5. Then I remove the element from the source node in the TreeCtrl and append it to the destination node in the TreeCtrl.

I feel there is an easier approach than the one above. I would appreciate any feedback/comments. Thanks.

Is there a conventional, tried-and-tested approach to designing projects where the interface and backend need to be separated, especially in the use of TreeCtrls? Thanks.

Regards,
Satchit

Hi,

I am currently using wxTreeCtrl in my app to navigate through files, almost like the "Windows-Explorer" interface. I use the TreeCtrl mainly to do operations such as drag-and-drop, move files between directories, etc. But my code is a bit of a mess because the interface and the backend mechanism are all in the tied up in the code. My code uses the following approach for most tasks:

1. When the user double-clicks on the a label in the TreeCtrl, I display the file in another frame.

2. I get the file to be displayed using the GetItemText method.

3. Then I perform the backend operations to be carried out. For example, if it is a drag and drop operation between two directories, I remove the file-name item from a list for the source directory, append it to the destination directory list

4. Then I actually move the file between the directories using Python commands.

5. Then I remove the element from the source node in the TreeCtrl and append it to the destination node in the TreeCtrl.

I feel there is an easier approach than the one above. I would appreciate any feedback/comments. Thanks.

well... you could do something like populate the TreeCtrl based on the directory contents and then your operations will simply be...
do something (copy/move/rename/whatever) then update the controls.

Is there a conventional, tried-and-tested approach to designing projects where the interface and backend need to be separated, especially in the use of TreeCtrls? Thanks.

MVC... :slight_smile: Also read as much as you can about UI
here are 2 links to get you started:
http://www.welie.com/patterns/gui/index.html
http://www.pliant.org/personal/Tom_Erickson/InteractionPatterns.html

···

On Mon, 25 Oct 2004 12:39:40 +0530, Satchidanand Haridas <sharidas@zeomega.com> wrote:

--
Peter Damoc
Hacker Wannabe