On 2007-04-24, at 16:42, Bart Pietercil wrote:
>
> On 24-apr-07, at 16:28, Sven E Olsson wrote:
>
>>
>>
>>>>
>>>> I can't create a global array using code, I wanted to do something
>>>> like this, instead it looks like that i need properties and code
>>>> for
>>>> every window.
>>>>
>>>> if prefs.WordWrap = true then
>>>> dim Global OpnW() as TextWNoscroll
>>>> else
>>>> dim Global OpnW() as TextWHscroll
>>>> end if
>>>
>>> Is that some new kind of syntax for RB 200x?
>> I never said that, I write "wanted to do"
>>
>>> I've never declared a
>>> global variable that way in RB.
>>
>> That do not work.
>>> If I understand what you're looking
>>> for, you should be able to get the same effect by declaring a
>>> property
>>> that's an array of your window in a module, and making sure to set
>>> its
>>> scope as Global.
>>
>>
>> Yes I can declare a property in a module that is an array (of one
>> window type) of an window
>>
>> But the problem is to declare an array, depending on some preferences
>> settings.
>>
>> How do I declare the Array "OpenW" to be an array of TextWnoscroll or
>> TextWHscroll, depending on a preference variable?
>> As I can se it is impossible.
>>
>> The same is with windows, I cant declare a global variable "w" as
>> TextWndNoscroll or TextWHscroll, depending on a prefs variable.
>
> I have been able to resolve this kind of problem ( if I understand
> your problem correctly) by using arrays of type dictionary
>
> Dim myEditFields() as Dictionary
> Dim aDict as new Dictionary
>
> if prefs.WordWrap then
> aDict.Value("TextWNoScroll") = ThisEditfield
>
> else
> aDict.Value("TextWHScroll") = ThisEditfield
> end if
>
> myEditFields.Append(aDict)
>
> of course you can add all sorts of properties to the dictionaries if
> you need more control
>
> just my 2 eurocents
>
> HTH
>
> Bart
>
>
>
Perhaps something to take a look at...
Just in time i have skipped the idea of two Editfields on one window,
because some issues with a splitter.
So today I have done some test with two windows, and found it could
possible if I write a lot of getter and setter methods, where i check
what window is used (TextWnoScroll or TextWHscroll) and then what
window is the frontmost, but this meant it is a lot of code to
rewrite ...
That was in this case I wanted to do an easy dim statement to declare
a global, and then just used that when i set or get values from the
window and the editfield.
Sven E
-----------------------
REALbasic 2007R1 OS X 10.4.8 Intel and 10.4.6 PPC
SEEdit Maxi THE XHTML EDITOR FOR MACINTOSH
http://www.seedit.info
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>