HMG 3.1.4

HMG Unicode versions 3.1.x related

Moderator: Rathinagiri

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

HMG 3.1.4 - Improvements and corrections

Post by Pablo César » Mon Jun 17, 2013 12:58 pm

I started yesterday to see all SAMPLES which I consider very important to let it in good order. And I prepared some indications, probably some are not functionally for long time and need to be runnable and others need to be revised and find a solution:

1. ImageC:\hmg.3.1.4\SAMPLES\ProgramExecution\CONSOLE, need to add at first lines of source code, following line: REQUEST HB_GT_WIN_DEFAULT

2. ImageC:\hmg.3.1.4\SAMPLES\ProgramExecution\MIXEDCONSOLE, GUI-window would be good to change position, in order to be shown both sessions separeted and add different aproach at console displaying. My changings of this code is:

Code: Select all

#include "hmg.ch"

REQUEST HB_GT_WIN_DEFAULT

Function Main

SetMode(25,80)
DEFINE WINDOW form_1 AT 100 , 700 WIDTH 200 HEIGHT 200 TITLE "Mixed Mode Demo" MAIN

   DEFINE BUTTON Button_1
      ROW    10
      COL    10
      CAPTION "Test Console"
      ACTION   TestConsole()
   END BUTTON

END WINDOW
// CENTER WINDOW form_1
ACTIVATE WINDOW form_1
Return Nil

Function TestConsole()
? 'Hello'
If Row()>10
   Cls
Endif
Return nil
3. C:\hmg.3.1.4\SAMPLES\ProgramExecution\MULTIPRG, it is not possible to compile due following:
  • a. C:\hmg.3.1.4\SAMPLES\ProgramExecution\MULTIPRG\lib1\buildlib.bat, need to fix HMGPATH. I suggest to replace where the line is actually this SET HMGPATH=\hmg.3.0.45 with this:
    for %%A in ("%~dp0..\..\..\..\.") do @SET HMGPATH=%%~fA

    Or better than that, change all buildlib.bat file for this:
    @Echo off
    SET temp1=%~dp0
    SET temp2=%temp1%
    SET pos=0

    :loop
    SET /a pos+=1
    echo %temp2%|FINDSTR /b /c:"SAMPLES" >NUL
    IF ERRORLEVEL 1 (
    SET temp2=%temp2:~1%
    IF DEFINED temp2 GOTO loop
    SET pos=0
    )

    SETLOCAL EnableDelayedExpansion
    set "temp3=%temp1%"
    set /a pos=pos-2
    set temp1=!temp3:~0,%pos%!
    set PATH=%temp1%\harbour\bin;%temp1%\mingw\bin;%PATH%

    if "%1"=="" for %%x in (*.hbp) do (hbmk2 %%x -i%temp1%\include)
    b.Image C:\hmg.3.1.4\SAMPLES\ProgramExecution\MULTIPRG\lib1\libtest1.hbp, at line of -olibtest1 needs to be replaced with -otest1
    c.Image C:\hmg.3.1.4\SAMPLES\ProgramExecution\MULTIPRG\lib1\libtest2.hbp, at line of -olibtest2 needs to be replaced with -otest2
4. Image C:\hmg.3.1.4\SAMPLES\PROPOSED.FEATURES\GRID.SORT, errors at compiling sample. Functions LISTVIEW_GETCOLUMNORDERARRAY and LISTVIEW_SETCOLUMNORDERARRAY are already defined. But function LISTVIEW_GETCOLUMNORDERARRAY is returning Nil value into array, then "Get Columns Order" option is crashing. So probably needs to fix C:\hmg.3.1.4\SOURCE\c_GridEx.c or sample source code to be replaced by this:

Code: Select all

/*
* HMG Grid Demo
* (c) 2005 Roberto Lopez
*
* ListView SORT ORDER COLUMN
* Author: BADIK <badik@mail.ru>
*/

#include "hmg.ch"

Memvar fColor

Function Main()
Local aRows [20] [3]

Private fColor := { || if ( This.CellRowIndex/2 == int(This.CellRowIndex/2) , { 0,0,255 } , { 0,255,0 } ) }   

