Find concepts if forms are dynamically loaded

Hello Servoyans

Having a main form where we dynamically load forms into (according to a selected menu), I am wondering what concepts are in use to get Find to work?
I can’t seem to find examples on what concepts developers get Find/Search to work when the forms are dynamically loaded (and the solution has modules).

Any help, ideas? How do you do it?

Best regards, Robert

I’m not sure to understand exactly what you mean but I think that this could get you on the right track:

var current_form = elements.tab_main.getTabFormNameAt(elements.tab_main.tabIndex)
forms[current_form].controller.find()

Hello Nicola

I also tried in my experiments what you suggest and the form is (or at least seems to be) going into find mode. I also attached to the same main form the onSearchCmd method which basically contains the line

forms[current_form].controller.search()

But the onSearchCmd method is NOT triggered on pressing return in a field or pressing F3. I am not able to trigger the onSearchCmd method. Is your onSearchCmd triggered?

The onFindCmd on the same form works, though. Very strange.

Thanks and regards, Robert

PS: The main form contains tabless panels, and they get loaded like shown in the code excerpt below:


var menuId = forms.DomMenu.getSelectedMenuId();

initializeJSplitPane();
elements.tabSelection.removeAllTabs();
elements.tabDetail.removeAllTabs();

switch(menuId)
{
case 101:
elements.tabSelection.addTab(forms.StnStations, null, null, null, null,‘#000000’,‘#BBCCEE’);
elements.tabDetail.addTab(forms.StnStationAndMasterData, null, null, null, null,‘#000000’,‘#BBCCEE’);
break;

case 102:
elements.tabSelection.addTab(forms.StnStations, null, null, null, null,‘#000000’,‘#BBCCEE’);
elements.tabDetail.addTab(forms.StnStationAndProperties, null, null, null, null,‘#000000’,‘#BBCCEE’);
break;

case 103:
elements.tabSelection.addTab(forms.StnStations, null, null, null, null,‘#000000’,‘#BBCCEE’);
elements.tabDetail.addTab(forms.StnStationAndTimetable, null, null, null, null,‘#000000’,‘#BBCCEE’);
break;

ngervasi:
I’m not sure to understand exactly what you mean but I think that this could get you on the right track:

var current_form = elements.tab_main.getTabFormNameAt(elements.tab_main.tabIndex)

forms[current_form].controller.find()

Robert Huber:
I also attached to the same main form the onSearchCmd method which basically contains the line

forms[current_form].controller.search()

But the onSearchCmd method is NOT triggered on pressing return in a field or pressing F3. I am not able to trigger the onSearchCmd method. Is your onSearchCmd triggered?

You must attach the method to perform the search to the form that actually goes into find mode, not to the main form, if you want to be able to start the search by hitting return or F3.

ngervasi:

Robert Huber:
I also attached to the same main form the onSearchCmd method which basically contains the line

forms[current_form].controller.search()

But the onSearchCmd method is NOT triggered on pressing return in a field or pressing F3. I am not able to trigger the onSearchCmd method. Is your onSearchCmd triggered?

You must attach the method to perform the search to the form that actually goes into find mode, not to the main form, if you want to be able to start the search by hitting return or F3.

I also tried that, but unfortunatly that doesn’t work either, i. e. the onSearchCmd method is still not fired, even if I attach the onSearchCmd method to the onSearchCmd hook on the form which is set into find mode. Does that really work in your solution?

Thanks, Robert