On 24-Apr-07, at 9:14 AM, Sven E Olsson wrote:
>
> On 2007-04-24, at 16:55, Norman Palardy wrote:
>
>>
>> On 24-Apr-07, at 8:37 AM, Sven E Olsson wrote:
>>
>>>
>>> Just a note you can't even do this inside a function
>>>
>>>
>>> if prefs.Wordwrap = true then
>>> dim w as TextWndNoscroll
>>> w = new TextWndNoScroll
>>> else
>>> dim w as TextWndHscroll
>>> w = new TextWndHscroll
>>> end if
>>>
>>> w.title = "index.html"
>>> w.document = f
>>> w.EditFiled1.text = "hello"
>>> ------------------------
>>>
>>> You have to write the code twice, because the dim statement is
>>> inside
>>> a block.
>>
>> Do TextWndNoscroll and TextWndHscroll share a common root class ?
>
> Nope, there is no classes.
>
> The code above with the dim statement inside a block, is a small
> issue (just make the block bigger and write some code twice).. The
> problem is that my app (As an XHTML Tools) insert text, grab text,
> using regex find and replace, checking css classes, checking text
> encodings in the file and set proprties to the window.... And today
> it is doing this like this: TextWindow(window
> (i)).DoSomethingOrSetSomething ....
>
>
> And then I need to:
>
> if Prefs.WordWrap = true then
> TextWNoscroll(window(i)).DoSomethingOrSetSomething ....
> else
> TextWHscroll(window(i)).DoSomethingOrSetSomething ....
> end if
>
>
> Or write getters and setters in a module, but I think the code would
> be the about the same, I only get one place (module) to muck with it..
>
>
> I just do a test for fun, and change the name of my TextWindow ...
> more than 800 errors
Sounds like one approach would be to pull out a common Interface and
then you have two windows that implement that interface
Then you can have an instance of a window and you code looks like
TextWindowInterface(window(i)).DoSomethingOrSetSomething ....
and your windows "do the right thing"
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>