Re: Custom Form Events

2019-05-12 Thread Chris Belanger via 4D_Tech
Hi Kirk,

Here are the links to the images that show what I’ve been working on with 
classes & objects,

https://postimg.cc/gallery/28ujrq1q8/ 

— Chris

> On May 6, 2019, at 10:38 PM, Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Hi Chris,
> I apologize for such a late response. I left on a road trip about the time
> you sent this and frankly forgot to get back to you. Your enthusiasm is
> infectious. And you describe some excellent applications. I haven't played
> with OBJECT SET LIST BY REFERENCE yet... Thank you for the tips.
> 
> And I completely agree about reviewing the whole menus thing. I work on
> some old projects with these insanely complicated schemes for menu bars and
> it is just so much wasted time and effort to accomplish so little. It was
> what was available 25 years ago but jeez I'm glad to be past that.
> 
> I wonder if you would elaborate on how you use [UI_class] and [UI_object]?
> I have played with the concept a little but I fear I am over complicating
> it to no good effect.
> 
> In addition to 4D POP David Adams and Cannon Smith shared some methods for
> creating constants with code. I was a little skeptical at first of this
> approach - writing a method to write an XLFF file for the constants but
> I've come to prefer it. Mainly because in that method I can comment what
> each constant is for. And once you do a couple of them it's quite easy.
> 
> In v15 I came to rely on constants for object property names. Just a great
> way to deal with the need for consistency. With native dot notation you can
> use them with [[brackets]] but I'm not as big a fan. On the other hand
> without them there is a real issue about ever changing a property name. Or
> a field name.
> 
> Of late I'm mucking around in v15. Looking forward to spending more time
> again in v17r5.
> -- 
> Kirk Brooks
> San Francisco, CA
> ===
> 
> What can be said, can be said clearly,
> and what you can’t say, you should shut up about
> 
> *Wittgenstein and the Computer *
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Custom Form Events

2019-05-10 Thread Chris Belanger via 4D_Tech
Hi Kirk,

Thanks for your input, too.
I can explain what I have done to this point with my [UIClass] & [UIObjects] 
tables.
Everything is done using ORDA. All the ‘variables’ are Form objects  (i.e. 
‘Form.curClassEdit.Note’ type things).

