Hi Arnaud, the List,

thank you for your kind answer.

>Arnaud Nicolet wrote some times ago:
>
>Strange, it didn't crash here (same version). Are you using Win32?

It crashed on Macintosh, but I use all three platforms: Linux, Macintosh, 
Windows XP. Of course, now, I do not remember what happens then (I have an 
indexing trouble with my built-in memory).


>You also posted some code:
>
>   // Toogle the focus ring
>   Dim theCanvas As Canvas
>
>   // Compute if the Focus is set to a Canvas
>   If Self.Focus IsA Canvas Then
>     // Cast Canvas Control who have the Focus
>     theCanvas = Canvas(Self.Focus)
>
>     If theCanvas = Me Then
>       // Ask the Window to clear the focus
>       ClearFocus
>     End If
>
>   Else
>     // Ask the Canvas to set the focus
>     Me.SetFocus
>
>   End If
>
>You may use a variable of type RectControl to avoid calling  
>Self.Focus more than once, since you know the focus does not change  
>inside your method.

Calling once Self.Focus and a second time RectControl ?
Where is the gain ? [the code will be darker than calling Self.Focus with IsA 
and then Cast it.]


>>> To clears the Focus from the Canvas, I have to use a Window command  
>>> - ClearFocus - and to set the Focus to the canvas, I have to use a  
>>> Canvas command - Me.SetFocus - ; where the code consistency?.
>
>You learnt german, right? (every noun starting with a capital  
>letter)  ;-) 

No, we speak French at home and I learn English at school (then music, comics, 
tourists, computing). The only German I know was by meeting (in shops) German 
tourists ;)

Also, US people use an upper character at the start of each songs in the music 
industry - and some french people do the same for french titles!).


And the reason why I was highlighting that is because it is more readable to 
have an uppercase at the beginning of a new part of a command: 'showwindow' and 
'ShowWindow'; 'nilobjectexception' and 'NilObjectException'.


But this is just me and I only ask that in the software ad in its 
documentation. Everyone (else) is free to code at will using lowercase, 
UPPERCASE or TitleCase... and even a mix of these ;)


>It may not be inconsistent. Each class is dealing at its level.

Have a look at the REALbasic 'Preferences', 'Code Editor', the 'Autocomplete 
apply standard case' CheckBox.

Also, read the Language Reference for REALbasic 1.0 (and some following 
revisions).

Of course one who comes from java will have the habit to write showWindow (as 
an example).


Another surprising habit is the one to add a space after the open parenthesis 
character ['( '] and one before the close parenthesis character [' )'].


I even saw some people who never use computer when they only have UpperCase 
characters typing using UpperCase characters only; I saw also - but this is a 
different matter - some French people writting prices as: 1,000.55€ where the 
French real use is 1 000,55 €!


>Could you imagine a RectControl with a ClearFocus method to clear the  
>focus of the window? Does not make sense. Maybe adding a  
>RemoveFocusFromMe would make sense, but the concept of removing the  
>focus of ANY control that has it would break.


No, I do not imagine that. I think at RectControl.ClearFocus. No, it will not 
break if written correctly. [1]


>For setting the focus, using self.SetFocus(MyControl) is a bit odd.  
>Also, from the API, the focus is set from the control (it's it that  
>has the Focus property and, therefore, a way to grab the focus).
>
>So I don't see how you would like to see a more consistent way to  
>remove/set the focus.


Very simple, stay with the actual SetFocus and add a ClearFocus like in [1]:

EditField1.SetFocus
EditField1.ClearFocus

The first set the focus to EditField1 and naturally, the second clears the 
focus from EditField1. And do not remove the Window Class' ClearFocus because 
it make sense too (it have it use too).

Don't you use a key to Power On / Power Off your car ? It would be surprising 
to have one key for the Power On process and a second one to Power Off the 
engine! (Yes, there is an alternate - but not hallal - method to Power Off the 
car engine...)


Thank you for reading,

Emile



[1] Get an eye in Window.DropOpject and <Control>.DropObject events: the former 
is coded 'AcceptFileDrop("text")' and the later: 'Me.AcceptFileDrop("text")'.


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

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to