DEFINE WINDOW Form_1 ;
   AT 0,0 ;
   WIDTH 640 ;
   HEIGHT 400 ;
   TITLE 'Mixed Data Type Grid Test' ;
   MAIN

   DEFINE MAIN MENU
      DEFINE POPUP 'File'
         MENUITEM 'Set New Columns Order'   ACTION SetOrder()
         MENUITEM 'Get Columns Order'      ACTION GetOrder()
         MENUITEM 'Refresh Grid'         ACTION Form_1.Grid_1.Refresh
         SEPARATOR
         MENUITEM 'Exit'            ACTION Form_1.Release
      END POPUP
   END MENU

   aRows [1]   := { 113.12,date(),1,1 , .t. }
   aRows [2]   := { 123.12,date(),2,2 , .f. }
   aRows [3]   := { 133.12,date(),3,3, .t. }
   aRows [4]   := { 143.12,date(),1,4, .f. }
   aRows [5]   := { 153.12,date(),2,5, .t. }
   aRows [6]   := { 163.12,date(),3,6, .f. }
   aRows [7]   := { 173.12,date(),1,7, .t. }
   aRows [8]   := { 183.12,date(),2,8, .f. }
   aRows [9]   := { 193.12,date(),3,9, .t. }
   aRows [10]   := { 113.12,date(),1,10, .f. }
   aRows [11]   := { 123.12,date(),2,11, .t. }
   aRows [12]   := { 133.12,date(),3,12, .f. }
   aRows [13]   := { 143.12,date(),1,13, .t. }
   aRows [14]   := { 153.12,date(),2,14, .f. }
   aRows [15]   := { 163.12,date(),3,15, .t. }
   aRows [16]   := { 173.12,date(),1,16, .f. }
   aRows [17]   := { 183.12,date(),2,17, .t. }
   aRows [18]   := { 193.12,date(),3,18, .f. }
   aRows [19]   := { 113.12,date(),1,19, .t. }
   aRows [20]   := { 123.12,date(),2,20, .f. }

   @ 10,10 GRID Grid_1 ;
      WIDTH 620 ;
      HEIGHT 330 ;
      HEADERS {'Column 1','Column 2','Column 3','Column 4','Column 5'} ;
      WIDTHS {140,140,140,140,140} ;
      ITEMS aRows ;
      EDIT ;
      COLUMNCONTROLS { ;
         {'TEXTBOX' , 'NUMERIC' , '$ 999,999.99'} , ;
         {'DATEPICKER' , 'DROPDOWN'} , ;
         {'COMBOBOX' , {'One' , 'Two' , 'Three'}} , ;
         { 'SPINNER' , 1 , 20 } , ;
         { 'CHECKBOX' , 'Yes' , 'No' } ;
         } ;
      COLUMNWHEN { ;
         { || This.CellValue > 120 } , ;
         { || This.CellValue = Date() } , ;
         Nil , ;
         Nil , ;
         Nil ;
         } ;
      DYNAMICFORECOLOR { fColor , fColor, fColor, fColor, fColor }

END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil

Function SetOrder()
Local aColumns := { 5, 4, 3, 2, 1 }

_SetColumnOrderArray( "Grid_1", "Form_1", aColumns )

Form_1.Grid_1.Refresh
Return Nil

Function GetOrder()
Local a := _GetColumnOrderArray( "Grid_1", "Form_1" )

// msgdebug(a)
aEval( a, {|x,i| MsgInfo ( "Column " + ltrim( str ( x ) ), ltrim( str ( i ) ) )} )
Return Nil

Function _GetColumnOrderArray( ControlName , ParentForm )
Local i, nColumn, aSort

i := GetControlIndex( ControlName , ParentForm )
nColumn := len(_HMG_SYSDATA [ 33 ] [i])
aSort := array(nColumn)
My_ListView_GetColumnOrderArray( _HMG_SYSDATA [ 3 ] [i], nColumn, @aSort )
Return aSort

Function _SetColumnOrderArray( ControlName , ParentForm, aSort )
Local i, nColumn

i := GetControlIndex( ControlName , ParentForm )
nColumn := len(_HMG_SYSDATA [ 33 ] [i])
ListView_SetColumnOrderArray( _HMG_SYSDATA [ 3 ] [i], nColumn, aSort )
Return Nil


#pragma BEGINDUMP

#define _WIN32_IE 0x0500

#include <windows.h>
#include <commctrl.h>
#include "hbapi.h"
#include "hbvm.h"

HB_FUNC ( MY_LISTVIEW_GETCOLUMNORDERARRAY )
{
   int nColumn = hb_parni(2);
   LPINT pnOrder = (LPINT) malloc(nColumn*sizeof(int));
   int i;

   ListView_GetColumnOrderArray( (HWND) hb_parnl(1), nColumn, pnOrder );

   for (i=0; i<nColumn; i++)
   {
      hb_storvni(pnOrder[i]+1, 3, i+1);
   }
}

#pragma ENDDUMP
5. C:\hmg.3.1.4\SAMPLES\MainDemo\MAIN.AUTOADJUST, This samples is crashing when make many resizing. Probably need to be replaced by my original sample ( this one ) or code source to be revised. Because, not all components are reziseble.

6. Image C:\hmg.3.1.4\hfcl\Samples\HMGHPDFDoc, not able to compile (by prompt command or clicking Build.bat). Please replace last lines where are:

call %temp%\build.bat %MainFile%
pause


With this:

if "%1"=="" for %%x in (*.hbp) do (call %temp%\build.bat %%x)
if not "%1"=="" call %temp%\build.bat %1


7. C:\hmg.3.1.4\hfcl\Samples\GridPrintPreFormat, Main.,prg need to correct at line of:

     a.Image Form_1.Grid_1.Item (2) := { 123.45 , date() , 2 , 10 , .T. }
     to be replaced with this:
     Form_1.Grid_1.Item (2) := { 2 , date() , 456.12 , 10 , .T. }

     b. Error after Print option.
Screen.PNG
Screen.PNG (30.32 KiB) Viewed 3303 times
Needs to Rebuild libhbvpdf.a at C:\hmg.3.1.5\SOURCE\hbvpdf.

8. ImageC:\hmg.3.1.4\SAMPLES\TUTORIAL, the Build.bat should be improved just to attend ALL sample projects to be builded at once when is executing without parameter. I suggest to change Build.bat for this:
@Echo OFF
SET temp1=%~dp0
SET temp2=%temp1%
SET pos=0

