Register to post in forums, or Log in to your existing account
 

This forum is locked: you cannot post, reply to, or edit topics.  This topic is locked: you cannot edit posts or make replies.     Home » Forums » General zApp Discussion
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Apr 13, 2005 12:09 am   

Build 2.2.0.35 posted
 
I've posted another new version today. This version has all of the new properties and methods for the zMemo component.

Lots of stuff was added to zMemo to allow you to manipulate the rich text stored in the control. A full set of Text Styles and Paragraph Styles can be used.

Also, I fixed the problems with newlines in text of the Add method, and added the new AddLine method for adding a line to the end of the control and making that line visible (like for appending to log files).

You can't yet manipulate tables (via a script) stored in the memo yet. I'll add routines for that in the future. You can still add and modify tables interactively. I just need to dig into the guts of the code and find out how tables are stored to let you manipulate them directly from a script.

Oh yeah, it's all documented too :)

Have fun!
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 867
Location: USA

PostPosted: Wed Apr 13, 2005 4:01 am   Re: Build 2.2.0.35 posted
 
Zugg wrote:

I've posted another new version today. This version has all of the new properties and methods for the zMemo component.


Wow! I was watching the documentation appear today and was about to post asking when it would be done.

The syntax seems a little different than what I'm used to for typical ActiveX controls (particularly stuff like the many Goto... methods instead of a single SetLocation property or method) but don't take that as a complaint because the way it is might be more intuitive for someone poking their nose into a script for the first time.

Playtime now, I'll post if I find any problems.

Edit: looks like the install is basically ok. I haven't tried too many properties yet, but a basic scrolling display seems fine. Hopefully more people will be trying it out now that theres a good multiline text control and a good grid.

-Tarn
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Apr 13, 2005 5:41 am   
 
If you have any suggestions for making the syntax closer to stuff people are familiar with, let me know.

There isn't a method that sets the X,Y location because with the complex items that the component can contain, the X,Y position doesn't actually make any sense. For example, imagine an HTML page with various graphic elements embedded in it, and fonts of various sizes. What measurement would you use for rows and columns? There isn't any way to measure that with a non-grid text component.

So, in the zMemo, you can set Bookmarks, and goto specific locations of specific items. You can attempt to return a CurLine or CurCol X,Y position, but it can be slow to compute and doesn't mean much when using a complex layout as mentioned above.

I have no idea how other rich text controls work. I always hated the rich text control in Windows itself because it was such a pain to control various text attributes. I think the methods and properties in the zMemo control better reflect the type of operation you want to perform (like setting the Bold property, or Color property).

But it's very possible that I've forgotten some important properties or methods, so feedback is definitely welcome!
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 867
Location: USA

PostPosted: Wed Apr 13, 2005 6:29 am   
 
Sorry for the rambling- see if it makes any sense to you.

Quote:

If you have any suggestions for making the syntax closer to stuff people are familiar with, let me know.


Well, to continue my previous example, most multiline textboxes I've seen would have, instead of GotoStart, GotoEnd, GotoBookMark, GotoItem, GotoItemEnd, SelectWord, SelectLine, SelectItem, and maybe a few others, only the two properties SelectionStartPosition and SelectionLength (maybe with a couple of helper properties to find things like wordlength).

The equivalent of .GotoStart would be .SelectionStartPosition = 0 (or 1, depending on audience). To select a word, you'd set the start position to the beginning and then either work out the length of the word yourself or perhaps get help from the control but still set the length of selection yourself.

That's kind of a stylistic question of whether you want to have a lot of very simple functions that do most of what people want, or fewer, more complex methods. I think that experienced coders would usually prefer fewer, more complex methods (less clutter in places like the top level method list for the memo control, and fewer class methods makes Autocompletion/dropdown method lists while entering code MUCH more useful). Because they're going to code using a particular tool for lots of hours they're willing to invest a few minutes learning how the key methods work. A beginning scripter might rather just look through the list and find exactly what he wants ("Aha! .GotoStart" versus "Hmm, I don't actually want to select anything, I just want to move the cursor to the beginning. Is that the same as selecting a 0 length starting with the first letter? And I keep putting 1 for the start, so why does it go to the second character?").

For an environment like zApp, I'd probably rather make life easier for the end user- isn't that the whole point? So that's why I said my comment wasn't a complaint. I'm just kind of curious about what direction you're going.

Quote:

You can attempt to return a CurLine or CurCol X,Y position, but it can be slow to compute and doesn't mean much when using a complex layout as mentioned above.


I don't usually need to do that- for someone who needs to move to X,Y positions, it's easy enough to track line lengths outside the control as you feed the text into it, as long as the control can tell you what character you're on.

-Tarn
Reply with quote
kawawong
Beginner


Joined: 24 Mar 2005
Posts: 16

PostPosted: Wed Apr 13, 2005 7:39 am   
 
Question Some syntax question of the zMemo Editor example

Code:
sub Global_OnFileChange( Sender, Param)
 if not(IsNull(Param.Editor)) and not(IsNull(Param.Editor.Tab)) then
   Param.Editor.Tab.Caption = Param.Filename
   Param.Editor.Tab.Color = "Window"
 end if 
end sub


I guess it is vbscript stuff. Embarassed Where can I have more information on the usage of OnFileChange? Any other similar events? Thanks.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Apr 13, 2005 3:34 pm   
 
Kawawong: There are several "events" in zApp and I haven't documented any events yet. It's actually zApp stuff, not VBscript stuff, so it's not surprising that you'd be confused. I hope to have events documented later this week.

Tarn: The more I thought about it last night, the more I completely agree. Of course I've dealt with the concept of SelStart and SelLength before. That's what all normal Windows edit boxes use. Sometimes it can be a pain (does a newline take up 1 character or 2?), but programmers are used to it.

The TRichView component I'm using doesn't implement the normal SelStart and SelLength properties. Everything internally is kept as a reference to an "item" in the component (an item number and an offset within an item). So when I was exposing properties and methods yesterday, I was pretty much sticking to what they already implemented.

But I thought of a trick that would allow something like the SelStart concept and I'm going to mess with it today and see what I can come up with.

Stuff like the SelectWord and SelectLine will probably still remain, however, since it never hurts to have more than one way to do something (concept borrowed from zMUD). And I've always found doing a SelectWord myself to be tedious, so I think it's a good help for making programming easier (which is what zApp is all about).

Bookmarks are also a different concept. Bookmarks are like "named locations" but the advantage of a bookmark is that they are tied to the text itself rather than just being a floating location. For example, if you set a bookmark called "Test" and then add the text "This is a test", then sometime later you insert a whole bunch of stuff before this text, the bookmark will still point to "This is a test" even after the insertion. This is a really cool feature that normal text controls don't have. So you can't just implement Bookmarks with a simple "SetLocation" type of functionality...you'd end up having to track all insertion and deletion before the location to keep it in synch with the text it it pointing to.

The trickiest part to handling the "SetLocation" functionality is that not every item in the component is necessarily text. For example, I think a picture has a "size" of a single character. And I'm not sure what they do for tables. So, the stuff I implement might work for normal text, but might have problems for more complex contents. But I'm going to play with it and see what I can do.

Stay tuned.
Reply with quote
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Home » Forums » General zApp Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
© 2009 Zugg Software. Hosted on Wolfpaw.net