[Gambas-user] Re; Grid

Steven Lobbezoo steven at ...1652...
Mon May 14 15:18:47 CEST 2007


Hi Gareth,

I'm toying around a bit with your dbgrid.
It looks just fine, but I have one major problem.
I've tables with references to other tables. I want the user to see an other 
column in the refrenced table, but after he selects some value there (works 
ok) i want to do the update on the original table with the reference value.

Can this be done with your grid?

Steven



Le vendredi 4 mai 2007 11:55, Gareth Bult a écrit :
> Ok, incorporated into the component - seems to work fine .. :)
> New release at http://encryptec.net/software/gambas-grideditor
>
> I now have tiered chaining working based on "change" events ..
> i.e. (n) tables linked in a master-slave hierarchy where the slave(s)
> auto-update when someone changes rows on the master ..
> (screen shot on the page)
>
> Gareth.
>
> On Fri, 2007-05-04 at 10:25 +0100, Gareth Bult wrote:
> > Hi,
> >
> > Thanks for that .. one problem I have however .. when you click (or
> > double click) on a header , it doesn't generate an Mouse event.
> > ... it only generates an event if you're over the grid ...
> >
> > However, playing with mouse clicks has I think led to a solution.
> >
> > A double click on a header generates a DblClick.
> > A double click on a cell generates both DblClick and MOUSE events (!)
> >
> > A single click on a cell generates a Mouse Down + Mouse UP.
> > A double click generates a Mouse Down and 2 x Mouse UP. (I'm guessing
> > the second "DOWN" becomes the DblClick)
> >
> > So, if I don't get associated mouse commands, it must be a double click
> > on a header ... :-)
> >
> > Now to code it ... :)
> >
> > Gareth.
> >
> > On Fri, 2007-05-04 at 11:03 +0200, ron wrote:
> > > On Friday 04 May 2007 10:11, Gareth Bult wrote:
> > > > Yup, this is the issue I have .. it can be made to work "mostly" ..
> > > >
> > > > However, writing applications that work "mostly" doesn't really do it
> > > > for me ... :(
> > > >
> > > > My solution for now is to use a keyboard event rather than a double
> > > > click ...
> > > > If anyone has a working calculation I'm all ears ... :)
> > > >
> > > > Gareth.
> > >
> > > This routine checks if the mouse x/y is above a cell and not in the
> > > space below/right of it
> > >
> > > ' waiting for updated gambas, function is add on my request
> > > PUBLIC FUNCTION hGrid at ...1692...(x AS Integer, Y AS Integer) AS Boolean
> > > ' returns true if out range
> > >   DIM gx, gy AS Integer
> > >   DIM gc, gr AS Integer
> > >   gx = 0
> > >   gy = 0
> > >   gc = 0
> > >   gr = 0
> > >   WITH hGrid
> > >     gx = .Columns[0].Width
> > >     WHILE x > gx
> > >       INC gc
> > >       IF gc > (.Columns.Count - 1) THEN RETURN TRUE
> > >       gx += .Columns[gc].Width
> > >     WEND
> > >     gy = .rows[0].Height
> > >     WHILE y > gy
> > >       INC gr
> > >       IF gr > (.rows.Count - 1) THEN RETURN TRUE
> > >       gy += .rows[gr].Height
> > >     WEND
> > >     .Column = gc
> > >     .Row = gr
> > >   END WITH
> > > END
> > >
> > >
> > > As mentioned the GridVie.Find is implement and here as private
> > > subroutine 'hGrid at ...1692...' hFrid is the handle for the GridView control.
> > >
> > > The calculation is here done.
> > > In fact I set the .Row and .Column properties so after a call the
> > > return boolean tells you if it is a valid hit or not.
> > > When valid the GridView.Row and GridView.Column are set correct.
> > >
> > > -----------------
> > >
> > > Here I did use the service
> > > grdFields is the name of the GridView and the hGrid handle of it
> > > GridCtrlHide routine did hide the overlay controls for editing.
> > > GridCtrlShow routine shows the appropriate control for the .Row
> > >
> > > The Gridview is used with on the row the value/properties of a field in
> > > database table. Every row has his own control as
> > > textbox/listbox/combobox/checkbox Every column is the representation of
> > > a field.
> > > The result is transformed to a MySQL query
> > > Code is never been clean up of remarks etc.(shame to me)
> > >
> > >
> > > PUBLIC SUB grdFields_MouseDown()
> > > 'PRINT "grdFields_MouseDown:"; grdFields.Row; "/"; grdFields.Column
> > > 'PRINT mouse.X
> > >
> > >   'if ctrl then save value if editing
> > >   IF ctrTBX.Visible THEN ctrTBXSave
> > >   GridCtrlHide
> > >
> > >   'and go to new position
> > >  ' IF grdFields at ...1692...(mouse.x, mouse.y) THEN RETURN
> > > ' GridCtrlShow(grdFields.Row, grdFields.Column)
> > > END
> > >
> > > PUBLIC SUB grdFields_MouseMove()
> > >   IF mouse.Left THEN
> > > 'PRINT "grdFields_MouseMove"
> > >
> > >     'check in gridcell
> > >     IF ME.grdFields at ...1692...(mouse.X, mouse.Y) THEN RETURN
> > >    ' IF ME.grdFields.Find(mouse.X, mouse.Y) THEN RETURN
> > >     grd.CtrlHide
> > >     Drag.Icon = picture["img/16/gambas.png"]
> > >     drag(grdFields, MIME_TYPE_GRID)
> > >   END IF
> > > END
> > >
> > > PUBLIC SUB grdFields_MouseUp()
> > > DIM vVal AS Variant
> > > 'PRINT "grdFields_MouseUp"; grdFields.Row; "/"; grdFields.Column
> > >
> > >   GridCtrlHide
> > >
> > >   IF grdFields at ...1692...(mouse.x, mouse.y) THEN RETURN
> > >
> > >   IF grdFields.row = grd.GRDVIS THEN
> > >     ' row/column for write data in grid
> > >     grdFields.Tag = [grdFields.Row, grdFields.Column]
> > >     vVal = IIf(UCase(grdFields[grdFields.Row, grdFields.Column].Text) =
> > > "YES", "No", "Yes") GridWrite(vVal)
> > >   ELSE
> > >     GridCtrlShow(grdFields.Row, grdFields.Column)
> > >   ENDIF
> > >
> > > END
> > >
> > > -----
> > >
> > > Ron
> > >
> > >
> > > -----------------------------------------------------------------------
> > >-- This SF.net email is sponsored by DB2 Express
> > > Download DB2 Express C - the FREE version of DB2 express and take
> > > control of your XML. No limits. Just data. Click to get it now.
> > > http://sourceforge.net/powerbar/db2/
> > > _______________________________________________
> > > Gambas-user mailing list
> > > Gambas-user at lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________ Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user




More information about the User mailing list