:loop
SET /a pos+=1
echo %temp2%|FINDSTR /b /c:"SAMPLES" >NUL
IF ERRORLEVEL 1 (
SET temp2=%temp2:~1%
IF DEFINED temp2 GOTO loop
SET pos=0
)

SETLOCAL EnableDelayedExpansion
set "temp3=%temp1%"
set /a pos=pos-2
set temp1=!temp3:~0,%pos%!

if "%1"=="" for %%x in (*.hbp) do (call %temp1%\build.bat %%x)
if not "%1"=="" call %temp1%\build.bat %1
It was simplified just for better understanding and improved for multiple hbp files. Alias ​​this file should replace all remaining Build.bat, for a project to compile and various existing in the current folder.

9. ImageC:\hmg.3.1.4\hfcl\Samples\BosTaurus, IMO, the BT_Build_All_Demos.bat file would be replaced by Build.bat just to attend all building demos files and for independent file to be re-builded, like as:
@Echo OFF
SET temp1=%~dp0
SET temp2=%temp1%
SET pos=0

:loop
SET /a pos+=1
echo %temp2%|FINDSTR /b /c:"hfcl" >NUL
IF ERRORLEVEL 1 (
SET temp2=%temp2:~1%
IF DEFINED temp2 GOTO loop
SET pos=0
)

SETLOCAL EnableDelayedExpansion
set "temp3=%temp1%"
set /a pos=pos-2
set temp1=!temp3:~0,%pos%!

if "%1"=="" for %%x in (*.hbp) do (call %temp1%\build.bat %%x)
if not "%1"=="" call %temp1%\build.bat %1
The only difference is subfolder hfcl with other SAMPLES folder.

10. ImageC:\hmg.3.1.4\Samples\Ide.bat, this file was also modified, as follows:

Code: Select all

@Echo OFF
SET temp1=%~dp0
SET temp2=%temp1%
SET pos=0

:loop
SET /a pos+=1
echo %temp2%|FINDSTR /b /c:"SAMPLES" >NUL
IF ERRORLEVEL 1 (
SET temp2=%temp2:~1%
IF DEFINED temp2 GOTO loop
SET pos=0
)

SETLOCAL EnableDelayedExpansion
set "temp3=%temp1%"
set /a pos=pos-2
set temp1=!temp3:~0,%pos%!

if "%1"=="" for %%x in (*.hbp) do (%temp1%\ide\ide.exe %%x)
if not "%1"=="" %temp1%\ide\ide.exe %1
This modifications also permits to load several projects at IDE as at any subfolder sample.

11. ImageC:\hmg.3.1.4\Samples\Controls\MENU_ControlContext.2, is missing prg file. There is another ContextMenu sample at c:\hmg.3.1.4\SAMPLES\EXTERNAL.WINDOWS\CONTEXTMENU which can be replaced for. Just to having all ContextMenu in only one place.

12. C:\hmg.3.1.4\Samples\USER.COMPONENTS, it does not compiles. I have some suggestions to let this example workable and make independent sample and not as is now with includes files being part of HMG main project. My suggestions are:
  • a. There are two includes files: i_UsrInit.ch and i_UsrSOOP.ch at c:\hmg.3.1.4\INCLUDE folder which will be not necessary to have it as internal HMG file. These files could be deleted.
    b. In place of these two files should be created only one with name UserInit.ch at c:\hmg.3.1.4\SAMPLES\USER.COMPONENTS folder (at current folder) and with the following content:

    Code: Select all

    #define BASEDEF_MYBUTTON 
    #xcommand @ <row>,<col> MYBUTTON <name> ;
    		OF <parent> ;
    		CAPTION <caption> ;
    		ACTION <action> ;
    	=>;
    	_DefineMyButton(<"name">,<row>,<col>,<caption>,<{action}>,<"parent">)
    #undef BASEDEF_MYBUTTON
    #xcommand DECLARE CUSTOM COMPONENTS <Window> ;
    =>;
    _dummy() ;;
    #define SOOP_MYBUTTON ;;
    #xtranslate <Window> . \<Control\> . Disable  => Domethod ( <"Window">, \<"Control"\> , "Disable" )  ;;
    #xtranslate <Window> . \<Control\> . Enable  => Domethod ( <"Window">, \<"Control"\> , "Enable" )  ;;
    #xtranslate <Window> . \<Control\> . Handle  => GetProperty ( <"Window">, \<"Control"\> , "Handle" )  ;;
    #xtranslate <Window> . \<Control\> . Handle  := \<v\> => SetProperty ( <"Window">, \<"Control"\> , "Handle" , \<v\> )  ;;
    #undef SOOP_MYBUTTON ;;
    c. Edit c:\hmg.3.1.4\SAMPLES\USER.COMPONENTS\demo.prg to add #Include "UserInit.ch"
    d. Edit c:\hmg.3.1.4\SAMPLES\USER.COMPONENTS\demo.hbp which has been included wrongly mybutton.prg and need to be removed from .hbp file, because in demo.prg is already declared as Set Procedure To MyButton.Prg.
    e. Delete Readme.txt which are some unecessary instructions, because now is include file at current folder.
    f. Edit Minigui.ch which wrongly contains following lines:
    #include "i_UsrInit.ch"
    #include "i_UsrSOOP.ch"

    These lines must be deleted, because is not part of any internal ressource of HMG, instead it's a simple example and with include file at current sample folder it is enough.
     
    Added later: (In red color)
    There is an enhanced code and instructions for this USER_COMPONENTS which is still with error at compilling). Please read at: viewtopic.php?p=47854#p47854
