Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: build-in-find  (Read 14179 times)
yves v.
Posts: 6


« on: March 19, 2012, 07:08:29 pm »

with GDC 2.40 and new feature 'buid-in-find' :
i have added the find in default.4ad
in display array , if we strike CTRL-F , the function open the popup widow for search, all is OK
but there is no visible buttom in the rigth , as for other  predefined accept and cancel which are always visible

Reuben B.
Four Js
Posts: 1046


« Reply #1 on: March 19, 2012, 08:58:40 pm »

The source for the find window is in $FGLDIR/src/fglfind.4gl and $FGLDIR/src/fglfind.per.  You can take a copy of those files and modify them as required to match your applications GUI interface.  Place the compiled objects in $FGLDIR/lib or higher up the path.    I think I've added STYLE="dialog" to mine.




Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Rene S.
Four Js
Posts: 111


« Reply #2 on: March 20, 2012, 06:41:21 pm »

Hello,
some built-in actions have also built-in action defaults. The action "find" has the attribute defaultView="no". The idea bind was: avoid a new button in the action panel. You can not change this attribute. Unfortunately.
Rene
yves v.
Posts: 6


« Reply #3 on: March 20, 2012, 08:01:54 pm »


in this case, how can we use the function of FGLDIR/src

ON ACTION find
   CALL  fglfind (r , -notfound)
                          ||<<<<<<<<<<<<< Value of parameters we must give ?

Is there an example somewehre
Thanks
Reuben B.
Four Js
Posts: 1046


« Reply #4 on: March 21, 2012, 01:53:06 am »


in this case, how can we use the function of FGLDIR/src

ON ACTION find
   CALL  fglfind (r , -notfound)
                          ||<<<<<<<<<<<<< Value of parameters we must give ?

Is there an example somewehre
Thanks

... I'm not sure why you want to do that.   All that will do is popup the find window but it won't do any of the actual finding.  (but to answer your question, look at the source.  Even though English may not be your first language you should be able to figure the structure of r and what the _notfound boolean is used for)

The built-in find is an action that is added automatically, just like accept, cancel, close, editcopy etc.  You don't have to explicitly code it.

What Rene is saying is that the defaultView attribute is hard-coded to "no".  So even if you change the defaultView attribute in your .4ad to "yes" or "auto", you will not see in your action panel a button labelled "Find".    It will still be available in the context-menu (right-click), and if you add a toolbar item named "find" or a topmenu item named "find" or a button named "find", those widgets will be visible and if you click on them they will trigger the built-in find functionality.

What we do recognize is that the user-interface we have created for this window may not be to the same standards or language that the rest of your application is coded to.

So if you look in FGLDIR/lib/default.4ad you should find the "find" action defined.  You are free to change that.  So if you don't want it to say "Find" but to say perhaps "Trouvaille"  (courtesy of Babelfish)  and have an accelerator of Control-T, you can do that by editing your .4ad.

Similarly if you don't like the appearance of the form.  You can edit FGLDIR/src/fglfind.per to get an appearance that matches your application.  That may mean changing the field prompts so that they are left-justified instead of right-justified, adding a : between the label and field,  or as you want to do either add  buttons for accept/cancel, or change the style of the window so that the action panel (with buttons for accept/cancel) is displayed.

That same principle applies to other functions you can find in FGLDIR/src.  For instance FGLDIR/src/fglreport which contains the code to display the report to screen via START REPORT TO SCREEN.  If you don't like the appearance of that window, you can alter that code.

You could also change the source in fglfind.4gl but you shouldn't change the function interface.  The runner is calling it passing a record (with 4 elements) and a BOOLEAN

Quote
FUNCTION fglfind(r, _notfound)
    DEFINE r RECORD
        pattern STRING,
        ignoreCase BOOLEAN,
        wrapAround BOOLEAN,
        fieldId INT
    END RECORD
...
   RETURN r.*
END FUNCTION

so in the rare event that you did want to change the source in fglfind.4gl you would have to keep the function interface the same.

Hope that helps,

Reuben




Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
yves v.
Posts: 6


« Reply #5 on: March 21, 2012, 11:57:25 am »


Good explanations
Thanks to all
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines