Subform doesn't update after FORM GOTO PAGE

Hi friends, how are you

Well, i don’t know if this happens to any of you, i’m trying to make a multipage form, and i’ve tried to use a subform inside it, this subform has a simple form and arrays, some buttons an other stuff, and i want to change the object behaviour from the main form, it means that if i click in a buton in my main form, the permissions or actions made from this, automatically being reflected to the subform.

I tried to use the method from the main form to the subform and it only works for populate information in the arrays, but it doesn’t change the object behaviour, more accuracy, the button enabled/disabled state

Reading a few, i guess that the problem is because 4D doesn’t finished drawing the subform after the FORM GOTO PAGE call.

i tried EXECUTE METHOD IN SUBFORM, it already does, but still doesn’t work, also tried CALL SUBFORM CONTAINER, but it’s not for this context

Really i don’t know what else i should do, i appreciate all possible help

Thanks a lot

P.D: i hope that my explanation had been clear and enough

Sorry, i forgot something important, if i try to click in the button in the same page, the behavior works, i mean, buttons become disabled after a click to the same button in the page of the subform

Here a tech tip that can help

https://kb.4d.com/assetid=76506

Hi maurice, thanks for your help, but this is not the case, i already use this for subforms with multiple pages, the problem is when i change my page from the main form, i mean, i have a form with 5 pages, one of the pages have a subform that contains some information, many buttons and other stuff, when i move, for example from page 4 to page 5 (that have the subform), and after this call i call all methods for change the state of the buttons, and it doesnt work at the first time, but if i press the button when i am in the page of the subform, all methods work, i don’t know if this is becaus tha subform isn’t rendered before i change the page

Did you try to make a CALL FORM(Current form window;“MyFakeMethod”) just to get a chance to the form to do a refresh ?

Yes, i already tried, but still does’nt work, well, maybe the soution be in the subform, i’ll study more options from there, i tell you later if i can solve this

thanks a lot

: Jorge Ricardo SANCHEZ

COCUNUBO

Reading a few, i guess that the problem is because 4D doesn’t
finished drawing the subform after the FORM GOTO PAGE call.
Ola Jorge,
I seem to remember that subforms are not instantiated if they are in pages > 1 of host.

I don’t know if it’s a good habit, but most of the time I leave the subform container empty in design and fill it at runtime with OBJECT SET SUBFORM. After that I’m sure that “it’s here”, and I can for example use the subform On load to do some job.

i tried EXECUTE METHOD IN SUBFORM

Schematically you have 2 ways to “exchange” between host and subform:

1/ “direct” call of “the other side”

  • EXECUTE METHOD IN SUBFORM = host orders subform to execute a given method; the subform will execute the method
  • CALL SUBFORM CONTAINER = subform throws an event number of its choice into host; the host is free to manage or not this event

2/ exchange through subform container variable
the subform itself is a variable. When this variable value is changed by host or by subform, that change triggers an event in subform or host.

  • changed by host -> On bound variable change event is triggered in subform side
  • changed by subform -> On data change event is triggered in subform objet on host side

Option 1/ is simple and direct, but poor if you have to send data: method parameters from host to subform, a simple event number the other way.

Option 2/ is more powerful, because the subform variable is used at the same time as a trigger and as an “exchange zone”: you set the subform variable to some value (text, longint, object…), that change calls the other side and the other side can look what is in the variable. If it is typed as object, you can put whatever you want in it.

I made a little demo, I send it hoping it will be clearer than my explanations…
https://forums.4d.com/4DBB_Main/x_User/4467/files/28765623.zip

Thanks arnaud for your answer, now i understand a couple of things and learn something that i didn’t know, well, in this case i saw that all methods that involve a subform should be put inside the subform method, i use Form event=On load to evaluate when the form is loaded, it works in this context, and also saw that once the subform is loaded, i can call other methods from the main form using EXECUTE METHOD IN SUBFORM, it means that it happens once.

I guess that i solved my problem, thanks everybody for your help