Hello All,
Is there any way how can I add item in grid combo box. For example, suppose there is a one to many sale bill entry form, where I am using a grid for bill details entry (product, rate, qty etc.). During bill entry, user wants to add one product (using product master form), but I can't find any way how to add this product into the grid combo box item array.
Thanks in advance.
With best regards.
Sudip
How to add item in Grid Combo Box
Moderator: Rathinagiri
How to add item in Grid Combo Box
With best regards,
Sudip
Sudip
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How to add item in Grid Combo Box
Hi Sudip,
Kindly use this 6 line small UDF hack.
Kindly use this 6 line small UDF hack.
Code: Select all
#include <minigui.ch>
Function Main
define window s at 0,0 width 600 height 400 main
define grid g
row 10
col 10
width 500
height 200
headers {"Name","City","Amount"}
widths {200,150,100}
allowedit .t.
COLUMNCONTROLS { {'TEXTBOX','CHARACTER'},{'COMBOBOX',{'CHENNAI','DELHI','KOLKATTA'}} , { 'TEXTBOX' ,'NUMERIC' ,"999999.99" } }
items {{"Giri",1,1000},{"Sudip",3,2000}}
end grid
define button b
row 230
col 10
width 200
caption "Add a new item in city"
action AddGridEditComboItem("g","s",2,"MUMBAI")
end button
end window
s.center
s.activate
Return
function AddGridEditComboItem(cGridName,cWindowName,nColIndex,cNewItem)
local i := 0
local aEditControls := {}
i := GetControlIndex ( cGridName , cWindowName )
aEditcontrols := _HMG_SYSDATA [ 40 ] [ i ] [ 2 ]
aadd(aEditControls [nColIndex] [2],cNewItem)
_HMG_SYSDATA [ 40 ] [ i ] [ 2 ] := aClone(aEditControls)
return nil
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How to add item in Grid Combo Box
If you want to alphabetically sort the items after adding the new item, use this. 
Code: Select all
function AddGridEditComboItem(cGridName,cWindowName,nColIndex,cNewItem)
local i := 0
local aEditControls := {}
i := GetControlIndex ( cGridName , cWindowName )
aEditcontrols := _HMG_SYSDATA [ 40 ] [ i ] [ 2 ]
aadd(aEditControls [nColIndex] [2],cNewItem)
asort(aEditControls [nColIndex] [2])
_HMG_SYSDATA [ 40 ] [ i ] [ 2 ] := aClone(aEditControls)
return nil
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: How to add item in Grid Combo Box
Rathi,
You are a magician
It works excellent
With best regards.
Sudip
You are a magician
With best regards.
Sudip
With best regards,
Sudip
Sudip