13. Image C:\hmg.3.1.4\SOURCE\SOURCE, unecessary folder ? Why this ? IMO, it must be deleted.

14. ImageC:\hmg.3.1.4\SAMPLES\HELLO.WORLD, folder and same example at C:\hmg.3.1.4\SAMPLES\EXTERNAL.WINDOWS\HELLO, IMO one of this must be deleted.

15. ImageC:\hmg.3.1.4\SAMPLES\Controls\TextBox\CUEBANNER, to add or actual demo be replaced with:

Code: Select all

/* SetCueBanner Demo2.prg which works in ANSI and UNICODE
   
     Author: Carlos Britos
Contributor: Pablo César
   
  Important: SetCueBanner() does not show aAnything in Win XP (any Service Pack). 
             On some configurations of WinXP, there is a known problem with SetCueBanner().

   Solution: In the Control Panel/Regional and Language Options (On the Languages tab)
          
             The removal of Operating System support for Complex Scripts
             The removal of Operating System support for East Asian languages
*/

#include <hmg.ch>

Function Main
Define window Form_1 at 0, 0 width 400 height 300 main Title "Demo2 - Carlos example"
   DEFINE TEXTBOX Text_1
        ROW    10
        COL    10
        WIDTH  200
      TOOLTIP "Put your name"
    END TEXTBOX

    DEFINE TEXTBOX Text_2
        ROW    40
        COL    10
        WIDTH  200
      TOOLTIP "Put your address"
    END TEXTBOX

    DEFINE EDITBOX Edit_1
        ROW    10
        COL    230
        WIDTH  120
        HEIGHT 110
        VALUE ""
    END EDITBOX

    DEFINE COMBOBOX Combo_1
        ROW    70
        COL    10
        WIDTH  200
        HEIGHT 100
        ITEMS {"Item 1","Item 2","Item 3"}
        VALUE 0
      DISPLAYEDIT .T.      // must be .T. for cuebanner
    END COMBOBOX

    DEFINE SPINNER Spinner_1
        ROW    100
        COL    10
        WIDTH  200
        HEIGHT 24
        RANGEMIN 1
        RANGEMAX 10
        VALUE ""             // must be "" for cuebanner
    END SPINNER

    DEFINE RICHEDITBOX RichEdit_1
        ROW    130
        COL    230
        WIDTH  120
        HEIGHT 90
        VALUE ""
    END RICHEDITBOX
End window
SetCueBanner(GetControlHandle("Text_1","Form_1"),"Enter your name here",.t.) // Third parameter is for not dissapear when getfocus
SetCueBanner(GetControlHandle("Text_2","Form_1"),"Enter address here",.t.)
SetCueBanner(GetControlHandle("Spinner_1","Form_1")[1],"Spinner CueBanner",.t.)
SetCueBanner(FindWindowEx(GetControlHandle("Combo_1","Form_1"),0,"Edit",Nil),"ComboBox CueBanner",.t.)
      
SetCueBanner(GetControlHandle("Edit_1","Form_1"),"EditBox CueBanner",.t.)
SetCueBanner(GetControlHandle("RichEdit_1","Form_1"),"RichEditBox CueBanner",.t.)
Form_1.center
Form_1.activate
Return Nil

#pragma BEGINDUMP

#define COMPILE_HMG_UNICODE  // Remove this for ANSI building
#include <HMG_UNICODE.h>     // Remove this for ANSI building

#include <windows.h>
#include <commctrl.h>

#define EM_SETCUEBANNER  5377  // Set the cue banner with the lParm = LPCWSTR

HB_FUNC( SETCUEBANNER )                   // (nEditHandle, cMsg, lGetFocus) -> nil
{
   #ifdef UNICODE
      LPWSTR lpWCStr = HMG_parc(2) ;
   #else
      LPWSTR lpWCStr = (LPCWSTR) ( hb_parc(2) == NULL ) ? NULL : hb_mbtowc( (const char *) hb_parc(2) ) ;
   #endif
   SendMessage( (HWND) hb_parnl(1), EM_SETCUEBANNER, (WPARAM) hb_parl(3), (LPARAM) (LPCWSTR) lpWCStr ) ;
   SysFreeString( lpWCStr );
}

#pragma ENDDUMP
This example is more effective for WinXP and upper version and also workable for ANSI and UNICODE for TextBoxes, Spinners and ComboBoxes. This was token from Carlos examples at http://hmgforum.com/viewtopic.php?p=27448#p27448

16. ImageC:\hmg.3.1.4\SOURCE\hbvpdf\hbvpdft.prg, error at line:

nSize := ascan( aSize, { |arr| LEFTEQUAL( arr[ 1 ], _cPageSize ) } ).

So we have not LEFTEQUAL, so at least we need to create this function like as:

#define LEFTEQUAL( l, r ) ( HB_ULeft( l, HMG_Len( r ) ) == r )

17. ImageChanging IDE language. Is being changed on the fly but only in main IDE window and other"Project Browser" and "Object Inspector" windows are not changed the language.

