GRID Widget enhancement

Author: jtsagara@logisoft.gr (jtsagara)

These days I started a project with uniface 9.6 in Greece, I see many enhancements in the ui (popup forms, buttons, tab ex, etc.) but again my disappointment was related to the grid widget. Really I cannot understand why Compuware leave this vital widget for client/server applications so behind in development. Come on guys, all the other tools have grids that rocks and only uniface is so behind in this area. It is not so difficult to adjust a third party powerful grid widget in the code of uniface. For example in this version Compuware introduced the pop form (at last I can obsolete the c++ code that mimics this functionality!) I was very pleased to see my calendar at last at the right position Laugh but then I tried the grid with popup form… big disappointment not even this simple thing is implemented. With my trivial knowledge of c++ I started to build a function that positions the pop up window at the “bottom_left” area of the grid child widget for example an editbox. The only think that the code must determine is the fact that we are on the grid, personally I prefer the right click for the popups. I used the class name AfxWnd80u of the grid in order to scan if the right click is on grid and get the rectangular of the widget that I needed to present the popup. Then I returned the coordination to uniface in order to use $WindowProperties($FormName) to set the position of the popup. Of course uniface manual states: “You should not try to control the size or position of the popup window using $windowproperties. This can lead to unexpected results because the starting point for the size properties is the upper left corner of the window, while the starting point for the popup window is relative to the field or popup rectangle, and the corner specified with the position property.” But they forgot to mention that the popup form without a parent gets the starting point 0,0 meaning that we can use the coordination of the grid child widget natively in order to position the popup form. So, this is the c++ code : \*************************************************************************************************************/ extern "C" EXPORT void GetMouseClickCoordGrid ( long *pnoXCoord , //OUT :X Coordination long *pnoYCoord , //OUT :Y Coordination long *pnoOnGrid ) //OUT :On GRID { // Variables POINT vtTagCursor; HWND FieldHWND; HWND ParentHWND; char vsClassName[TinyStr]; RECT vcWidgetCoords; //Get Poind Of Click Mouse GetCursorPos ( &vtTagCursor ); //Get Hwnd Of Field From Point FieldHWND = WindowFromPoint(vtTagCursor); //Get Field Widget Rectacular GetWindowRect(FieldHWND ,&vcWidgetCoords); //Get Parent Window From Field Hwnd ParentHWND = GetParent(FieldHWND); //Get Class Name From Hwnd Of Parent GetClassName( ParentHWND , vsClassName , TinyStr-1 ); //Check If Parent Class Is AfxWnd80u -- GRID And Make pnoOnGrid = True if ( strcmp (vsClassName,"AfxWnd80u") == 0 ) { //X Coordination *pnoXCoord = vcWidgetCoords.left; //Y Coordination *pnoYCoord = vcWidgetCoords.bottom; // Is On GRID True *pnoOnGrid = 1; } else //Not Used But Just Return The Coordination Of Click { //X Coordination *pnoXCoord = vtTagCursor.x; //Y Coordination *pnoYCoord = vtTagCursor.y; // Is On GRID False *pnoOnGrid = 0; }; return; } /*************************************************************************************************************/ I know that this is not perfect and I must still calculate the borders of the screen to change the position if the popup form is out of the screen. With the above code in my 3gl.dll and with this code in the pop up menu of the dates: ;Call the C++ Routine NewInstance "u3gl" , vh3GL Activate vh3GL->GetMouseClickCoordGrid ( vnXCoord , vnYCoord , vbISOnGrid ) If ( vbISOnGrid ) ;Fix String Position To Pass At Calendar Form vsWinPosition = "XPOS=%%vnXCoord•;YPOS=%%vnYCoord" Else ;Plain Entity vsWinPosition = "" EndIf ;Call Modal Calendar NewInstance "Cf_CalPopUp" , vhCalendar , "MODALITY=MODAL" Activate vhCalendar->Exec(@vsFldFullName , vsWinPosition) .. and a simple positioning in the calendar pop up form : ;Set Default Position For The GRID PopUP If ( psiWinPosition != "" ) $WindowProperties($FormName) = psiWinPosition EndIf The result is exactly like the pop up form for other widgets! Concluding I must say, come on guys this is 30 minutes job, I managed that with trivial knowledge of c++ , uniface deserves a good grid widget like all the other tools, think about it.

This page has no comments.