Sv: Default methods

Daniel Sananes daniel.s at kopparbergs.se
Tue Mar 7 16:27:28 UTC 2023


Great answer Doug.
Thanks.

Daniel

-----Ursprungligt meddelande-----
Från: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> För Doug Easterbrook via omnisdev-en
Skickat: den 7 mars 2023 17:14
Till: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Kopia: Doug Easterbrook <doug at artsman.com>
Ämne: Re: Default methods

the dark red/brown methods are BUILT IN methods.  you’ll see them in table classes and window classes .

for example, both of them have a $destruct in red/brown.  That means omnis will do the default behaviour and its usually ok.


$canclose exmaple

in a window class, there is a $canclose that is red/brown.   that returns true, if the window can close, false if it cannot.

How do I know that?  I had to ask.    but you can click on a window in your omnis browser and use the INTERFACE MANAGER.   if you do that and click on methods and scroll down, you’ll see a two column list

method.                Properties
$canclose             [bquit=kfalse]


it means , you can Override $canclose in your window and as long as you return ktrue or kfalse at the end, then omnis will either close the window, or not.


so what might you put in $canclose()

anything.

you could put code in there that tests the validity of a data record and if the data is not right, then you could return $canclose as false.   I”m not saying this is a good use of it, but in the case of a password window, maybe it its.


eg, overriding $canclose()

if len(iPassword)=0
  display a message ‘password is required’
  quit method kfalse
end if

quit method ktrue


in the above example, the window will not close if there is no password suppled becaues we quit false.




— in table classes, there are a lot of thins like $insert, $update, $delete, $dowork and the INTERFACE MANAGER should tell you what the parameters are.   if you feel brave, over ride the red/brown method and but a breakpoint in there … and you’ll. see when it happens.


hope that gives a general idea.




NOTE:   most times, I never touch the red/brown methods.   Occasionally, I’ve overridden them because I prefer my behaviour over omnis’s default behaviour.   In the case of the postgres dam, I’ve over ridden $update because I can shorten the standard omnis sql (which is fine) …. but I want it shorter and I want to update against views, neither of which omnis can do.


that means:  only change the behaviour of the red/brown methods if you don’t like what omnis is doing, otherwise, don’t bother.




Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
http://www.artsman.com
Phone (403) 650-1978

> On Mar 7, 2023, at 7:55 AM, Daniel Sananes <daniel.s at kopparbergs.se> wrote:
>
> Hi
>
> With default methods I mean the methods in table-class with darkredbrown colour.
> When clicking on one of those, no method lines are shown.
> Can one see what is there?
>
> /Daniel
> 0736 704070
>
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com Start a 
> new message -> mailto:omnisdev-en at lists.omnis-dev.com

_____________________________________________________________
Manage your list subscriptions at https://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
VARNING: Det här e-postmeddelandet kommer från en extern avsändare. KLICKA INTE på länkar eller bilagor om du inte känner igen avsändaren och vet att innehållet är säkert.


More information about the omnisdev-en mailing list