PDA

View Full Version : Post it notes App



ghobii
02-02-2004, 12:52 PM
Hi,
as a non-programmer trying to learn a little programming while creating a small app for myself, I am attempting to create a post-it notes style program. Most of the many available have way more functions then I want or don't function the way I would like, so I am trying to make my own.
Could someone tell me the basic flow I will need to create in order to do this? I just want a general outline that I could attempt to figure out on my own.
The functionality I am looking for would be a simple text box that sits on your desktop that you could type into. Hitting a button or key combo would then save the note. But to create the next note, I don't want to open a new text box, just continue typyng in the same one but the program would see it as a seperate entity. Maybe each note would have a box around it?
Also, once the box was filled I would need to make scrollbars appear.

So far I have figured out that I need an input box to type into, but am not sure how to save the text so that it will display when I run the program again.

TIA for any suggestions.

Desmond
02-02-2004, 02:54 PM
Hello,

If I understand what you want to do, place the following script in the respective events:

Put this code on the On Shutdown event of your project:


sText = Input.GetText("Input1");
Application.SaveValue("Post-It-Note", "Whatever_Key", sText);


Put this code on the On Startup event of your project:


sText = Application.LoadValue("Post-It-Note", "Whatever_Key");
Input.SetText("Input1", sText);


Hope that helps!

ghobii
02-02-2004, 03:22 PM
That doesn't seem to work for some reason.
Also I noticed that the input box doesn't seem to wrap text so it isn't very useful displaying text.
Could I somehow grab the text from the input box and hit a button to display it in a listbox object?
Is it possible to write to a XML file somehow to save the data?

ghobii
02-03-2004, 12:16 PM
OK,
Here is what I have done so far.
I have an input box where I type my note. I then click a button to send it to a list box. This works just like I want, except...
If the note is too long the listbox doesn't wrap it. I couldn't find any hint of how to do this so as a work around I tried making it work so that if you clicked on a note in the listbox, it would write it to a second input box (the only object I could find that would wrap text). I am trying to do this like this:

listnumber = ListBox.GetSelected("ListBox1");
listxt = ListBox.GetItemText("ListBox1", listnumber);
Input.SetText("Input2", listxt);

But this is not producing any output to the input2.

Any ideas how I can do this, or a better approach over all?

Stefan_M
02-03-2004, 02:10 PM
Hi,

>> If the note is too long the listbox doesn't wrap it. <<
Did you Enable Multiline in the Input Object?

listnumber = ListBox.GetSelected("ListBox1");
listxt = ListBox.GetItemText("ListBox1", listnumber);
Input.SetText("Input2", listxt);

"ListBox.GetSelected" returns a table so you have to use an index
listxt = ListBox.GetItemText("ListBox1", listnumber[1]);





Stefan

ghobii
02-03-2004, 03:55 PM
The multiple lines is on in the input, it just doesn't transfer that way to the list.
The change you suggested in grabbing the list item contents worked. Thanks.
The next problem is, how do I save the list items to read back in when I launch the program again?

Stefan_M
02-03-2004, 04:21 PM
One way to save the info is to work with files.



Stefan

ghobii
02-03-2004, 05:11 PM
That looks like it will do the trick. And much simpler too.
That probably took you all of 5 minutes to put together too I bet. After I have struggled for hours trying to do it.
Oh Well, I learned alot anthat was the intent.
Thanks for all your help!

ghobii
02-04-2004, 09:30 AM
One more thing...
How could I delete a note as well as the txt file that stores it's content.?
This would allow titles that reflected the contents, rather then just reusing note_001, note_002....
And how could you make it work by pressing the "delete" key?

ghobii
02-04-2004, 09:56 AM
Nevermind, I figured it out.
Holy crap, I actually figured it out!