^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

  1. vojta said
    • Is there any way, how to detect GRID widget use ?

    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:

    ; ****************************** ; *** Field Gets Focus       *** ; ****************************** postmessage $instancename, "DetectGrid", ""
    ; ****************************** ; *** Asynchronous Interrupt *** ; ****************************** variables     handle hUSER32     string lpClassName, isGrid endvariables selectcase $msgid     case "DetectGrid"         isGrid = "No"         newinstance "USER32", hUSER32         hUSER32->GetClassName(hUSER32->GetParent(hUSER32->GetFocus()), lpClassName, 255)         if (lpClassName = "AfxWnd80u") isGrid = "Yes" endselectcase

    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)
  2. vojta said
    • Is there any way, how programatically start SMOD to check its value.. ?

    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)
  3.  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)
  4. 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)
  5. Iain Sharp said 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

    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)
  6. Iain Sharp said 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?

    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)
  7. As I mentioned on the wishlist grid widget detection

      To harvest informations like the one above, the DUR project (dITo Uniface Reflection) uses a 2phase compile. After the first compile and cleanup, the registry is insepcted and a lot of information is written to an include proc with the name of the component. This include proc is included in the DEFINES trigger of the component so it can be used in all code locations. When GRID can be detected from the repository, it’s a piece of cake to add that information. This way, you can extract all kind of info you need for your implementation (and you can have it NOW) Greetings from Frankfurt/Germany, Uli

    Author: ulrich-merkel (ulrichmerkel@web.de)