Unfortunately, iNUG still does not support anything other than plain text, so I 
can’t bold anything or include any snapshots … : (

The purpose is to create objects for  Storage.  that will provide information 
for the system or UI-related objects, such as menus, choiceLists, etc.
I am also using it to create one-time objects that formerly I would have 
created as a table with one record: for example “COMPANY” or “SETTINGS” - type 
stuff.
I am also creating ‘USER’ objects that have the login information for users and 
the PRIVILEGES they get.
• thereafter, everywhere you see the attribute ‘Privilege’ is intended to allow 
a particular thing NOT to be made available to the current user.
So, for instance, not every MENU or MENU ITEM should be available to every 
user; When the user logs in, a project method will configure the menu bar with 
respect for the privilege they have. The same is true for CHOICE-LISTS, and 
other things (anything I want to control).
It is also going to be used for trivial things that formerly would have 
required a specialized table [see ‘city’ below]

DATA STRUCTURE
UICLass  — ID, Name, Note, InitMethod, storagePath [in Storage., for 
instantiation], Seq (of initialization), Attrs {Object field}
UIObjects — ID, Name, Class, Note, Seq (of initialization, important for 
lists), obj (attributes).  I just added an ‘Owner’ field so I can have objects 
contain objects. (Parent/Child). I am going to use this when I define  ‘dClass’ 
and ‘dAttr’ — which will have the data classes [Tables] / attributes [Fields]. 
This way I can define things about the field such as a LABEL, displayFilter, 
entryFilter, choiceList, etc. to simplify standardization.

CLASS / OBJECT MANAGEMENT — ‘UI Design'
I have a form called ‘UI Design’. On the left-hand column there are my CLASSES 
in a listbox. 
• When I highlight one of the CLASSES, then the setup for the class gets loaded 
immediately to the right, so it can be edited.
I discovered a problem with relying solely on 4D’s listBox property: Current 
Item. That is, when you need to create a NEW record but don’t want it 
automatically added until you SAVE it. So I actually don’t strictly use that 
method. Anyway…
• there is a TAB CONTROL that I can use to toggle between DEFINITION and 
OBJECTS. So when I want to work on defining classes, I am in DEFINITION. When I 
want to manage specific objects in a CLASS, I go to OBJECTS.

In the OBJECTS (form page 2) is an included layout with the personalized EDITOR 
for the appropriately-chosen class; they always list all the OBJECTS of that 
class in a listbox on the left. I have made EDITORs for any class that I want 
to store into objects   [UIObjects].

DEFINING A CLASS
Once a CLASS is loaded (selected, or NEW), I can specify what attributes to 
define for this class. [This is done in a listbox].
So as an example, I have classes such as these:

sysMenu • menuRef (assigned by system); 
• Name; 
• privilege; 
• itemList (collection of menuItems objects); level 
(main or sub)
menuItem• itemName;
• subMenu; 
• privilege; 
• method; 
• parameter; 
• action (standard action); 
• checkmark; 
• isNewProcess;   
• shortcut; 
• various booleans for shortcut stuff (shift/alt), 
booleans for bold/italic/underline. etc. 
Basically, all the characteristics 4D supports 
for menu Items

So a sysMenu has a collection of menuItem. 
Then I also have a specially-made sysMenu definer that is used to GUI - design 
the system menu [include for that show in the OBJECTS tab]
In this iteration, the ‘menuItem’ class is more of a template that is used when 
making the   itemListcollection (an attribute of sysMenu); I don’t store 
separate ‘objects’ for each menuItem.
The definer also shows the menu ‘real-time’ to confirm how it is set up. It 
could even be capable of performing the method / standard action if one wanted 
to test that too.
• the end result is that:
• I define the menus for my project; sequence them (left->right); PRIVILEGE is 
assigned at menu and item levels;
• when the user LOGS IN, the menu objects are processed and 4D MENUS are 
created in Storage.sysMenus [ ]  for my use! including  
Storage.sysMenus.menuBar, which is the menu used as the ‘menuBar’ by 4D.

For choice lists (static text):
choiceList  • listRef (becomes listRef, assigned by 4D); 
• name;  
• itemList (collection of listItems)
listItem   

Re: Custom Form Events

2019-05-06 Thread Kirk Brooks via 4D_Tech
Hi Chris,
I apologize for such a late response. I left on a road trip about the time
you sent this and frankly forgot to get back to you. Your enthusiasm is
infectious. And you describe some excellent applications. I haven't played
with OBJECT SET LIST BY REFERENCE yet... Thank you for the tips.

And I completely agree about reviewing the whole menus thing. I work on
some old projects with these insanely complicated schemes for menu bars and
it is just so much wasted time and effort to accomplish so little. It was
what was available 25 years ago but jeez I'm glad to be past that.

I wonder if you would elaborate on how you use [UI_class] and [UI_object]?
I have played with the concept a little but I fear I am over complicating
it to no good effect.

In addition to 4D POP David Adams and Cannon Smith shared some methods for
creating constants with code. I was a little skeptical at first of this
approach - writing a method to write an XLFF file for the constants but
I've come to prefer it. Mainly because in that method I can comment what
each constant is for. And once you do a couple of them it's quite easy.

In v15 I came to rely on constants for object property names. Just a great
way to deal with the need for consistency. With native dot notation you can
use them with [[brackets]] but I'm not as big a fan. On the other hand
without them there is a real issue about ever changing a property name. Or
a field name.

Of late I'm mucking around in v15. Looking forward to spending more time
again in v17r5.
-- 
Kirk Brooks
San Francisco, CA
===

What can be said, can be said clearly,
and what you can’t say, you should shut up about

*Wittgenstein and the Computer *
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Custom Form Events

2019-05-06 Thread Chris Belanger via 4D_Tech
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  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 <4d_tech@lists.4d.com> 
>> 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 
>>> <4d_tech@lists.4d.com> 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 
 <4d_tech@lists.4d.com> 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 <
 4d_tech@lists.4d.com> 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 <
> 4d_tech@lists.4d.com> wrote:
>> 
>> I think the future is to use New formula.
>> 
>> it is like a function pointer in other languages,
>> it allows the callee t

Re: Custom Form Events

2019-04-25 Thread Chris Belanger via 4D_Tech
Greetings Kirk,
I have been programming in 4D since version 2 back in the early 1990’s. Though 
v14 was possibly going to become the end of my ‘career’ with 4D. And then v17 
came out with ORDA. I love it.
I have a fresh enthusiasm for 4D again.
I am using 4D v17r4; getting right up-to-speed on orda and the use of objects 
and . notation. Programming is so exciting now with 4D. Can’t wait for all the 
new features coming up and love the ’scaled’ approach of 4D now.

I have been exploring the features you referred to and appreciate the methods 
you discussed, including the use of a ‘form controller’ method.

I love the new DIALOG ( form object) approach and agree with your suggestions. 
It makes everything so much simpler. I am trying to progressively get a 
collection of useful forms of that nature.

Regarding Classic; I am trying to divest myself of all need to use it. For the 
very reasons you express too. In fact, my current 2 projects I have made the 
design decision to ’throw out’ all the classic coding I formerly used and make 
a new development methodology solidly founded on the new 4D features, including 
ORDA.

I am simultaneously **finally** working on also making a component at the same 
time to store code I will want to use in new projects. 
And I finally found out how to make CONSTANTS with 4D POP; something I should 
have done a long time ago instead of using <>Constant approach.

INTERPROCESS VARIABLES? Turfing them.
Storage. ? putting key data into that instead using interprocess vars.

Process variables? Form. object is where it’s at now. That is probably my 
favorite new feature: Form.[objects] is a game-changer for me. It makes 
everything so much simpler. I tie everything into that object now. I don’t have 
a single process variable in my new projects.

Objects? I created a ‘class definition’ -> ‘object creation’ form {called UI 
DESIGNER} by which I can define new CLASSes and then create OBJECTS based on 
those classes. I find this helpful in may aspects: I can set up static and 
dynamic choiceLists and pop menus and system menus; they are PRIVILEGE-enabled 
in that I can specify what privilege a user must have to see/use the object, 
etc..
I set up a class type I call ‘ordaList’ that I use to specify the data class, 
selection method, ordering, etc. for what becomes a hierarchical list 
maintained within STORAGE.
I have another CLASS for sysMenu that replaces the menu editor in 4D; and a 
number of other UI - related classes.

I managed to do this with two tables: [UIClass] and [UIObjects]. 

Menus? These are now going to be ‘OBJECTS’ defined through the above mechanism, 
and I will not use any MENU BAR( ) code again. I found that SET MENU BAR( ) had 
been very buggy anyway.

SubForms? I avoided these for years; but now I am getting into them. My UI 
DESIGNER makes excellent use of subforms now. I really need to get to 
understand their proper use.

I experimented with DYNAMIC FORMS: it was pretty neat how in one of my ‘old’ 
CLASSIC-based programs, I mocked up a form by which I could select a ‘Classic’ 
form (from a listbox of them) and poof! Instantly it was recreated in a subform 
using a dynamic form. It will take me a while to fully grasp how to use these 
most effectively.

Using OBJECTS to exchange data is an excellent option; I wish all 4D commands 
supported that (and that the ones that use ARRAYS would also use COLLECTIONS 
instead). But that is probably coming.

the For each … end For Each is awesome; I love   split string( ). 

it is exciting to come across someone else who is embracing the new programming 
techniques and from whom I could learn a lot. Thank you for sharing your tips.

I am actually currently trying to make a design decision on how to handle 
addresses — I think using an object field is a very intriguing idea. I was also 
wondering about that for phone numbers too.

——

to pass on something that may be useful to you in return:
I had been frustrated at how ComboBoxes and popMenus store a VALUE and not the 
REFERENCE (array[0]). I thereafter realized that using a CHOICE LIST for the 
object is ideal.
For example, say that the form needs to have a CUSTOMER combobox and the 
customer’s ID needs to be stored into an Invoice.Customer field to create the 
relational link.
I create a hierarchical list [choice list] (ordaList) that has CUSTOMER 
NAME:KEY   [for value:itemRef in the hierarchical list].
Then I assign that as a choice list to the combo object using OBJECT SET LIST 
BY REFERENCE( ).
I have a method cboxDo put into the object’s script that clairvoyantly lets the 
user type in the customer name, and the KEY automatically gets updated into 
Invoice.Customer field as they enter it.
So to set this up, naturally it just requires a couple parameters to tell 4D 
how to manage it for any given situation.

— chris



> On Apr 25, 2019, at 11:15 AM, Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Chris,
> Thanks for the insight. It sounds like you a

Re: Custom Form Events

2019-04-25 Thread Kirk Brooks via 4D_Tech
Chris,
Thanks for the insight. It sounds like you are working with classic 4D code
(even if you're using v17). Let me encourage you to think about re-writing
your form using v17. I think most of the issues requiring elaborate
workarounds won't be necessary.

Positioning objects on the form. You mention this - that until the entire
On Load form event runs you don't know the final position of objects. This
can especially be a headache if you have subforms and a real headache if
you have nested subforms. The situation can be helped quite a bit by using
a 'form controller': a project method called by all the objects of a form.
I've talked about this a lot and done some presentations on it. It helps
manage complex forms in situations like this. Having all the objects
reference a single method makes managing them easier and helps keep clear
the order of execution:

 subform objects -> subform -> parent form objects -> parent form

It's easy to forget the parent form's On Load event is actually the last
one to run. This has not changed.

For constructing and displaying complex forms the new Form function coupled
with Dialog is incredibly powerful. To begin with, you can build your data
object prior to even opening the form. If you have array or selection based
listboxes these are replaced with collection based listboxes - referring to
either data collections or entity selections. This change alone can prune
dozens of lines of code because so little code is required to manage them.

But you can setup all that data prior to displaying the form and then pass
that data object to the form using Dialog:

DIALOG("myForm";$dataObject)

This will populate the Form function with $dataObject.

Previously if you had a complex situation the form objects or subforms
might call code to configure themselves. And sometimes this had to follow a
specific order during On Load. I'm saying that's no longer necessary. All
the data assembly can be done at once and stored in Form or some other
variable, though Form is more modular and generic. With that scenario it
doesn't matter when or in what order form objects, including subforms, are
drawn.

The second new feature may be too new to actually use but I encourage you
to look at what you can do with it and that's Dynamic Forms. Jsut for
starters you have complete control over drawing a listbox. Complete. Have a
listbx you like? Use the FORM Convert to dynamic command to get the code -
which you can just paste in.



On Wed, Apr 24, 2019 at 9:37 PM Chris Belanger via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> I prefer to reduce the number of Project Methods while, of course,
> creating ones that make logical sense (as they can be called in several
> places in my code). But you understand that as a programmer.
>
I agree with not creating project methods without good cause. But there's
no downside to creating them when needed. Indeed, ORDA encourages us to
create methods for queries and such. Though a lot of the examples of this
in the docs are totally specific it's not hard to make those method more
generic.

And having worked a lot with addresses I don't find very much about them
trivial. Looking at your example as a basic principle responses to user
actions are handled by various events. Assuming the address object or
entity is in Form:

Form: {

address:{

City:"San Francisco"

Provence:"CA",

postalCode: "94114",

cityLine: "San Francisco, CA, 94114"

}

}


The input fields will refer to:

Form.address.City
Form.address.Provence
Form.address.postalCode and so on

and fire On data change. I have, and suspect you do too, a method to
normalize and format my address objects. So I only need to pass the address
object to it for all the work to be done. So the On data change code is:

Adrs_configure_obj (Form.address)

Adrs_configure_obj does all the work on the object. Since I pass
Form.address that is the object the method updates. And since I'm using
Form and referencing it in the form inputs they update as well. I don't
have to do anything else.

This aspect of working with objects, that you can pass the object to a
method and the method changes the object is quite powerful. Previously we
accomplished this with pointers to variables. It's a similar concept but
actually much more dynamic. And faster. When I call, Adrs_configure_obj
(Form.address), the method doesn't get a copy of the data, it gets a
reference to the data. Form.address is itself a reference to the data. The
data, entity or object, is managed by 4D. So this is both fast and resource
efficient.

I have played with the new Formula command myself. I haven't found any
really compelling uses for it in my work yet. I see it as an indication of
more changes to come, though. Like actual data classes where the
transformations I just talked about are part of the dataclass instead of a
separate method. But that's probably v18R stuff.

Hope this gives you some ideas to play with.

-- 
Kirk Brooks
San Francisco, CA
=

Re: Custom Form Events

2019-04-25 Thread Douglas von Roeder via 4D_Tech
Chris:

"I prefer to reduce the number of Project Methods”
My thoughts about programming were strongly influenced by McConnell and a
few others. None of them discuss limiting the number of methods. Their
focus is on when and why to create a method and how those routines
interact. If reducing the number of methods is a desired attribute of code,
how do you know when you’ve got the right number?

"this same logic must be performed whenever City or Province changes.”
That’s sounds a lot like On data change in the GUI or using the Old
function in a trigger. Using the form controller approach, I put code in
each active object, Alternatively, you can put the code in the form method
but I ran into issues with not being able to trap events from tab controls
correctly so I decided to put code in each active object.

Here’s the code from an object:
C_LONGINT($formEvent_L)
$formEvent_L:=Form event

Case of
: ($formEvent_L=On Clicked) | ($formEvent_L=On Double Clicked)
PROC_FormEventValues_Assign (PROC_Object)
PROC_TablePtr_Set (PROC_Object;->[Ledger])
DISBURSEMENT_FC (PROC_Object)
End case

That code is put in place by a macro - all I have to do is change the
events to which it responds. PROC_Object is a process variable (gotta have
one).

The code in _Assign:

C_OBJECT($O_;$1)
$O_:=$1

  //OB Set is blowing up when assigned a nil pointer
  //PROC_FocusObjectPtr_Set ($O_;OBJ_FocusPtr_Return )
PROC_FocusObjectName_Set ($O_;OBJ_FocusName_Return )

PROC_CurrentObjectPtr_Set ($O_;OBJ_CurrentPtr_Return )
PROC_CurrentObjectName_Set ($O_;OBJ_CurrentName_Return )
PROC_FormEvent_Set ($O_;Form event)

PROC_gTablePtr_Set ($O_;gTablePtr_Get )

PROC_CurrentFormPage_Set ($O_;FORM Get current page)

C_TEXT($FB0521)
  //dvonroeder 20170201 {0521}
PROC_CurrentFormTable_Set ($O_;Current form table)

PROC_CurrentFormName_Set ($O_;Current form name)



That is then passed to a form controller method which reads the values in
the object and then dispatches the code.

Here’s the example code for the form controller

C_LONGINT($formEvent_L)
$formEvent_L:=PROC_FormEvent_Get ($O_)

C_TEXT($currentObjectName_T)
$currentObjectName_T:=PROC_CurrentObjectName_Get ($O_)

Case of
: ($formEvent_L=On Clicked)

: ($formEvent_L=On Mouse Enter)

: ($formEvent_L=On Load)

: ($formEvent_L=On Selection Change)

End case

PROC_FormEventValues_Clear ($O_)

Kirk’s presentation at the Summit showed using Form event inside the FC -
my preference is to pass a parameter. My argument is that using Form event
inside the FC increases the level of coupling. I have similar reservations
about the use of Form. but I do accept that it is called a “*form*
controller”, so there’s that…

This code pattern has worked quite well for me but I haven’t rethought
things in light of ORDA or dotted notation.

This does create large methods but they’re dispatcher methods, basically,
and it does supports the basic tenets of good procedural programming,
including the idea that a method should perform one specific function.

What strikes me about the approach that it sounds like you’re taking is
that you’re moving in the direction of larger method to satisfy a desire
for fewer methods. What’s the goal there?
--
Douglas von Roeder
949-336-2902


On Wed, Apr 24, 2019 at 9:37 PM Chris Belanger via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Hi Kirk,
>
> to explain what I want to have ‘custom events’ for, I think Justin Carr’s
> comment on this thread gives some good reason — to do processing after an
> on LOAD that cannot be done during that event since many objects on the
> form do not exist at the time of on load.
> In my efforts to create as generic of a system as possible (which OBJECTS
> help greatly in), some objects in a Form do not ‘exist’ during ON LOAD; but
> I need to initialize structures BEFORE the form starts operating and only
> at the initialization stage (on Load).
>
> Once 4D **finally** makes it possible to programmatically get/set all the
> listBox properties in a collection/entity selection-based listbox
> (particularly data source, current item, current item position, selected
> items) then I would be in position to make use of that information in the
> custom event that would run immediately after ON LOAD (as Justin described).
>
>
> Another use for it that I have not explored yet is to have a chunk of code
> that gets run under several different circumstances, but which I don’t want
> to make a dedicated Project Method for it.
> I prefer to reduce the number of Project Methods while, of course,
> creating ones that make logical sense (as they can be called in several
> places in my code). But you understand that as a programmer.
>
> One simple instance I want to experiment on — which, of course, is
> trivial, is:
>
> I have three fields (actually object attributes)
> City
> Province (or State)
> FullCityName
>
> FullCityName is computed from City & Province
> : (City = “”) —> FullCityName := “”
> :(Province = “”) —> FullCityName := City
> else
> FullCityName := City 

Re: Custom Form Events

2019-04-25 Thread Bernd Fröhlich via 4D_Tech
Chris Belanger:

> One simple instance I want to experiment on — which, of course, is trivial, 
> is:
> 
> I have three fields (actually object attributes)
> City
> Province (or State)
> FullCityName
> 
> FullCityName is computed from City & Province
> : (City = “”) —> FullCityName := “”
> :(Province = “”) —> FullCityName := City
> else
> FullCityName := City + “, “ + Province
> 
> this same logic must be performed whenever City or Province changes.
> So it could be cool to set it as a ‘custom event’ that is ’triggered’ by City 
> and Province scripts. Naturally, it would have to take place at the end of 
> those scripts so as not to encounter unexpected behaviors.
> 
> Now, it could be copy/pasted into both City & Province scripts; it could be 
> made into a Project Method that gets called by either. Or it could be stuffed 
> into the Form Method as a ’custom event’.

Hi Chris,

I solve things like that with a Form.update property.
Whenever something gets "dirty" I set Form.update:=true and at the end of my 
Form method I have the code that updates all the dirty stuff.

Example:

case of
  :(form event= on load)
  ...
  Form.update:=true

  :(form event=on clicked)
  ...
  more event-cases here...
end case

if(Form.update)
   Form.update:=false
   ... do the necessary updating here
end if

In any button script that changes the City or Province in your example just add 
Form.update:=true

Works great, except of course for those cases where objects like listboxes are 
not fully initialized at the end of "on load".
Still need the timer clutch for that.

Greetings from Germany,
Bernd Fröhlich
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Custom Form Events

2019-04-24 Thread Chris Belanger via 4D_Tech
Hi Kirk,

to explain what I want to have ‘custom events’ for, I think Justin Carr’s 
comment on this thread gives some good reason — to do processing after an  on 
LOAD that cannot be done during that event since many objects on the form do 
not exist at the time of on load.
In my efforts to create as generic of a system as possible (which OBJECTS help 
greatly in), some objects in a Form do not ‘exist’ during ON LOAD; but I need 
to initialize structures BEFORE the form starts operating and only at the 
initialization stage (on Load).

Once 4D **finally** makes it possible to programmatically get/set all the 
listBox properties in a collection/entity selection-based listbox (particularly 
data source, current item, current item position, selected items) then I would 
be in position to make use of that information in the custom event that would 
run immediately after ON LOAD (as Justin described).


Another use for it that I have not explored yet is to have a chunk of code that 
gets run under several different circumstances, but which I don’t want to make 
a dedicated Project Method for it.
I prefer to reduce the number of Project Methods while, of course, creating 
ones that make logical sense (as they can be called in several places in my 
code). But you understand that as a programmer.

One simple instance I want to experiment on — which, of course, is trivial, is:

I have three fields (actually object attributes)
City
Province (or State)
FullCityName

FullCityName is computed from City & Province
: (City = “”) —> FullCityName := “”
:(Province = “”) —> FullCityName := City
else
FullCityName := City + “, “ + Province

this same logic must be performed whenever City or Province changes.
So it could be cool to set it as a ‘custom event’ that is ’triggered’ by City 
and Province scripts. Naturally, it would have to take place at the end of 
those scripts so as not to encounter unexpected behaviors.

Now, it could be copy/pasted into both City & Province scripts; it could be 
made into a Project Method that gets called by either. Or it could be stuffed 
into the Form Method as a ’custom event’.

—— 
I realize I am potentially playing with fire, as the execution of code could be 
much different than one is expecting if they don’t keep on their toes. The 
custom event will be handled after the code it is called from has completed 
execution. So under many circumstances it would be a bad idea.

The example above is more of a ‘proof of concept’ for me.

— Chris



> On Apr 23, 2019, at 11:45 AM, Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Chris,
> Reading through your post and the replies I'm trying to think of what a
> 'custom event' would be. Can you give an example or two?
> 
> On Tue, Apr 23, 2019 at 7:33 AM Chris Belanger via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
> 
>> I am wondering if there is a way to configure Custom Form Events. I would
>> like to be able to post a form event, and have it then processed within the
>> FORM METHOD as such.
>> I am doing a lot of work in “Orda context” right now and can think of some
>> handy features that could be implemented in that way, especially with
>> keeping the number of project methods down (as code could be put into a
>> script instead).
>> Before you think “why would he want to do that?” — please just focus on
>> the question of ‘can I?’. :)
>> 
>> In the past, I used the form event “on Outside Call” stuff to handle
>> communications between processes, so I understand all that stuff.
>> 
>> 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.
>> 
>> Any help or direction you could provide would be most appreciated!
>> Thanks — Chris
>> **
>> 4D Internet Users Group (4D iNUG)
>> Archive:  http://lists.4d.com/archives.html
>> Options: https://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> **
> 
> 
> 
> -- 
> Kirk Brooks
> San Francisco, CA
> ===
> 
> What can be said, can be said clearly,
> and what you can’t say, you should shut up about
> 
> *Wittgenstein and the Computer *
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
***

Re: Custom Form Events

2019-04-24 Thread Chris Belanger via 4D_Tech
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 <4d_tech@lists.4d.com> 
> 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 
>> <4d_tech@lists.4d.com> 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 
>>> <4d_tech@lists.4d.com> 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 <
>>> 4d_tech@lists.4d.com> 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 <
 4d_tech@lists.4d.com> 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 <4d_tech@lists.4d.com
 >のメール:
> 
> 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:4d_tech-unsubscr...@lists.4d.com
> **
 
>

Re: Custom Form Events

2019-04-23 Thread Justin Carr via 4D_Tech
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 <4d_tech@lists.4d.com> 
> 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 
>> <4d_tech@lists.4d.com> 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 <
>> 4d_tech@lists.4d.com> 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 <
>>> 4d_tech@lists.4d.com> 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 <4d_tech@lists.4d.com
>>> >のメール:
 
 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:4d_tech-unsubscr...@lists.4d.com
 **
>>> 
>>> **
>>> 4D Internet Users Group (4D iNUG)
>>> Archive:  http://lists.4d.com/archives.html
>>> Options: https://lists.4d.com/mailman/options/4d_tech
>>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>>> **
>> **
>> 4D Internet Users Group (4D iNUG)
>> Archive:  http://lists.4d.com/archives.html
>> Options: https://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> **
> 
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto

Re: Custom Form Events

2019-04-23 Thread Kirk Brooks via 4D_Tech
Chris,
Reading through your post and the replies I'm trying to think of what a
'custom event' would be. Can you give an example or two?

On Tue, Apr 23, 2019 at 7:33 AM Chris Belanger via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> I am wondering if there is a way to configure Custom Form Events. I would
> like to be able to post a form event, and have it then processed within the
> FORM METHOD as such.
> I am doing a lot of work in “Orda context” right now and can think of some
> handy features that could be implemented in that way, especially with
> keeping the number of project methods down (as code could be put into a
> script instead).
> Before you think “why would he want to do that?” — please just focus on
> the question of ‘can I?’. :)
>
> In the past, I used the form event “on Outside Call” stuff to handle
> communications between processes, so I understand all that stuff.
>
> 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.
>
> Any help or direction you could provide would be most appreciated!
> Thanks — Chris
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
Kirk Brooks
San Francisco, CA
===

What can be said, can be said clearly,
and what you can’t say, you should shut up about

*Wittgenstein and the Computer *
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Custom Form Events

2019-04-23 Thread Douglas von Roeder via 4D_Tech
Chris:

IIRC, it was Olivier DesChanels who published that. You might drop him a
line - he’s on the Forum.

--
Douglas von Roeder
949-336-2902


On Tue, Apr 23, 2019 at 8:40 AM Douglas von Roeder 
wrote:

> Chris:
> Could well be Set timer(-1) - that was on the 4D forum a few years back. I
> haven’t tried approach, personally.
>
> --
> Douglas von Roeder
> 949-336-2902
>
>
> On Tue, Apr 23, 2019 at 8:24 AM Chris Belanger via 4D_Tech <
> 4d_tech@lists.4d.com> 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 <
>> 4d_tech@lists.4d.com> 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 <
>> > 4d_tech@lists.4d.com> 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 <
>> >> 4d_tech@lists.4d.com> 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 <4d_tech@lists.4d.com
>> >> >のメール:
>> >>>
>> >>> 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:4d_tech-unsubscr...@lists.4d.com
>> >>> **
>> >>
>> >> **
>> >> 4D Internet Users Group (4D iNUG)
>> >> Archive:  http://lists.4d.com/archives.html
>> >> Options: https://lists.4d.com/mailman/options/4d_tech
>> >> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> >> **
>> > **
>> > 4D Internet Users Group (4D iNUG)
>> > Archive:  http://lists.4d.com/archives.html
>> > Options: https://lists.4d.com/mailman/options/4d_tech
>> > Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> > **
>>
>> **
>> 4D Internet Users Group (4D iNUG)
>> Archive:  http://lists.4d.com/archives.html
>> Options: https://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> **
>
>
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Custom Form Events

