Discussion:
Is it a normal behavior?
Vincent Kroll
2006-05-10 15:35:54 UTC
Permalink
Hi,
two little questions.
In a small test project I've placed a listbox class, which contains
two properties: MyBool As Boolean and myColor As Color.
Both were added to window behavior, so I'm able to set their values
in the ide. I've added a method called TestMyBool for testing MyBool
to this class too:

Sub TestMyBool()
If MyBool Then MsgBox "Is True"
End Sub

I've added this listbox class to the window in my project, so I've a
listbox in my window. This window contains a push button and this
code in its action event:

Sub Action()
myListbox1.TestMyBool()
End Sub

(I) Now I'm setting MyBool as protected or private. In both cases I'm
able to change the value of MyBool to true in the ide. But if I press
my push button no message appears (a message should appear, if MyBool
is true).
Well, if MyBool is neither protected nor private, I will got my
message, if MyBool is true.

(II) In the ide I'm setting myColor to a color value (not black and
myColor isn't protected or private). I'm seeing the selected color
and its value &cxxxxxx in the behavior of the property list. Now I'm
saving the project after the changes made. I reopen my project and
watch to the behavior of my listbox, and, surprise, myColor is shown
black and its value is &c000000. But, if I'm checking the value of
myColor in code, I will got my value I've set before in the ide.

Is the first a normal behavior (in RB2006R1 I couldn't observe this
behavior)? I think the second will be a bug?

--
vincent
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Maarten de Vries
2006-05-14 08:59:48 UTC
Permalink
Hi,
The second one does sound like a bug, but the first is normal. Protected or
Private means that you can only acces the property from inside. Not just
only writing from inside... If you want to make that sort of behavior do
this:
Add a private property called "StoreMyBool" and a public computed property
called "MyBool". Leave the set method empty and in the get method put
"Return StoreMyBool".

Now, from inside the listbox you can set the bool by changing StoreMyBool,
and you can request the value from anywhere using MyBool.
Post by Vincent Kroll
Hi,
two little questions.
In a small test project I've placed a listbox class, which contains
two properties: MyBool As Boolean and myColor As Color.
Both were added to window behavior, so I'm able to set their values
in the ide. I've added a method called TestMyBool for testing MyBool
Sub TestMyBool()
If MyBool Then MsgBox "Is True"
End Sub
I've added this listbox class to the window in my project, so I've a
listbox in my window. This window contains a push button and this
Sub Action()
myListbox1.TestMyBool()
End Sub
(I) Now I'm setting MyBool as protected or private. In both cases I'm
able to change the value of MyBool to true in the ide. But if I press
my push button no message appears (a message should appear, if MyBool
is true).
Well, if MyBool is neither protected nor private, I will got my
message, if MyBool is true.
(II) In the ide I'm setting myColor to a color value (not black and
myColor isn't protected or private). I'm seeing the selected color
and its value &cxxxxxx in the behavior of the property list. Now I'm
saving the project after the changes made. I reopen my project and
watch to the behavior of my listbox, and, surprise, myColor is shown
black and its value is &c000000. But, if I'm checking the value of
myColor in code, I will got my value I've set before in the ide.
Is the first a normal behavior (in RB2006R1 I couldn't observe this
behavior)? I think the second will be a bug?
--
vincent
_______________________________________________
<http://www.realsoftware.com/support/listmanager/>
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Vincent Kroll
2006-05-14 14:33:29 UTC
Permalink
Hi,
Post by Maarten de Vries
The second one does sound like a bug, but the first is normal.
I'll file the second one to the REALBasic feedback system, if it's
not filed yet ...
Post by Maarten de Vries
Protected or
Private means that you can only acces the property from inside. Not just
only writing from inside...
OK ...
Post by Maarten de Vries
If you want to make that sort of behavior do
Add a private property called "StoreMyBool" and a public computed property
called "MyBool". Leave the set method empty and in the get method put
"Return StoreMyBool".
Now, from inside the listbox you can set the bool by changing
StoreMyBool,
and you can request the value from anywhere using MyBool.
Thanks a lot for this solution. I'll try it.

--
Vincent
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Loading...