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: FGL_DIALOG_SETKEYLABEL: What is it's replacement?  (Read 12733 times)
Bryce S.
Posts: 52


« on: July 28, 2008, 11:51:06 pm »

Hi,

I was just using FGL_DIALOG_SETKEYLABEL and noticed in the documentation that it says:

Warnings:
   1. This function is provided for backward compatibility.

Since this is an extremely useful function for me I was wondering what it's replacement is so I can code that instead?
For example, I use it if an action is used for toggling a view - initally might say "Show All", once set I change it to say "Show only Unlicenced" ... or similar.

Regards,
 Bryce Stenberg.
Sebastien F.
Four Js
Posts: 545


« Reply #1 on: July 29, 2008, 09:53:02 am »

Hello Bryce,

First understand that this function will be supported for a while, so you are not forced to replace every call right now.

A smarter way to define a label for a key / action is to use Action Defaults with the TEXT attribute:

https://4js.com/techdocs/genero/fgl/devel/DocRoot/User/ActionDefaults.html

This new way is not as dynamic as the built-in function:
- The text is defined once for the whole program ( 4ad file) or for a given form (ACTION DEFAULTS section in .per).
- Setting the text to an empty string will not hide the default view (button in action frame), as with fgl_dialog_setkeylabel().

If you need to change the label dynamically as you describe, you can use the "OM" API to change the text attribute of the Action node. Maybe we are missing a DIALOG.setActionText() method here.

Seb
Reuben B.
Four Js
Posts: 1119


« Reply #2 on: July 29, 2008, 11:44:06 am »

...
If you need to change the label dynamically as you describe, you can use the "OM" API to change the text attribute of the Action node. Maybe we are missing a DIALOG.setActionText() method here.

Seb

I agree. I used to have a action_text_set() routine (as well as action_image_set(), action_comment_set()).  From memory the OM API to do this was a little tricky to write.  Menu and dialog actions have different tag names, had to cater for nested dialogs ( actions could potentially have the same name in each dialog, and the active attribute is not reset on the way out of a dialog)

Reuben

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


« Reply #3 on: July 29, 2008, 12:22:42 pm »

Seb,
We had a discussion on the list way back about this as we only keep actions in one place (on a toolbar) and wanted to be able to chnage any of the actions 'attributes' on the fly. So a DILOG setter would be good - as would something akin to:
ON ACTION accept (TEXT='OK',IMAGE='tick')
ON ACTION cancel (TEXT='Back',IMAGE='backArrow',COMMENT='Previous Screen')

The reason being is that (for us) accept and cancel (they are typically the ones that change the most) are used to mean slighlty different things in different situtaions (and can mean different things on the same form - ie when building a CONSTRUCT and then displaying the results of that CONSTRUCt back to the same form).
Sebastien F.
Four Js
Posts: 545


« Reply #4 on: July 29, 2008, 12:53:23 pm »

Yes ON ACTION ... ATTRIBUTES( TEXT = ... ) is also something we would like to do.

Here the bug entry I have just filed:

=================================================================================
Programmers ask how to change dynamically the label of default action views.

According to Reuben, using the OM API is not that easy, so it would be nice to
have a DIALOG.setActionText() method, as well as setActionImage() and
setActionComment().

Note that it could also be supported with:

   ON ACTION xxx ATTRIBUTES( TEXT = "...", ... )

But that would not be dynamic.
=================================================================================


Seb
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines