View Full Version : Macros in Footer Menu?
Macros in the footer work great.
They don't seem to do anything in menus, however. Should they?
What happens instead is that starting the custommenuoptions (footer) menu with anything other than the pipe ( | ) turns the footer menu into an options menu at the left of the footer; which is neat, but being able to have a dynamic menu would be neat also. <s> (I see this has changed from RC9 and before: lacking the pipe used to mean that the menu labels started from the left. I suspect this is a change to make things work with mobile, eh?)
thanks,
Hank
barrymavin
2013-11-05, 00:06
Hi Hank,
The menus can be prefixed with | < or > for center, left and right alignment.
Hi Hank,
The menus can be prefixed with | < or > for center, left and right alignment.
Ah, had used <center>, didn't realize about just using < and >.
The question was about using macros in the footer menu, to make them dynamic. I gather that's a "no"?
thanks,
Hank
yvonne.milne
2013-11-05, 06:27
Hi Hank,
The & character is used for hot key shortcuts (http://www.lianja.com/community/showthread.php?1390-Section-menu-shortcuts-in-next-build&highlight=menu), but you can use {} in the menus.
Regards,
Yvonne
Hi Hank,
The & character is used for hot key shortcuts (http://www.lianja.com/community/showthread.php?1390-Section-menu-shortcuts-in-next-build&highlight=menu), but you can use {} in the menus.
Regards,
Yvonne
Hi Yvonne,
You and Barry have quite the magic touch <s>: it doesn't work for me, I tell you it doesn't, you tell me it does, and then it works for me.
What worked for me today was the following .footermenu, in section2 of page customers in Lianjademo (with the footer caption removed): |&{iif(orders.freight > 100.00, "Reject", "Accept")}
In this case, it sort of works, in the sense that when I set the value in the attributes or from the console, it reflects the current value, but when I change the record nothing happens.
I've tried various things: setting a var to the .footermenu value and then setting .footermenu to the var does refresh the macro. But I can't find a way to make it fire: moving the record pointer in the section2 grid does not fire either the Change or Datachanged delegates, for example (although it seems to me one of them should fire).
So, thanks for making me try again. Any clues on how to make it fire would be appreciated.
thanks,
Hank
barrymavin
2013-11-05, 23:37
Hi Hank,
Look in the App Inspector and see what delegates are being fired.
yvonne.milne
2013-11-06, 04:08
Hi Hank,
Try the section.click() - this works for me in lianjademo:
////////////////////////////////////////////////////////////////
// Event delegate for 'click' event
proc Customers_section2_click()
Lianja.get("customers.section2").footermenu = '|&{iif(orders.freight > 100.00, "Reject", "Accept")}'
endproc
Regards,
Yvonne
Hi Yvonne,
thanks, that almost works.
If on the first record of section 2 on opening (freight > 100), it shows correctly. Now use the nav bar to move the parent record. It still shows reject (even if the code is copied to the parentdatachanged delegate). Click on the first record of section 2 and nothing happens: still says Reject. Click on second record, and it fires, changes to accept.
Is my understanding of the Change delegate correct, that it fires when the record pointer for that section changes? If so, it does not appear to be happening. If not, when does it fire?
thanks,
Hank
yvonne.milne
2013-11-06, 07:07
Hi Hank,
Yes, I noticed the same thing after posting and I've logged a ticket for it - the click doesn't seem to fire if you click on the currently selected row.
Note: the parentdatachanged is called before the new child is selected, so it will pick up the value of the previous parent's child (previous customer's order in this case). You could use the parentdatachanged to blank the menu and prompt the user to click on a row from the footercaption.
Regards,
Yvonne
barrymavin
2013-11-06, 07:16
Are we talking about a grid or a form section?
yvonne.milne
2013-11-06, 07:21
Grid
barrymavin
2013-11-06, 07:26
Then click() should be called when the selected row changes.
yvonne.milne
2013-11-06, 07:26
Hi Hank,
Yes, I noticed the same thing after posting and I've logged a ticket for it - the click doesn't seem to fire if you click on the currently selected row.
Note: the parentdatachanged is called before the new child is selected, so it will pick up the value of the previous parent's child (previous customer's order in this case). You could use the parentdatachanged to blank the menu and prompt the user to click on a row from the footercaption.
Regards,
Yvonne
Update:
The click() firing has been confirmed as expected behaviour - it shouldn't fire if you are clicking within the same row.
yvonne.milne
2013-11-06, 07:28
Hi Barry,
It does, but Hank needs an event that fires for a child grid as he moves through the parents. Parentdatachanged() fires before the new child is selected, so can't be used to pick up the child value (first row in child grid).
Thanks,
Yvonne
barrymavin
2013-11-06, 07:42
This was the "change" put in for cory who did not want rows to be selected... This has had a side effect of there being no current row highlighted.
Is dataChanged not fired on the child after it has its related records refreshed when the parent changes?
yvonne.milne
2013-11-06, 07:42
Hi Yvonne,
...
Is my understanding of the Change delegate correct, that it fires when the record pointer for that section changes? If so, it does not appear to be happening. If not, when does it fire?
thanks,
Hank
Hi Hank,
The 'Change' (xxx_changed()) delegate is called when a record is modified - after 'After Data Update' (xxx_afterupdate()).
The 'After Data Changed' (xxx_datachanged()) delegate is called on Form Sections after the data is read - as you move through the records.
Regards,
Yvonne
barrymavin
2013-11-06, 07:44
Thats correct behavior.
This allows you to alter what appears in the child. It is typically used with Virtual Tables to relate SQL data sources with requery().
yvonne.milne
2013-11-06, 07:46
dataChanged doesn't appear to be firing on Grids at all.
This was the "change" put in for cory who did not want rows to be selected... This has had a side effect of there being no current row highlighted.
Sure, blame me for things not working.
;)
Cory
barrymavin
2013-11-06, 10:01
Haha not at all.
dataChanged doesn't appear to be firing on Grids at all.
That was what I saw, also.
thanks,
Hank