^ZOOM,SMOD, detect GRID widget use
Author: vojta@incad.cz (vojta)
GRID widget doesn´t support ^zoom, and some other behavior is changed. I try to replace this functionality by using cursor menu and uniface form. But when user try to edit and save field value this solution doesn't respect •field NED,$editmode=2 .. but it can detected by uniface functions. •SMOD triggers , returning value<0 So it is not possible fully replace ^zoom with this solution. Zoom implemented by this way must be display only , or there must be special mechanism to secure field value.
- Is there any way, how to detect GRID widget use ? is used( ^ZOOM doesn't work, must be replaced)
- Is there any way, how programatically start SMOD to check its value.. ?
Thanks for any ideas
7 Comments
Local Administrator
This is probably quite a crude approach, but you could check the Class Name of the Parent Window of a Grid field. In case the Class Name is "AfxWnd80u" then you know that you are dealing with a Grid widget. For this to work you need a C Call-Out signature that implements the Windows User32 API functions: GetFocus(), GetParent() and GetClassName(). And then you could use the below Proc code:
I’ve also uploaded a small sample form (including the required C call-out signatures) to the Community Samples download here on Uniface.info (see Detect Grid sample). Hope this helps. Regards, Daniel Iseli
Author: diseli (daniel.iseli@uniface.com)
Local Administrator
I don't quite understand why you want to do this? Is there no other way to check the current field value? Or am I missing something here? Thanks, Daniel Iseli
Author: diseli (daniel.iseli@uniface.com)
Local Administrator
Thanks for grid detect tip, I try it. I hope, it will be good enough for Zoom. SMOD field trigger we use sometimes return value <0 for access control or eventualy another actions are executed . When edit value in classic ^ZOOM are executed , its ok. In grid zoom must be solved programmatically, so triggers SMOD and VALC are skipped. But if I will know, grid is used, I will probably left Zoom as readonly form for grid fields by default.
Author: vojta (vojta@incad.cz)
Local Administrator
The code used can only return whether the current focus is on a field which is in a grid widget. Is there a way of getting the entity handle using the entity name? I.e. as part of the initialisation routine, I want to set $fieldsyntax=HID if the user hasn't access to the field and it's not in a grid widget, and $columnsyntax=HID if it is. So I pass a fieldname.entityname to a routine, which needs to be able to check if that field is in a grid widget... Iain
Author: Iain Sharp (i.sharp@pcisystems.co.uk)
Local Administrator
Why not use $columnsyntax for both situations? $fieldsyntax will only affect the field in the current occurrence and $columnsyntax will affect the filed in all (painted) occurrences. Daniel
Author: diseli (daniel.iseli@uniface.com)
Local Administrator
My workaround will only work if an object has a Window. A Grid is composed of several Window objects, but a normal entity will not create any Windows. There is certainly a way to loop through all the available Windows belonging to the Uniface application and try to identify each of them, but that's not really efficient (I think). I, however, realized that the Viewport_Resized (Extended) Trigger of a Grid is fired when a form is shown for the first time. From there you could call a specific (Grid) initialization routine (passing e.g. the entity name of the Grid with precompiler constant <$entname>). I know that this workaround also relies (as the one proposed above) on the fact that the form (and all the painted fields and Grids) are visible. In case you need something that is called before (e.g. in the INIT operation of a form) then you have to look for a different approach (e.g. define the required info as constants in the component). Hope this helps. Daniel
Author: diseli (daniel.iseli@uniface.com)
Local Administrator
As I mentioned on the wishlist grid widget detection
Author: ulrich-merkel (ulrichmerkel@web.de)