2019-04-23 Thread Douglas von Roeder via 4D_Tech
Chris:
Could well be Set timer(-1) - that was on the 4D forum a few years back. I
haven’t tried approach, personally.

--
Douglas von Roeder
949-336-2902


On Tue, Apr 23, 2019 at 8:24 AM Chris Belanger via 4D_Tech <
4d_tech@lists.4d.com> 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 <
> 4d_tech@lists.4d.com> 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 <
> > 4d_tech@lists.4d.com> 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 <
> >> 4d_tech@lists.4d.com> 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 <4d_tech@lists.4d.com
> >> >のメール:
> >>>
> >>> 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:4d_tech-unsubscr...@lists.4d.com
> >>> **
> >>
> >> **
> >> 4D Internet Users Group (4D iNUG)
> >> Archive:  http://lists.4d.com/archives.html
> >> Options: https://lists.4d.com/mailman/options/4d_tech
> >> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> >> **
> > **
> > 4D Internet Users Group (4D iNUG)
> > Archive:  http://lists.4d.com/archives.html
> > Options: https://lists.4d.com/mailman/options/4d_tech
> > Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> > **
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Custom Form Events

2019-04-23 Thread Chris Belanger via 4D_Tech
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 
> <4d_tech@lists.4d.com> 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 <
> 4d_tech@lists.4d.com> 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 <
>> 4d_tech@lists.4d.com> 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 <4d_tech@lists.4d.com
>> >のメール:
>>> 
>>> 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:4d_tech-unsubscr...@lists.4d.com
>>> **
>> 
>> **
>> 4D Internet Users Group (4D iNUG)
>> Archive:  http://lists.4d.com/archives.html
>> Options: https://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> **
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Custom Form Events

2019-04-23 Thread Douglas von Roeder via 4D_Tech
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 <
4d_tech@lists.4d.com> 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 <
> 4d_tech@lists.4d.com> 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 <4d_tech@lists.4d.com
> >のメール:
> >
> > 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:4d_tech-unsubscr...@lists.4d.com
> > **
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Custom Form Events

2019-04-23 Thread Chris Belanger via 4D_Tech
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 
> <4d_tech@lists.4d.com> 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 
> <4d_tech@lists.4d.com>のメール:
> 
> 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:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Custom Form Events

2019-04-23 Thread Jody Bevan via 4D_Tech
Chris:

Absolutely there is a need for them. We use them extensively. I had not really 
thought of them as form events, but more of an event generating a request from 
somewhere else, or within the form. I am working on some form events right now. 

Prior to Objects in the language, the plugin Object Tools was the way to 
accomplish this. Prior to Object Tools, we had to write text files to disk 
(yuk!). The challenge has always been how to manage this. We use objects to do 
this now, and where we use workers we use the call Form command.

Personally I really like the objects to manage this. I like this as:

1.  they are global (on the workstation), 
2. we can easily see what is happening (we have a custom object viewer we can 
see the object contents even in compiled mode).
3. they can be created and discarded easily, and easily cleaned up the way we 
have ours. They die when the process dies.

