Help with using IDE

Utilities like DBU, Make, IDE written in HMG/ used to create HMG based applications

Moderator: Rathinagiri

User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Help with using IDE

Post by mol »

I think you should start with HMG.3.
Works on HMG.4 are suspended and I'm afraid there is no one able to continue this project for now...
It's sad, but it's true

Regards, Marek
MGOLDFARB
Posts: 71
Joined: Thu Jun 21, 2012 7:46 am

Re: Help with using IDE

Post by MGOLDFARB »

No problem. I just switched over to HMG.3.

Now I am back to my original problem (but in version 3). How do I populate a Grid control with the date from a table?

Thanks.

Mark
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Help with using IDE

Post by esgici »

MGOLDFARB wrote:No problem. I just switched over to HMG.3.
Now I am back to my original problem (but in version 3). How do I populate a Grid control with the date from a table?
C:\hmg\SAMPLES\GRID.25
Viva INTERNATIONAL HMG :D
MGOLDFARB
Posts: 71
Joined: Thu Jun 21, 2012 7:46 am

Re: Help with using IDE

Post by MGOLDFARB »

Thanks! That did the trick. The grid now working.

The table has a few thousand entries (list is sorted by customer ID). Grid will include the customer ID and customer name. It would be great if the user could begin typing the customer number and it will move to that row (or the closest matching row). If there an option for the Grid control to do that?

I think I am finally getting a hang of the GUI, thanks for all your help.

Mark
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: Help with using IDE

Post by Rathinagiri »

Did you sort your table in customer id before loading data? Incremental search (of the first column only!) is effective irrespective of the fact that you have sorted or not sorted the data.

Please check this sample

Code: Select all

#include <hmg.ch>

Function Main

   define window sample at 0, 0 width 800 height 600 main
      define label sortedlabel
         row 10
         col 10
         width 200
         value 'Grid with sorted data'
      end label   
      define grid sorted
         row 40
         col 10
         width 200
         widths { 100, 100 }
         headers { 'Month', 'ID' }
         height 200
         items { ;
                 {'April', 'Month4' },;
                 {'August', 'Month8' },;
                 {'December', 'Month12' },;
                 {'February', 'Month2' },;
                 {'January', 'Month1' },;
                 {'July', 'Month7' },;
                 {'June', 'Month6' },;
                 {'March', 'Month3' },;
                 {'May', 'Month5' },;
                 {'November', 'Month11' },;
                 {'October', 'Month10' },;
                 {'September', 'Month9' } }
         value 1
      end grid         
      define label unsortedlabel
         row 240
         col 10
         width 200
         value 'Grid with unsorted data'
      end label   
      define grid unsorted
         row 270
         col 10
         width 200
         widths { 100, 100 }
         headers { 'Month', 'ID' }
         height 200
         items { {'January', 'Month1' },;
                 {'February', 'Month2' },;
                 {'March', 'Month3' },;
                 {'April', 'Month4' },;
                 {'May', 'Month5' },;
                 {'June', 'Month6' },;
                 {'July', 'Month7' },;
                 {'August', 'Month8' },;
                 {'September', 'Month9' },;
                 {'October', 'Month10' },;
                 {'November', 'Month11' },;
                 {'December', 'Month12' }}
         value 1
      end grid         
   end window
   sample.center
   sample.activate
Return

East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Help with using IDE

Post by esgici »

Hi Mark
MGOLDFARB wrote:... The grid now working.
That's good news :!: :)
MGOLDFARB wrote: The table has a few thousand entries (list is sorted by customer ID). Grid will include the customer ID and customer name. It would be great if the user could begin typing the customer number and it will move to that row (or the closest matching row). If there an option for the Grid control to do that?
As Rathi said, you are about Incremental search and an effective Incremental search require sorted ( or indexed ;) ) data.
In other hand, GRID ( and BROWSE too) is a AS IS control (like all others) doesn't (and not required) including such extra features.
For example, where ( into which control) user could begin typing their search data ?

As the result, for building an incremental search feature, you need do something extras ;)

Follow the example introduced by Rathi; surely it will help to you.

Moreover you can look at my humble example Quick Search.

It's not for GRID, but BROWSE; anyway I hope to give an idea to you :idea:
MGOLDFARB wrote: I think I am finally getting a hang of the GUI...
You are welcome to wonderful land of HMG :!: :)

Happy HMG'ing :D
Viva INTERNATIONAL HMG :D
MGOLDFARB
Posts: 71
Joined: Thu Jun 21, 2012 7:46 am

Re: Help with using IDE

Post by MGOLDFARB »

Thanks for the code. It does exactly what I want. However, I cannot figure out how to implement it into my code. I designed the form IDE, it is a FMG file. Which property allows me to do the incremental search? Overall your code looks very similar to the FMG code that is created.

In case it is helpful, here is the code of the FMG file for the form.

Code: Select all

* HMG-IDE Form Designer Generated Code
* (c) Roberto Lopez - http://sites.google.com/site/hmgweb

DEFINE WINDOW TEMPLATE AT 133 , 302 WIDTH 550 HEIGHT 350 VIRTUAL WIDTH Nil VIRTUAL HEIGHT Nil TITLE "" ICON NIL  CURSOR NIL ON INIT Nil ON RELEASE Nil ON INTERACTIVECLOSE Nil ON MOUSECLICK Nil ON MOUSEDRAG Nil ON MOUSEMOVE Nil ON SIZE Nil ON MAXIMIZE Nil ON MINIMIZE Nil ON PAINT Nil BACKCOLOR Nil NOTIFYICON NIL NOTIFYTOOLTIP NIL ON NOTIFYCLICK Nil ON GOTFOCUS Nil ON LOSTFOCUS Nil ON SCROLLUP Nil ON SCROLLDOWN Nil ON SCROLLLEFT Nil ON SCROLLRIGHT Nil ON HSCROLLBOX Nil ON VSCROLLBOX Nil

    DEFINE GRID Grid_1
        ROW    90
        COL    40
        WIDTH  470
        HEIGHT 200
        ITEMS { {""} }
        VALUE 1
        WIDTHS { 170,300 }
        HEADERS {'Client ID','Client Name'}
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        ONCHANGE Nil
        ONGOTFOCUS Nil
        ONLOSTFOCUS Nil
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONDBLCLICK Nil
        ONHEADCLICK Nil
        ONQUERYDATA Nil
        MULTISELECT .F.
        ALLOWEDIT .F.
        VIRTUAL .F.
        DYNAMICBACKCOLOR Nil
        DYNAMICFORECOLOR Nil
        COLUMNWHEN Nil
        COLUMNVALID Nil
        COLUMNCONTROLS {{'TEXTBOX','NUMERIC','9999'},{'TEXTBOX','CHARACTER'}}
        SHOWHEADERS .T.
        CELLNAVIGATION .F.
        NOLINES .F.
        HELPID Nil
        IMAGE Nil
        JUSTIFY Nil
        ITEMCOUNT Nil
        BACKCOLOR NIL
        FONTCOLOR NIL
        HEADERIMAGES Nil
        ROWSOURCE "Clients"
        COLUMNFIELDS {'cl_id','cl_name'}
        ALLOWAPPEND .F.
        ALLOWDELETE .F.
        BUFFERED .F.
        DYNAMICDISPLAY Nil
        ONSAVE Nil
        LOCKCOLUMNS 0
    END GRID

    DEFINE TEXTBOX Next_Client_ID
        ROW    40
        COL    220
        WIDTH  120
        HEIGHT 24
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        ONCHANGE Nil
        ONGOTFOCUS Nil
        ONLOSTFOCUS Nil
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONENTER Nil
        HELPID Nil
        TABSTOP .T.
        VISIBLE .T.
        READONLY .F.
        RIGHTALIGN .F.
        DISABLEDBACKCOLOR Nil
        DISABLEDFONTCOLOR Nil
        CASECONVERT NONE
        BACKCOLOR NIL
        FONTCOLOR NIL
        INPUTMASK Nil
        FORMAT Nil
        NUMERIC .T. 
        VALUE Nil
    END TEXTBOX

END WINDOW
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: Help with using IDE

Post by Rathinagiri »

Hi,

I have done nothing actually. It is the default property of the ListView32 control of Windows32 API. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
MGOLDFARB
Posts: 71
Joined: Thu Jun 21, 2012 7:46 am

Re: Help with using IDE

Post by MGOLDFARB »

Ok. Any suggestions then in the grid I outlined above, it does not work?
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Help with using IDE

Post by esgici »

MGOLDFARB wrote: ...It would be great if the user could begin typing the customer number and it will move to that row (or the closest matching row). If there an option for the Grid control to do that?
esgici wrote:GRID doesn't include such extra features.
For example, where ( into which control) user could begin typing their search data ?
As the result, for building an incremental search feature, you need do something extras
.
MGOLDFARB wrote:Which property allows me to do the incremental search?
I don't know how I can help you :?

Does may be such sample : Browsing a table via GRID :?:
Viva INTERNATIONAL HMG :D
Post Reply