TaskList Manager - wxWidget GUI - WIP

BlitzMax Forums/Brucey's Modules/TaskList Manager - wxWidget GUI - WIP

Glenn Dodd(Posted 2008) [#1]
What it is:
A few years ago i needed a TaskList Manager to help me keep track of all the things i was doing at work. I have an MS Access Database and i built a VB6 frontend for it. I installed it at work and my whole department used it. Security policies changed and it had to be uninstalled. Recently the policies have changed again and i can reinstall it. I am now building it in BlitzMax using the wxWidgets for the frontend.
The gui and partial database structure is listed below.
On the top portion on the hard left is a list of SelectorTypes (currently Customers, Projects and Investigations). You click one. The list on the left of the middle portion shows the Companies/Projects/Investigations. Click one. Then there are 2 ListControls and a TextControl. The top one is for the Main Tasks. This includes the Team Member assigned the task, due dates, completed and cancelled flags. Click one. The second ListControl shows the Sub Tasks for the Main Task, again with the appropriate flags and fields. Click one. The last item (text control) displays the notes about that Sub Task.
On the bottom portion are filters in the form of radio buttons.
Lastly, back in the top portion there is a list control highlighting Main Tasks / Sub Tasks that are Overdue, based on the Choices on the right.

This is not a particularly complicated program but it added immense value to my working day and keeping track of every thing.

This is a learning exercise for me but i will be uploading the code, exe and database to the archives once completed. I suspect a lot of people would find this type of thing useful...

I will be asking for help along the way.
If anyone wants to install the Database and pictures (commented out currently but they work on my pc) then email me on glenn at c2d.co.nz

Cheers
Glenn


Glenn Dodd(Posted 2008) [#2]
OK - here is my first problem and i think it is just of case of me making it too complicated.

DatabaseTypes.bmx


C2DTaskListManager_v0.04.bmx


Currently i have the list for the top left being hard coded as Company/Project/Investigation but these values need to come from the database.
I am reading the values in from the table (TSelectorType) and putting them in a list. Why - because all the example i have seen do this.
What i need to do now is get the second field (SelectorTypeName) ready to be used by the ListBox in the main program.
So i need to get the values into an array for the line:
Local m_listBoxSelectorTypeChoices:String[] = [ "Companies", "Investigations", "Projects" ]

I am obviously doing this wrong. I also think i am trying to do too many steps to achieve this.
Maybe i don't need to use the table types to get the values. I was using this format because it made the readability easy plus i could add methods for Add/Edit/Delete/Save.

Once i have this first list being populated by the table data i can finish the other listboxes and listcontrols with no difficulty.

I would appreciate some help.

Cheers
Glenn


Glenn Dodd(Posted 2008) [#3]
This works but it doesn't look elegant.
Any suggestions?
(see the code in between the ***********'s)




DavidDC(Posted 2008) [#4]
How about a screenshot? :-)

Looking at the code immediately above my only real thought is that I'd be safety checking that your List is OK and count() <> 0. Otherwise I don't see any real drama?

An alternate route would be to create the wxListBox first with Null items and then use wxListBox.Insert() within your Eachin List loop and bypass the string array entirely.

Unless of course I entirely misunderstood you!


Brucey(Posted 2008) [#5]
Without a DB schema, it's going to be hard to follow your example very well - and difficult to run it on Access from my Mac :-p
(Once we have a schema we could, in theory, have it running in any old database - which opens up your options somewhat - although I realise you'll only be running it on Win32).

Looking at DatabaseTypes.bmx, are you planning on loading all the data in at once, or will you be retrieving only the bits you need when you need them?
Caching is fine for "static" data (that which doesn't change very often), but for more volatile information there's no harm in only having it in memory when you need it. As you probably already know ;-)

SelectorTypeID : Is this going to be used to help you find things listed under a specific category? (eg. Companies)

Where you would have another table with SelectorTypeID as a foreign key...

So...

User clicks on "Companies" in the list box, you then select from the db all the matching data for that ID.. and put it into your other list. ?
SELECT * FROM otherTable WHERE selectortypeid = ?

(although you would replace "*" with the list of columns, for readability :-p )


I think David's onto the right idea about initially populating the listbox. Add to the listbox after it's been created. It also means you should never need to edit the generated UI file :-)

MVC... Keep the data model separate from the User Interface.


Brucey(Posted 2008) [#6]
You also probably want some way to tie a specific row in your listbox to a Type instance.

With Insert() and Append(), there's an optional clientData parameter with which you can attach your Type instance. (and I even believe it is referenced in there too, so you might not need to keep your own list. ie. it shouldn't be GC'd if you don't store it in your own list).

Then, when you select something from the listbox, you can get more details out of the clientData field, which you can then use to do whatever..

Future version of wxWidgets are going to have a proper MVC style data/view model which should make working like this much easier.


DavidDC(Posted 2008) [#7]


Prev vb6 version




Glenn Dodd(Posted 2008) [#8]
David, I have emailed a screenshot to you as i don't have anywhere to upload one to.
I will definitely be putting bounds checking in but i just needed to get over that "get data and display" hurdle.
I like the idea of wxListBox.Insert(). My first thought is to put this in the DatabaseTypes.bmx but that may not work (i will try later tonight).
I only get the data as i need it. So populate the lists on startup and update relevant lists on each click where relevant, using the "SELECT * FROM otherTable WHERE selectortypeid = ?" format. I haven't put those queries in yet but i planned to give them their own types. That should make Add/Edit and Delete easier too.

Brucey - i had seen that clientData option in the docs but hadn't figured out how to use it. The way you describe it makes it sound like what i want. Some reading and test apps to go...:)

In my Database types i like the idea of having the list for each type (table or query) so that i have the foreign key available to help build up the queries for Main Task and Sub Task. Other than that i probably don't need it.

I will open Access and see about dropping out the schema, although i haven't done it before. Can either of you just drop my database into a folder and use the FileDSN to make the code us it? i don't think you need Access to be installed, just the odbc driver?

I really appreciate your help.

oh and i better check that MVC link too.

Cheers
Glenn


Brucey(Posted 2008) [#9]
i don't think you need Access to be installed

well, you need Windows... which precludes much in the way of testing outside of the office for me.
However, if you want, you can mail me an mdb (to work) and I can have a go at creating a set of Table definitions for SQLite. (table creates are generally DB specific, but if you make your SQLs ANSI friendly they should work on any database).


Glenn Dodd(Posted 2008) [#10]
Brucey - Emailed.

The vb6 app had lots of buttons on the right hand side but i have removed them for the blitz version. A toolbar will be much better ie Add/Edit/Delete using the highlighted item on the active control.
I will add reports in later too using the pdf functionality in wxwidgets.

Cheers
Glenn


Brucey(Posted 2008) [#11]
Thanks.

I've still to add toolbar support into wxCodeGen. I'll try to make some time for that this evening.


Glenn Dodd(Posted 2008) [#12]
This small snippet is clearing frame.m_listBoxSelector DATA but doesn't seem to clear the actual listbox on the SCREEN.
I have looked under wxControlWithItems but i can't find a "refresh" command?

any ideas? Been sitting here reading and playing for over an hour...and getting nowwhere...

Cheers
Glenn





Brucey(Posted 2008) [#13]
How's about this small example?