You need to create an object for this, have strict rules for naming, ensure you 
wipe them out when done, and they should be wiped out when the processes is 
done. Generic methods that look after all of this is the way to go. Generic 
methods that look after all of this so you do not really have to think about it 
when coding. 

Hope this helps. It is how we accomplish this.

Jody Bevan

> On Apr 23, 2019, at 8:32 AM, Chris Belanger via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> I am wondering if there is a way to configure Custom Form Events. I would 
> like to be able to post a form event, and have it then processed within the 
> FORM METHOD as such.
> I am doing a lot of work in “Orda context” right now and can think of some 
> handy features that could be implemented in that way, especially with keeping 
> the number of project methods down (as code could be put into a script 
> instead).
> Before you think “why would he want to do that?” — please just focus on the 
> question of ‘can I?’. :)
> 
> In the past, I used the form event “on Outside Call” stuff to handle 
> communications between processes, so I understand all that stuff.
> 
> 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.
> 
> Any help or direction you could provide would be most appreciated!
> Thanks — Chris
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Custom Form Events

2019-04-23 Thread Keisuke Miyako via 4D_Tech
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 
<4d_tech@lists.4d.com>のメール:

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:4d_tech-unsubscr...@lists.4d.com
**

Re: Custom Form Events

2019-04-23 Thread Chip Scheide via 4D_Tech
Chris,
a Form event is only a longint.
you could simply define a longint value above (or below) the existing 
range of form events, and then take action.

ex: 
My_form_event = 1000
context: a button click, and button object
  Do_something (my_form_Event)

Chip
On Tue, 23 Apr 2019 08:32:50 -0600, Chris Belanger via 4D_Tech wrote:
> I am wondering if there is a way to configure Custom Form Events. I 
> would like to be able to post a form event, and have it then 
> processed within the FORM METHOD as such.
> I am doing a lot of work in “Orda context” right now and can think 
> of some handy features that could be implemented in that way, 
> especially with keeping the number of project methods down (as code 
> could be put into a script instead).
> Before you think “why would he want to do that?” ― please just 
> focus on the question of ‘can I?’. :)
> 
> In the past, I used the form event “on Outside Call” stuff to 
> handle communications between processes, so I understand all that 
> stuff.
> 
> 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.
> 
> Any help or direction you could provide would be most appreciated!
> Thanks ― Chris
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **
---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**