Hi Justin,
Just to let you know, that SET TIMER() trick just came in handy in another
situation.
There is a weird thing that in the Form's on Load event,
LISTBOX SORT COLUMNS(*;$LB_Name;$ColSortBy;<) // this is doing a reverse sort
on the sort column
would not sort the records in reverse, but the listbox header would give the
impression that it was.
I was at a loss on how to force it to work.
What I did is add this line to the last line of the Form Method’s on Load
Event:
SET TIMER(-1) // we need to do the LB_SORT and it won't do a reverse sort at
this point. So we cause a "on Timer" event and let the LB_SORT() happen then.
Then I set the ‘on Timer’ event to work for this form,
Then added this to the Form Method
: (Form event=On Timer)
LB_SORT ("LB_Browser")
SET TIMER(0) // reset so it stops
——
now the sort gets performed prior to the browser form being displayed.
Thanks!
— Chris
> On Apr 24, 2019, at 10:15 PM, Chris Belanger <[email protected]> wrote:
>
> Hi Justin,
>
> Thanks for the observations. I never thought about using a SET TIMER(-1) to
> make something run immediately after On Load is done. It is true that many
> objects are not ‘existent’ by the On Load cycle and that causes me some
> problems in trying to make code that is as generic as possible.
>
> I am going to try employing some of the functionality you describe.
>
> Regarding ’new formula’, just to let you know how I have been using it, I
> ‘install’ a Form.onSave, Form.onLoad, Form.onNew group of formulas
> i.e. Form.onLoad:=new formula( ) or := new formula from string( )
> in conjunction with some other Form. objects, I can have a generic
> mechanism for new / save/ load of records, with the specialized ’nub’ being
> executed in the appropriate formula.
>
> I have been absolutely enthralled with the new focus of 4D on ORDA and
> object-oriented programming.
> It is exciting to see how they are expanding this to other areas of the
> language.
> I find that the code is greatly simplified and concise.
>
>
> — Chris
>
>> On Apr 23, 2019, at 5:20 PM, Justin Carr via 4D_Tech <[email protected]>
>> wrote:
>>
>> Hi Chris
>>
>> We use SET TIMER(-1) a lot for this purpose. It is ideal when you want to do
>> something as part of On Load but you need the On Load execution cycle to
>> finish first before you do the next thing, e.g. you need to know the size
>> and position of an object on a form before you take some other action.
>>
>> POST OUTSIDE CALL can also be used for this purpose, particularly if you're
>> sending the event from another process. CALL FORM is the the "new way" to do
>> this sort of thing but you have to be aware that it does not always run in
>> its own execution cycle, i.e. you can't rely on it to perform the sort of On
>> Load workflow I just described because the chances are it will run in the
>> same exection cycle as the original On Load. Even when the CALL FORM is made
>> from a separate process it won't necessarily run in its own execution cycle.
>> That said, if I'm not relying on some previous execution cycle to have
>> finished and want to "send an event" to the form then CALL FORM is
>> definitely the way to go.
>>
>> I haven't tried New formula yet so can't comment on that.
>>
>> cheers
>> J
>>
>>> On 24 Apr 2019, at 1:24 am, Chris Belanger via 4D_Tech
>>> <[email protected]> wrote:
>>>
>>> Douglas, that is an ingenious way to facilitate it. I suppose one could use
>>> a Form object (Form.myEvent) to specify the ‘event’ to perform.
>>> But it seems that SET TIMER(-1) is what needs to be done [trigger as soon
>>> as possible] and then SET TIMER(0) disables the triggering?
>>>
>>> — Chris
>>>
>>>> On Apr 23, 2019, at 9:19 AM, Douglas von Roeder via 4D_Tech
>>>> <[email protected]> wrote:
>>>>
>>>> Chris:
>>>>
>>>> Set timer (0) and then catch it in On timer.
>>>>
>>>> --
>>>> Douglas von Roeder
>>>> 949-336-2902
>>>>
>>>>
>>>> On Tue, Apr 23, 2019 at 8:17 AM Chris Belanger via 4D_Tech <
>>>> [email protected]> wrote:
>>>>
>>>>> I have been using New formula too.
>>>>> In the context of ORDA-based forms, I have set up Form.onSave(),
>>>>> Form.onLoad(), Form.onNew() etc. I like it because the code for record
>>>>> selection and change can be generic with these ’nubs’.
>>>>> I wish that one did not have to create a project method [for other than
>>>>> the most rudimentary use] to use ’New Formula’, but still it is a great
>>>>> new
>>>>> feature.
>>>>>
>>>>> In any case, back to my question about form events. Is the only mechanism
>>>>> to do an ‘Outside Call’ with POST OUTSIDE CALL? What have you found that
>>>>> works, if anything.
>>>>>
>>>>>
>>>>>> On Apr 23, 2019, at 9:05 AM, Keisuke Miyako via 4D_Tech <
>>>>> [email protected]> wrote:
>>>>>>
>>>>>> I think the future is to use New formula.
>>>>>>
>>>>>> it is like a function pointer in other languages,
>>>>>> it allows the callee to invoke a callback function at a later time.
>>>>>>
>>>>>> https://blog.4d.com/new-formula-more-power-behind-simplicity/
>>>>>>
>>>>>> alternatively, one could say that CALL FORM is like a custom form event.
>>>>>>
>>>>>> regarding subforms,
>>>>>> CALL SUBFORM CONTAINER can only convert an event in the subform context
>>>>>> to another event in the host's context,
>>>>>> it does not generate a new event.
>>>>>>
>>>>>> 2019/04/23 23:32、Chris Belanger via 4D_Tech <[email protected]
>>>>> <mailto:[email protected]>>のメール:
>>>>>>
>>>>>> I remember — but cannot find again — some documentation that talked
>>>>> about using negative-numbered values for events to facilitate custom
>>>>> events. However, I seem to remember it only was in the context of
>>>>> subforms.
>>>>>>
>>>>>>
>>>>>>
>>>>>> **********************************************************************
>>>>>> 4D Internet Users Group (4D iNUG)
>>>>>> Archive: http://lists.4d.com/archives.html
>>>>>> Options: https://lists.4d.com/mailman/options/4d_tech
>>>>>> Unsub: mailto:[email protected]
>>>>>> **********************************************************************
>>>>>
>>>>> **********************************************************************
>>>>> 4D Internet Users Group (4D iNUG)
>>>>> Archive: http://lists.4d.com/archives.html
>>>>> Options: https://lists.4d.com/mailman/options/4d_tech
>>>>> Unsub: mailto:[email protected]
>>>>> **********************************************************************
>>>> **********************************************************************
>>>> 4D Internet Users Group (4D iNUG)
>>>> Archive: http://lists.4d.com/archives.html
>>>> Options: https://lists.4d.com/mailman/options/4d_tech
>>>> Unsub: mailto:[email protected]
>>>> **********************************************************************
>>>
>>> **********************************************************************
>>> 4D Internet Users Group (4D iNUG)
>>> Archive: http://lists.4d.com/archives.html
>>> Options: https://lists.4d.com/mailman/options/4d_tech
>>> Unsub: mailto:[email protected]
>>> **********************************************************************
>>
>> **********************************************************************
>> 4D Internet Users Group (4D iNUG)
>> Archive: http://lists.4d.com/archives.html
>> Options: https://lists.4d.com/mailman/options/4d_tech
>> Unsub: mailto:[email protected]
>> **********************************************************************
>
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************