Notes: All itens sinalized with this Image have been corrected in new releases after version HMG 3.1.4.
Others tests will be done for the rest of samples and this message could be added and re-edited in this same message. But please gentlemen contributors, consider these suggestions in order to improve and not with the idea of criticism. And all this indications, could be improved and put in avaliation, in order to see what is better for everyone, so please is accepted your advices.
Last edited by Pablo César on Sat Nov 19, 2016 1:06 am, edited 1 time in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
Rathinagiri
Posts: 5264
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Post by Rathinagiri » Mon Jun 17, 2013 1:33 pm

but, what about GRID_GETCOLUMNWIDTHDISPLAY() function?
I think there is a misplacement of grid_ex functions by Claudio. Till he releases a patch, you can use this function.

Code: Select all


******************************************************************************
FUNCTION GRID_GetColumnWidthDisplay (cControlName, cParentForm, nColIndex)
LOCAL nWidth
   IF Valtype (cParentForm) == "U"
      cParentForm := ThisWindow.Name
   ENDIF	
   // LISTVIEW_GETCOLUMNWIDTH: Low-level function in C native of HMG (source c_grid.c)
   nWidth := LISTVIEW_GETCOLUMNWIDTH (GetControlHandle (cControlName, cParentForm), nColIndex-1)
RETURN nWidth
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
srvet_claudio
Posts: 2044
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 35 times
Been thanked: 146 times
Contact:

Post by srvet_claudio » Mon Jun 17, 2013 8:01 pm

mol wrote:but, what about GRID_GETCOLUMNWIDTHDISPLAY() function?
Hi Marek.
This function is remove in the version 3.1.3

Code: Select all

  - Removed GridEx from HFCL as it is merged to HMG main source (Contributed by Dr. Claudio Soto)
instead use:


<ParentWindowName>.<GridControlName>.ColumnWIDTH ( nColIndex ) --> nColumnWidth
<ParentWindowName>.<GridControlName>.ColumnWIDTH ( nColIndex ) := [ nColumnWidth ] | [ GRID_WIDTH_AUTOSIZE ] | [ GRID_WIDTH_AUTOSIZEHEADER ]

Code: Select all

# GRID Control improvement (HMG.3.1.3)
 
	- New Get Properties:
	
		<ParentWindowName>.<GridControlName>.ColumnCOUNT                           --> nColumnCount
		<ParentWindowName>.<GridControlName>.ColumnHEADER           ( nColIndex )  --> cColumnHeader
		<ParentWindowName>.<GridControlName>.ColumnWIDTH            ( nColIndex )  --> nColumnWidth
		<ParentWindowName>.<GridControlName>.ColumnJUSTIFY          ( nColIndex )  --> nColumnJustify
		<ParentWindowName>.<GridControlName>.ColumnCONTROL          ( nColIndex )  --> aColumnControl
		<ParentWindowName>.<GridControlName>.ColumnDYNAMICBACKCOLOR ( nColIndex )  --> bColumnDynamicBackColor
		<ParentWindowName>.<GridControlName>.ColumnDYNAMICFORECOLOR ( nColIndex )  --> bColumnDynamicForeColor
		<ParentWindowName>.<GridControlName>.ColumnVALID            ( nColIndex )  --> bColumnValid
		<ParentWindowName>.<GridControlName>.ColumnWHEN             ( nColIndex )  --> bColumnWhen
		<ParentWindowName>.<GridControlName>.ColumnONHEADCLICK      ( nColIndex )  --> bColumnOnHeadClick
		<ParentWindowName>.<GridControlName>.ColumnDISPLAYPOSITION  ( nColIndex )  --> nColumnDisplayPosition
		<ParentWindowName>.<GridControlName>.CellEx      ( nRowIndex, nColIndex )  --> xValue (very more fast that .Cell)
		
	- New Set Properties:
	
		<ParentWindowName>.<GridControlName>.ColumnHEADER           ( nColIndex )  := cColumnHeader
		<ParentWindowName>.<GridControlName>.ColumnWIDTH            ( nColIndex )  := [ nColumnWidth ] |
																						[ GRID_WIDTH_AUTOSIZE ] |
																						[ GRID_WIDTH_AUTOSIZEHEADER ]
		<ParentWindowName>.<GridControlName>.ColumnJUSTIFY          ( nColIndex )  := nColumnJustify
		<ParentWindowName>.<GridControlName>.ColumnCONTROL          ( nColIndex )  := aColumnControl
		<ParentWindowName>.<GridControlName>.ColumnDYNAMICBACKCOLOR ( nColIndex )  := bColumnDynamicBackColor
		<ParentWindowName>.<GridControlName>.ColumnDYNAMICFORECOLOR ( nColIndex )  := bColumnDynamicForeColor
		<ParentWindowName>.<GridControlName>.ColumnVALID            ( nColIndex )  := bColumnValid
		<ParentWindowName>.<GridControlName>.ColumnWHEN             ( nColIndex )  := bColumnWhen
		<ParentWindowName>.<GridControlName>.ColumnONHEADCLICK      ( nColIndex )  := bColumnOnHeadClick
		<ParentWindowName>.<GridControlName>.ColumnDISPLAYPOSITION  ( nColIndex )  := nColumnDisplayPosition
		<ParentWindowName>.<GridControlName>.CellEx      ( nRowIndex, nColIndex )  := xValue (very more fast that .Cell)
		<ParentWindowName>.<GridControlName>.BackGroundImage ( nAction, cPicture, nRow, nCol )
																nAction = GRID_SETBKIMAGE_NONE | GRID_SETBKIMAGE_NORMAL |
																		GRID_SETBKIMAGE_TILE | GRID_SETBKIMAGE_WATERMARK
	
	
	- New Methods:
	
		<ParentWindowName>.<GridControlName>.AddColumnEx ( [ nColIndex ],[ cCaption ],[ nWidth ],[ nJustify ],[aColumnControl] )
		<ParentWindowName>.<GridControlName>.AddItemEx ( aItem, nRow )
	
	
	- Set/Get Grid New Properties/Methods with equivalent syntax:
	
		- THIS.XXX  --> where XXX is the name of the new Grid Properties/Methods
	
	
	- AddColumn, AddColumnEx and DeleteColumn properties now NOT clean the Grid (NOT Delete all items),
	for compatibility with old behavior of ADDCOLUMN and DELETECOLUMN:
	
		- SET GridDeleteAllItems [ TRUE|ON ] | [ FALSE|OFF ]
		- IsGridDeleteAllItems() --> Return .T. or .F.
	
	
	- Set colors and display mode in GRID cell navigation mode:
	
	CellNavigationColor ( _SELECTEDCELL_FORECOLOR, aRGBcolor )
	CellNavigationColor ( _SELECTEDCELL_BACKCOLOR, aRGBcolor )
	CellNavigationColor ( _SELECTEDCELL_DISPLAYCOLOR, lBoolean )
	
	CellNavigationColor ( _SELECTEDROW_FORECOLOR, aRGBcolor )
	CellNavigationColor ( _SELECTEDROW_BACKCOLOR, aRGBcolor )
	CellNavigationColor ( _SELECTEDROW_DISPLAYCOLOR, lBoolean )
	
	
	- Get colors in GRID cell navigation mode:
	
	aRGBcolor := CellNavigationColor ( _SELECTEDCELL_FORECOLOR )
	aRGBcolor := CellNavigationColor ( _SELECTEDCELL_BACKCOLOR )
	
	aRGBcolor := CellNavigationColor ( _SELECTEDROW_FORECOLOR )
	aRGBcolor := CellNavigationColor ( _SELECTEDROW_BACKCOLOR )
Last edited by srvet_claudio on Mon Jun 17, 2013 10:08 pm, edited 1 time in total.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
srvet_claudio
Posts: 2044
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 35 times
Been thanked: 146 times
Contact:

Post by srvet_claudio » Mon Jun 17, 2013 8:58 pm

Pablo César wrote: 4- C:\hmg.3.1.4\SAMPLES\PROPOSED.FEATURES\GRID.SORT, errors at compiling sample. Functions LISTVIEW_GETCOLUMNORDERARRAY and LISTVIEW_SETCOLUMNORDERARRAY are already defined. But function LISTVIEW_GETCOLUMNORDERARRAY is returning Nil value into array, then "Get Columns Order" option is crashing. So probably needs to fix C:\hmg.3.1.4\SOURCE\c_GridEx.c or sample source code to be replaced by this:
This demo has problems in allocating the value of pointers at C level and not written with GridEx.

With GridEx this demo becomes:

Code: Select all

#include "hmg.ch"

Memvar fColor

Function Main

Local aRows [20] [3]

   Private fColor := { || if ( This.CellRowIndex/2 == int(This.CellRowIndex/2) , { 0,0,255 } , { 0,255,0 } ) }   

   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 640 ;
      HEIGHT 400 ;
      TITLE 'Mixed Data Type Grid Test' ;
      MAIN

      DEFINE MAIN MENU
         DEFINE POPUP 'File'
            MENUITEM 'Set New Columns Order'   ACTION SetOrder()
            MENUITEM 'Get Columns Order'      ACTION GetOrder()
            MENUITEM 'Refresh Grid'         ACTION Form_1.Grid_1.Refresh
            SEPARATOR
            MENUITEM 'Exit'            ACTION Form_1.Release
         END POPUP
      END MENU

      aRows [1]   := { 113.12,date(),1,1 , .t. }
      aRows [2]   := { 123.12,date(),2,2 , .f. }
      aRows [3]   := { 133.12,date(),3,3, .t. }
      aRows [4]   := { 143.12,date(),1,4, .f. }
      aRows [5]   := { 153.12,date(),2,5, .t. }
      aRows [6]   := { 163.12,date(),3,6, .f. }
      aRows [7]   := { 173.12,date(),1,7, .t. }
      aRows [8]   := { 183.12,date(),2,8, .f. }
      aRows [9]   := { 193.12,date(),3,9, .t. }
      aRows [10]   := { 113.12,date(),1,10, .f. }
      aRows [11]   := { 123.12,date(),2,11, .t. }
      aRows [12]   := { 133.12,date(),3,12, .f. }
      aRows [13]   := { 143.12,date(),1,13, .t. }
      aRows [14]   := { 153.12,date(),2,14, .f. }
      aRows [15]   := { 163.12,date(),3,15, .t. }
      aRows [16]   := { 173.12,date(),1,16, .f. }
      aRows [17]   := { 183.12,date(),2,17, .t. }
      aRows [18]   := { 193.12,date(),3,18, .f. }
      aRows [19]   := { 113.12,date(),1,19, .t. }
      aRows [20]   := { 123.12,date(),2,20, .f. }

      @ 10,10 GRID Grid_1 ;
         WIDTH 620 ;
         HEIGHT 330 ;
         HEADERS {'Column 1','Column 2','Column 3','Column 4','Column 5'} ;
         WIDTHS {140,140,140,140,140} ;
         ITEMS aRows ;
         EDIT ;
         COLUMNCONTROLS { ;
            {'TEXTBOX' , 'NUMERIC' , '$ 999,999.99'} , ;
            {'DATEPICKER' , 'DROPDOWN'} , ;
            {'COMBOBOX' , {'One' , 'Two' , 'Three'}} , ;
            { 'SPINNER' , 1 , 20 } , ;
            { 'CHECKBOX' , 'Yes' , 'No' } ;
            } ;
         COLUMNWHEN { ;
            { || This.CellValue > 120 } , ;
            { || This.CellValue = Date() } , ;
            Nil , ;
            Nil , ;
            Nil ;
            } ;
         DYNAMICFORECOLOR { fColor , fColor, fColor, fColor, fColor }

   END WINDOW

   CENTER WINDOW Form_1

   ACTIVATE WINDOW Form_1

Return Nil


PROCEDURE SetOrder()
local aColumns := { 5, 4, 3, 2, 1 }
   _SetColumnOrderArray( "Grid_1", "Form_1", aColumns )
   Form_1.Grid_1.Refresh
RETURN


PROCEDURE GetOrder()
local a := LISTVIEW_GETCOLUMNORDERARRAY (GetControlHandle( "Grid_1", "Form_1" ), Form_1.Grid_1.ColumnCOUNT)
   aEval( a, {|x,i| MsgInfo ( "Column " + ltrim( str ( x ) ), ltrim( str ( i ) ) )} )
RETURN


*--------------------------------------------------------------------
Function _GetColumnOrderArray( ControlName , ParentForm )
*--------------------------------------------------------------------
Return LISTVIEW_GETCOLUMNORDERARRAY (GetControlHandle(ControlName , ParentForm), GetProperty (ParentForm, ControlName, "ColumnCOUNT"))


*--------------------------------------------------------------------
Function _SetColumnOrderArray( ControlName , ParentForm, aSort )
*--------------------------------------------------------------------
LISTVIEW_SETCOLUMNORDERARRAY (GetControlHandle(ControlName , ParentForm), GetProperty (ParentForm, ControlName, "ColumnCOUNT"), aSort) 
Return Nil
or more easy:

Code: Select all

PROCEDURE SetOrder()
local i, aColumns := { 5, 4, 3, 2, 1 }
   Form_1.Grid_1.DisableUpdate()
   FOR i = 1 TO Form_1.Grid_1.ColumnCOUNT
       Form_1.Grid_1.ColumnDISPLAYPOSITION (i) := aColumns [i]
   NEXT
   Form_1.Grid_1.EnableUpdate()
   Form_1.Grid_1.Refresh
RETURN

PROCEDURE GetOrder()
local i
   FOR i = 1 TO Form_1.Grid_1.ColumnCOUNT
       MsgInfo ( "Column " + ltrim( str ( Form_1.Grid_1.ColumnDISPLAYPOSITION (i) ) ), ltrim( str ( i ) ) ) 
   NEXT
RETURN
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Mon Jun 17, 2013 9:58 pm

4- C:\hmg.3.1.4\SAMPLES\PROPOSED.FEATURES\GRID.SORT\demo.prg

Perfecto ! Both examples are working !

Thank you Dr. Soto !
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
srvet_claudio
Posts: 2044
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 35 times
Been thanked: 146 times
Contact:

Post by srvet_claudio » Mon Jun 17, 2013 9:59 pm

HMG.3.1.4 has a set of powerful functions to events process:

Code: Select all

-    CREATE EVENT PROCNAME <cProcName> [HWND <hWnd>] [MSG <nMsg>] [STOREINDEX IN <nIndex>]
 
-    nIndex := EventCreate ( cProcName, hWnd, nMsg )
-    EventRemove ( nIndex )
 
-    EventIsInProgress () --> lBoolean
-    EventThisINDEX ()    --> nIndex
-    EventThisPROCNAME () --> cProcName
-    EventThisHWND ()     --> hWnd
-    EventThisMSG ()       --> nMsg
-    EventThisWPARAM ()   --> wParam
-    EventThisLPARAM ()   --> lParam
 
-    EventGetPROCNAME ( nIndex )     --> cProcName
-    EventGetHWND ( nIndex )   --> hWnd
-    EventGetMSG ( nIndex )    --> nMsg
-    EventGetSTOP ( nIndex )   --> lBoolean
-    EventSetSTOP ( nIndex, lStop )
 
-    GetSplitChildWindowHandle ( cFormName, cParentForm )
-    GetSplitBoxHandle ( cParentForm )
Attachments
demos_Create_Event.rar
(1.69 KiB) Downloaded 187 times
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
srvet_claudio
Posts: 2044
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 35 times
Been thanked: 146 times
Contact:

Post by srvet_claudio » Tue Jun 18, 2013 12:03 am

Hi all,
this an additional information about this new version of HMG.

See example of:

Code: Select all

PROGRESSBAR MARQUEE           --> C:\hmg.3.1.4\SAMPLES\Controls\ProgressBar\PROGRESSBAR.4
DEFINE CONTROL CONTEXT MENU   --> C:\hmg.3.1.4\SAMPLES\Controls\MENU_ControlContext.1
Enhanced IMAGE CONTROL        --> C:\hmg.3.1.4\SAMPLES\Controls\Image\IMAGE.4
                              --> C:\hmg.3.1.4\SAMPLES\Controls\Image\IMAGE.5
