Function InputWindow()

Creative ideas/suggestions for HMG

Moderator: Rathinagiri

Post Reply
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Function InputWindow()

Post by andyglezl »

Hola Pablo César!
Yo sugiero que no aparezca en el InputWindows la columna 1, ya que por alguna razón se oculto!
Quizas un parametro .T. ó .F. por si en algun momento se requiere modificar alguno de los valores ocultos...
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Function InputWindow()

Post by srvet_claudio »

andyglezl wrote:
Hola Pablo César!
Yo sugiero que no aparezca en el InputWindows la columna 1, ya que por alguna razón se oculto!
Quizas un parametro .T. ó .F. por si en algun momento se requiere modificar alguno de los valores ocultos...
This is way:

Code: Select all

i := GetControlIndex (cGridName, cParentName)
if HMG_LEN (_HMG_SYSDATA [ 14 ] [i]) > 0
   // the first column is an image index
else
   // not exist the first column "hide" with images index
endif
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

Re: Function InputWindow()

Post by Pablo César »

srvet_claudio wrote:This is a defect in the implementation of GRID that I left it to maintain compatibility with older versions.
In old versions when displays images in the grid control the first column is used for display it and only in this column.

The correct way is display the image in the side of text in any column and not in a separate column.

Code: Select all

- <ParentWindowName>.<GridControlName>.Image ( lTransparent ) := { "image1.png", "image2.bmp", ... }
- <ParentWindowName>.<GridControlName>.ImageIndex ( nRow , nCol ) [ := | -->] nIndex
Thank you Claudio to make us remind this. I was beginning to understand at C:\hmg.3.4.0\SAMPLES\Controls\Grid\GRID_05 demo and seeing this specific column for images (at older versions).
I've checked how can be diferantiated from old to new version for storing image index, it's thru:
HMG_LEN( _HMG_SYSDATA [ 14 ] ) > 0 // aImage

Any way I will keep hiden this kind of field in editing for grids.

[line][/line]
I was understanding the image of grid logic and answering this message at the same time you have alread posted the verification way.

Claudio wrote:This is way:

Code: Select all

i := GetControlIndex (cGridName, cParentName)
if HMG_LEN (_HMG_SYSDATA [ 14 ] [i]) > 0
   // the first column is an image index
else
   // not exist the first column "hide" with images index
endif
Thank you Claudio, very much appreciated !

andyglezl wrote:Quizas un parametro .T. ó .F. por si en algun momento se requiere modificar alguno de los valores ocultos...
Hi Andrés thank you for you interest and opinion.
I have tried to make all this identification automactically, just to make easier for user.
But I believe this could it be handle manually thru UDF (user function, named: My_UDF as parameter) and can set any property inside of this function that it will acts internally into InputWindow.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Function InputWindow()

Post by Pablo César »

More one question Claudio about images in grids.

Please confirm my understanding, these image adding ways:

<ParentWindowName>.<GridControlName>.Image ( lTransparent ) := { "image1.png", "image2.bmp", ... } -> New way :?:

and
Screen1.png
Screen1.png (36.9 KiB) Viewed 5058 times
This last is old way :?:
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Function InputWindow()

Post by srvet_claudio »

Pablo César wrote:More one question Claudio about images in grids.

Please confirm my understanding, these image adding ways:

<ParentWindowName>.<GridControlName>.Image ( lTransparent ) := { "image1.png", "image2.bmp", ... } -> New way :?:

and

Image
This last is old way :?:
Yes, the last image is the old version and the first the new way.
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

Function InputWindow()

Post by Pablo César »

Thank you Claudio ! :)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Function InputWindow()

Post by Pablo César »

Hi all,

In case of MultiGrid (MultiSelect) for editing thru InputWindow, IMO all fields must be empty unless that selected would it be just one item. i.e. If select item is just one item only, then can it be with respective value otherwise must be empty values at control in edition (textbox, combobox, datepicker, etc.).

Because what's reason for multi records be edited ?

Probably can be helpful to change specific field (when not empty control left) with same content to be replaced to same field (same column) for all selected items. Otherwise why to be edited ?

Any ideas ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Function InputWindow()

Post by Pablo César »

InputWindow for in-place-edit in Grids Finally I got satisfactory results with more than 45 Grids tests (all Grids demos at SAMPLES and some more) as promissed to Rathi (his great idea) with an alternative to in-place-edit feature in Grids, using InputWindow with a minimum implementation efforts to users and without any degradation or slowness on the Grid.

