|
Post by meerkat on Jun 7, 2020 7:23:35 GMT -5
When a grid is reloaded it executes the selection event for the first row. Is this a feature?
|
|
|
Post by meerkat on Jun 8, 2020 6:07:06 GMT -5
If this is a feature, is there a way to turn it off. When a grid is reloaded it executes the trigger for the selection of item 0 in the grid. Currently I fill grid items 1 -> n. If I get a selection of item 0 I ignore it.
Thanks for the help.. Dan
|
|
|
Post by metro on Jun 8, 2020 6:23:48 GMT -5
If this is a feature, is there a way to turn it off. When a grid is reloaded it executes the trigger for the selection of item 0 in the grid. Currently I fill grid items 1 -> n. If I get a selection of item 0 I ignore it. Thanks for the help.. Dan G'Day Dan, not sure I understand the problem exactly, What I see when the grid is loaded is the location (highlighted and prints to mainwin) ie cellxy$() which is 0,0
and not the contents of the cell ie the value$(). can you throw up some code for us to see the problem
|
|
|
Post by meerkat on Jun 8, 2020 7:18:39 GMT -5
Howdy, yAll down yunder.. The program I have is rather large and complex with 5 grids. What I want is: Selection of a item in grid 1 will reload grid 2 Selection of a item in grid 2 will reload grid 3 .....>>
However; A simple example. We have a country with states, states with county, and county with cities. dim countryGrid$(1,10) dim stateGrid$(1,10) dim countyGrid$(1,10) dim cityGrid(1,10) grid #main.gCountry, countryGrid$(), [useCountry] ,col,row,wide,high grid #main.gstate, stateGrid$(), [useState] ,col,row,wide,high grid #main.gCounty, countyGrid$(), [useCounty] ,col,row,wide,high grid #main.gCity, cityGrid$(), [useCity] ,col,row,wide,high
' To get started, fill the countryGrid$() with desired countries. Then reload() it. ' The reload of #main.gCountry causes it to go to the lable [useCountry] ' as if the first line (0) was selected (clicked).
#main.gCountry reload() wait
' This label is executed with col$,row$ at zero. No one has selected (clicked) ' anything in the country grid. It is executed after the reload() command, ' when I think it should have waited (wait). ' [useCountry] xy$ = #main.gCountry cellxy$() col$ = word$(xy$,1," ") ' this is zero row$ = word$(xy$,2," ") ' this is zero
Thanks for the help..
yAll have a great day. Dan
|
|
|
Post by metro on Jun 8, 2020 8:53:45 GMT -5
Hav'n a great day here Dan, glass half full (and it's red) If I understand this correctly I think it's a bug , I simply set the selectxy() outside the range after a reload to avoid the issue not really done any testing though (and code just thrown together)
EDIT: using reload() before the wait statement causes an automatic selection of grid(0,0)
dim countryGrid$(1,10) dim stateGrid$(1,10) dim cityGrid$(1,10) countryGrid$(0,0)="USA" countryGrid$(0,1)="UK" countryGrid$(0,2)="RUSSIA" countryGrid$(0,3)="CHINA" countryGrid$(0,4)="AUSTRALIA" stateGrid$(0,0) = "WA" cityGrid$(0,0)= "PERTH" col=20:row=40:wide=200:high=90
WindowWidth=900 WindowHeight=650 textbox #main.tb1,300,200,100,30 grid #main.gCountry, countryGrid$(), [useCountry] ,col+20,row+10,wide,high grid #main.gstate, stateGrid$(), [useState] ,col+20,row+100,wide,high grid #main.gCity, cityGrid$(), [useCity] ,col+20,row+200,wide,high open "Grid test" for window as #main #main.gCountry columnwidths(100) ' To get started, fill the countryGrid$() with desired countries. Then reload() it. ' The reload of #main.gCountry causes it to go to the lable [useCountry] ' as if the first line (0) was selected (clicked).
'#main.gCountry selectxy(100,100) #main.gCountry reload() '**************CAUSES GRID TO MAKE CHOICE ********** wait ' This label is executed with col$,row$ at zero. No one has selected (clicked) ' anything in the country grid. It is executed after the reload() command, ' when I think it should have waited (wait). ' [useCountry] xy$ = #main.gCountry cellxy$() #main.tb1 xy$ print xy$ print "clicked: "; #main.gCountry cellxy$()
'#main.gCountry reload() '#main.gCountry selectxy(100,100)'**********REMOVES FOCUS AFTER A SELECTION WAIT [useState]
xy$ = #main.gstate cellxy$() print "clicked: "; #main.gstate cellxy$() #main.gstate reload() #main.gstate selectxy(100,100) WAIT [useCity]
WAIT
|
|
|
Post by Carl Gundel on Jun 8, 2020 9:30:03 GMT -5
Hav'n a great day here Dan, glass half full (and it's red) If I understand this correctly I think it's a bug , I simply set the selectxy() outside the range after a reload to avoid the issue not really done any testing though (and code just thrown together) Are you referring to the drawing behavior of stacking the grids on top of each other?
|
|
|
Post by metro on Jun 8, 2020 9:37:27 GMT -5
Sorry Carl just thrown together before I hit the sack down here. The first position in a grid is automatically selected upon a reload of a grid So if Dan's intention is to select from a second grid based upon the fist grids selection He will always get location 0 0 of a reloaded grid. Hope that makes sense. On my tablet so keyboard a bit small, time 4 some zzzzzzz
|
|
|
Post by meerkat on Jun 9, 2020 4:02:30 GMT -5
Wow! This took a couple hours to figure out. Kinda crazy to explain.
I have a grid. When I do a grid reload() it executes the grid branch label. But only if you have rownames() defined.
In the following code if you comment out #main.gDb rownames("File","Loc","Id") it works. But if you leave the rownames() in when you run the program it executes the grid branch label [useDb]. Now comment it out again and it still executes the branch label. It seem to remember info from the previous rownames() command.
dim dbGrid$(2,10)
WindowWidth = 1200 WindowHeight = 570 UpperLeftX = 200 UpperLeftY = 200 grid #main.gDb, dbGrid$(), [useDb] ,010,110,320,224
open "Test" for window_nf as #main #main "Font Arial 10 Bold"
'---- grid db #main.gDb columnwidths(120,300,50) #main.gDb rownames("File","Loc","Id") '<<<<< Comment out to work #main.gDb rowlabelwidth(0) gosub [getDbInfo] ' get initial database information wait
[exit] close #main end
' ---------------------------- ' get grid info ' ---------------------------- [getDbInfo] dbGrid$(0,0) = "aaa.db" dbGrid$(1,0) = "E\LB5\" dbGrid$(2,0) = "5" dbGrid$(0,1) = "stockMarket.db" dbGrid$(1,1) = "E\LB5\" dbGrid$(2,1) = "4" dbGrid$(0,2) = "test.db" dbGrid$(1,2) = "E\LB5\" dbGrid$(2,2) = "1" dbGrid$(0,3) = "bbb.db" dbGrid$(1,3) = "E\rbp101\projects\wine_project\data\" dbGrid$(2,3) = "2" dbGrid$(0,4) = "xxx.db" dbGrid$(1,4) = "E\rbp101\projects\wineWatch_project\data\" dbGrid$(2,4) = "3" #main.gDb reload() print "Just completed reload" RETURN
' ---------------------------------- ' Selected dbFile ' create grid for this DB ' ---------------------------------- [useDb] xy$ = #main.gDb cellxy$() col$ = word$(xy$,1," ") row$ = word$(xy$,2," ") col = val(col$) row = val(row$) print "why am i here" wait
RETURN
Hope this helps.. Dan
|
|