New BuildLib.bat and BuildAllLib.bat with menu
(the C:\hmg.3.1.4\hmglib.TXT file contains the ANSI or UNICODE text to according to option chosen compilation)

Best Regards,
Claudio.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
srvet_claudio
Posts: 2044
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 35 times
Been thanked: 146 times
Contact:

Post by srvet_claudio » Tue Jun 18, 2013 12:11 am

Pablo César wrote:4- C:\hmg.3.1.4\SAMPLES\PROPOSED.FEATURES\GRID.SORT\demo.prg

Perfecto ! Both examples are working !

Thank you Dr. Soto !
Pablo, thanks for the testing.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Tue Jun 18, 2013 12:25 am

srvet_claudio wrote:HMG.3.1.4 has a set of powerful functions to events process:

Code: Select all

-    CREATE EVENT PROCNAME <cProcName> [HWND <hWnd>] [MSG <nMsg>] [STOREINDEX IN <nIndex>]
 
-    nIndex := EventCreate ( cProcName, hWnd, nMsg )
-    EventRemove ( nIndex )
 
-    EventIsInProgress () --> lBoolean
-    EventThisINDEX ()    --> nIndex
-    EventThisPROCNAME () --> cProcName
-    EventThisHWND ()     --> hWnd
-    EventThisMSG ()       --> nMsg
-    EventThisWPARAM ()   --> wParam
-    EventThisLPARAM ()   --> lParam
 
-    EventGetPROCNAME ( nIndex )     --> cProcName
-    EventGetHWND ( nIndex )   --> hWnd
-    EventGetMSG ( nIndex )    --> nMsg
-    EventGetSTOP ( nIndex )   --> lBoolean
-    EventSetSTOP ( nIndex, lStop )
 
-    GetSplitChildWindowHandle ( cFormName, cParentForm )
-    GetSplitBoxHandle ( cParentForm )
And (since ver. HMG 3.1.3)
- DISABLE [ CONTROL ] EVENT ControlName OF FormName
- ENABLE [ CONTROL ] EVENT ControlName OF FormName
- StopControlEventProcedure ( cControlName, cFormName, lStop )

- DISABLE [ WINDOW ] EVENT OF FormName
- ENABLE [ WINDOW ] EVENT OF FormName
- StopWindowEventProcedure ( cFormName, lStop )

- GetLastActiveFormIndex () --> Return nFormIndex
- GetLastActiveControlIndex () --> Return nControlIndex

- GetFormNameByIndex ( nFormIndex ) ---> Return cFormName
- GetControlNameByIndex ( nControlIndex ) ---> Return cControlName
Are very powerfull functions. So from now I just starting to undertand these wonderfull functions. Congrats genius ! Many thanks for all you do to our community, really thank you, Dr. Soto !
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
srvet_claudio
Posts: 2044
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 35 times
Been thanked: 146 times
Contact:

Post by srvet_claudio » Tue Jun 18, 2013 1:21 am

Pablo César wrote:
srvet_claudio wrote:HMG.3.1.4 has a set of powerful functions to events process:

Code: Select all

-    CREATE EVENT PROCNAME <cProcName> [HWND <hWnd>] [MSG <nMsg>] [STOREINDEX IN <nIndex>]
 
-    nIndex := EventCreate ( cProcName, hWnd, nMsg )
-    EventRemove ( nIndex )
 
-    EventIsInProgress () --> lBoolean
-    EventThisINDEX ()    --> nIndex
-    EventThisPROCNAME () --> cProcName
-    EventThisHWND ()     --> hWnd
-    EventThisMSG ()       --> nMsg
-    EventThisWPARAM ()   --> wParam
-    EventThisLPARAM ()   --> lParam
 
-    EventGetPROCNAME ( nIndex )     --> cProcName
-    EventGetHWND ( nIndex )   --> hWnd
-    EventGetMSG ( nIndex )    --> nMsg
-    EventGetSTOP ( nIndex )   --> lBoolean
-    EventSetSTOP ( nIndex, lStop )
 
-    GetSplitChildWindowHandle ( cFormName, cParentForm )
-    GetSplitBoxHandle ( cParentForm )
And (since ver. HMG 3.1.3)
- DISABLE [ CONTROL ] EVENT ControlName OF FormName
- ENABLE [ CONTROL ] EVENT ControlName OF FormName
- StopControlEventProcedure ( cControlName, cFormName, lStop )

- DISABLE [ WINDOW ] EVENT OF FormName
- ENABLE [ WINDOW ] EVENT OF FormName
- StopWindowEventProcedure ( cFormName, lStop )

- GetLastActiveFormIndex () --> Return nFormIndex
- GetLastActiveControlIndex () --> Return nControlIndex

- GetFormNameByIndex ( nFormIndex ) ---> Return cFormName
- GetControlNameByIndex ( nControlIndex ) ---> Return cControlName
Are very powerfull functions. So from now I just starting to undertand these wonderfull functions. Congrats genius ! Many thanks for all you do to our community, really thank you, Dr. Soto !
The idea of these functions is to try to create a debug for events (which is better suited to the GUI), the traditional debug for line of code is better for console mode, not for Windows programs, because Windows is based on messages that generate events.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

Post Reply