Some considerations:
  1. InputWindow will not replace any data in the grid.
    The main idea is to pass to edit all fields in the grids thru InputWindow and returning results in array to be handled by the programmer as be wished to entire responsability.
  2. InputWindow Implementation at grid I indicate to do it thru ON DBLCLICK grid event.
  3. InputWindow can be implemented at grid by these different ways:
    1. InputWindow() (without any parameter). It will detect by itself all grid properties.
    2. InputWindow(<cParentWindowName>,<cControlName>) (both parameters as regular character type variables).
    3. InputWindow(<cParentWindowName>,<cControlName>,<anWidths>) (two character variables and one numeric array). This array will contain the total of columns with its width's size of each.
    4. InputWindow(<cParentWindowName>,<cControlName>,<anWidths>,<aHotKeys>) (two character variables, one numeric array and one composite array). This last array could contains the all parameters for Hot Key.
      For example:

      Code: Select all

      abEscape:={ 0, VK_ESCAPE, {|| ThisWindow.Release() }
      abF1:={ 0, VK_F1, {|| My_Help() }
      ON DBLCLICK InputWindow(<cParentWindowName>,<cControlName>,<anWidths>,{abEscape,abF1})
      // or like this:
      ON DBLCLICK InputWindow(,,,{abEscape, abF1})
    5. InputWindow(<cParentWindowName>,<cControlName>,<anWidths>,<aHotKeys>, nRow, nCol, aBackColor, aToolTips, aHotKeys, aStyles, bCode )
      This is the complete parameter sequence. The aHotKeys and aStyles parameters will be overwritten for grids propose.
    Relative notes:
    • This parameter instructions are valid for InputWindow to Grids only.
    • All these parameters listed here for InputWindow to Grids, are optional, not mandatory.[/color]
  4. EDIT property at your grid must be removed. In order to let InputWindow to take it placed.
  5. For replacement of contain of array in return from InputWindow. Is suggested to make your own function.
    Like this example: ON DBLCLICK MyReplace(InputWindow2()). It would be more convenient to creat your own function to process all data obtained from InputWindow and be repassed to the grid.
Some features was added without Grid support like as:
  1. TextBox for PASSWORD. Actually our Grid in HMG is not prepared to handle password type field (ES_PASSWORD). So if we put { 'TEXTBOX', "PASSWORD" } in ColumnControls, grid is not gonna display any data (will be empty). But when call InputWindow will be prepared to edit in TextBox for PASSWORD with special characters ( like this: "•" ), but it can not get any data from the grid... :( (due HMG grid restrictions).
  2. ToolTips for each column is not posible yet at our grid. :( This could be useful to apply individual ToolTip for each column/field.
  3. EditBox in our grid will be accept only for memos fields (from dbf). :(
    On the other hand, InputWindow is prepared to work with all kind of fields with text to be edited.
    It could be with memos fields (from dbf), strings or text files (with path, with full path or no path at current folder).
    Some restrictions were asked to to HMGDT for approval and implementation be disregarded concerning Editbox
    ( Let's wait their decision :roll: )
New features at ColumnControls was added and enhanced:
  1. DatePicker with two options: DROPDOWN or UPDOWN
  2. TimePicker with different options: _TIMELONG24H / _TIMESHORT24H / _TIMELONG12H / _TIMESHORT12H
  3. Spinner with:
    • Two parameters: nRANGEMIN and nRANGEMAX
    • Three parameters: nRANGEMIN, nRANGEMAX and nINCREMENT (this last is new)
Some interesting features:
  1. ColumnWhen make exceptions edtions. Preventing edition by enabling controls becoming in gray when attend the condition. This could be done by following ways:
    • By using This.xxx. Example: { This.CellValue == .T., This.CellValue > CToD("01/01/2000") }
    • By using a simple array containing logical value for each column. Example: { .T.,.T.,.F.,.T. }
    • By using a function with more elaborate features. Example: { CheckValid(This.CellValue),CheckAge(This.CellValue) }
       
      Anyway is good to test all the logical compose. Try first with EDIT at grid to check results before.
  2. Hiden fields (not displayed and not editable) can happen with:
    • For retrocompatibility, it has been reserved the first column where index list be used for images display at grid.
      New way to display images at grid have been implement at grid. What's the most indicated use.
      Please check Image ( lTransparent ), ImageIndex ( nRow , nCol ), ImageList and also HeaderImageIndex for the right usage.
    • Sometimes we want to hide a particular column. Could be one o more, which can be useful for data processing but not be editable column/field. In these cases, you just put value 0 (zero) at the respective column in <anWidths> of grid.
  3. Implement a new composite field CheckBoxItem for selectable items. Which is not a separated field but count when be cheked/filled. This is always the first field in edition. No label was applied, due of many languages for internalization.
     
  4. When is double-clicked at any column of grid ( even for not CellNavigation ), will be started at correlative field thru SetFocus. This is useful to go direct to the most ineterest field to be edited
     
  5. Allows fields edition even for MultiSelect records in grid. Will be act in two differents ways:
    • When is double-clicked in just only one row/item, all values will bring to be edited.
    • When more than one are selected items, will open an empty values.
      This is useful when we wish to be replaced specific field for many records.
  6. Label were been optimized by it width size. Taking the maximum length of header's string.
     
  7. When anWidths parameter have not be informed at InputWindow calling, this will take the exact width of each column automactically.
     
  8. InputWindow will take the same sequence of columns at grid. Even if grid was with sorted order column, will take the corresponding column.
     
  9. When is resized width colum at grid and entered to InputWindow, this will also resize control correlative of that column. Useful for column with EditBox extending the width of column.
Expected new interesting features:
  1. Will need to implement for ColumnValid. (Sorry, this is not posible to be implemented)
  2. Programmer module which will allow for redimensioning controls. Useful for example, when programmer starts elaborate InputWindow size of controls. Then it would save at specific file storing size of each control to attend specific grid. This could be done by HMG_ChangeWindowStyle (topic in discuss)
  3. ImageSimulates same property of EditOption from grid to be applyied for others controls like as: TextBox and EditBox. But probably this will demand some implementation in HMG library.
  4. ImageFixed when using keyboard and press enter: row and col of grid were not real.
  5. ImageAdded column justification to the right making TextBoxes and DatePicker to be aligned to the right.
  6. ImageAllowed 4th parameter for aHotKeys definitions, in place of 9th parameter.
Temporary use and implementation:
As we know InputWindow is not released yet with this improvements. So before InputWindow be upgraded in our HMG library, you will need to use it as follows:
  • Here in attached compressed file, there is an InputWindow.prg file which contains InputWindow2 function name. This name ends with "2", because the current InputWindow at HMG library is not upgraded yet (upto this moment at hmg 3.4.0 version).
  • To use this new InputWindow2() you will need to include InputWindow.prg in your compilling. You will do by editing your main prg and add #include "InputWindow.prg" at line after of #include <hmg.ch>
  • And remember to call the function like as InputWindow2() (with red "2") untill HMGDT will make this upgrade.
  • Some changing will be done, updating this package. But always will be excluded the previous version. Always keeping updated the package file.
  • Have been found some bugs in grid library in HMG. Those were been fixed by Claudio already. Probably will release a patch or a new HMG version. At meantime this not happen, some runtime errors could it be happen after your compilling. :?

    You can watch this video
I know some questions still somewhat poor in missing definitions and I have tried to be compatible with most of common cases.

I've consulted to colleagues of this community in public, to reach and see their each point-of-views from the users and HMGDT.

I hope you make the most advantage of this editing tool and you be kind to report your doubts or any failure that may occur with InputWindow use.

General Notes:
  • New Items in red color to differentiate from previous text.
  • Attached source code file was removed because there is a newer version released more ahead of this message in this topic.

Here in attached is one example (source codes and executable file):
Screen1.png
Screen1.png (147.7 KiB) Viewed 4943 times
Grid_CheckBoxes.rar
Grid_CheckBoxes demo (source and executable file)
(1.12 MiB) Downloaded 278 times
Hereunder in attached, another demo (source codes, data files and executable file):
Screen2.png
Screen2.png (394.33 KiB) Viewed 4943 times
Demo4.rar
(1.51 MiB) Downloaded 290 times
This demo is running with modified HMG library to support EditBox in Grid for any instance. Is not working with current library.

I wish to give an special thanks to Rathinagiri for this great idea and the genious of Claudio that gives all support for HMG improvements, to all others colleagues that have been participating and contributing with ideas and own opinion.

To all thank you !

Best regards to all and enjoy it ! :D
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Function InputWindow()

Post by Rathinagiri »

Great work Pablo.

It is really useful for me and I am sure it took a lot of time to make. Thanks a lot.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: Function InputWindow()

Post by Pablo César »

Rathinagiri wrote:Great work Pablo.

It is really useful for me and I am sure it took a lot of time to make. Thanks a lot.
Thank you, my friend !

This is a result of your great idea.

Thanks to you Rathinagiri (again).
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply