Selezione con il mouse
Moderator: wriedmann
Selezione con il mouse
Domanda sicuramente ...banale.
In una DataBrowser come quella dell'esempio cosa devo fare per poter scegliere il record evidenziato con il doppio click del mouse in alternativa alla scelta con il Default Button?
Grazie per i suggerimenti...
In una DataBrowser come quella dell'esempio cosa devo fare per poter scegliere il record evidenziato con il doppio click del mouse in alternativa alla scelta con il Default Button?
Grazie per i suggerimenti...
Re: Selezione con il mouse
Your Defaultbutton has the code to return the complete record?
Pseudocode:
GfBBrowser inherit Databrowser
Method MouseButtonDoubleclick(..)
Super: Method MouseButtonDoubleclick(..)
Self:Owner:yourButtonname
...
Pseudocode:
GfBBrowser inherit Databrowser
Method MouseButtonDoubleclick(..)
Super: Method MouseButtonDoubleclick(..)
Self:Owner:yourButtonname
...
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Re: Selezione con il mouse
Hi Karl,
this is the code (ButtonOk is the default button) but when you double click nothing happens.
What did I forget?
Thank you!
Gfb
this is the code (ButtonOk is the default button) but when you double click nothing happens.
What did I forget?
Thank you!
Gfb
Code: Select all
method MouseButtonDoubleClick(oMouseEvent) class ScegliSchBrowse
local nButtonID as int
nButtonID := IIf(oMouseEvent == NULL_OBJECT, 0, oMouseEvent:ButtonID)
super:MouseButtonDoubleClick(oMouseEvent)
//Put your changes here
self:Owner:ButtonOK() // Return choice code to the Owner
return nil
gfb
Re: Selezione con il mouse
Hi all!
Riprendo X# dopo alcuni mesi in cui ho fatto altro.
In una dataBrowse non riesco a selezionare un record usando DoubleClick.
Di seguito il mio codice, sia con ButtonDoubleClick() che con MouseButtonDoubleClick(), come di seguito.
Per capire meglio cosa sbaglio allego un piccolo AEF di esempio.
Grazie per ogni suggerimento: certamente c'è qualcosa che manca...
Gfb
Riprendo X# dopo alcuni mesi in cui ho fatto altro.
In una dataBrowse non riesco a selezionare un record usando DoubleClick.
Di seguito il mio codice, sia con ButtonDoubleClick() che con MouseButtonDoubleClick(), come di seguito.
Code: Select all
method ButtonDoubleClick(oControlEvent) class StdDataWindow
local oControl as Control
LOCAL oTB as TextBox
oControl := iif(oControlEvent == null_object, null_object, oControlEvent:Control)
super:ButtonDoubleClick(oControlEvent)
//Put your changes here
self:Owner:ViewRecord()
return nil
method MouseButtonDoubleClick(oMouseEvent) class StdDataWindow
local nButtonID as int
LOCAL oTB as TextBox
nButtonID := iif(oMouseEvent == null_object, 0, oMouseEvent:ButtonID)
super:MouseButtonDoubleClick(oMouseEvent)
//Put your changes here
self:Owner:ViewRecord()
return nil
METHOD ViewRecord() CLASS StandardShellWindow
LOCAL oTB as TextBox
oTB := TextBox{self, "View record", "Record n. " + NTrim(self:oNewChild:Server:RECNO)}
oTB:Type := BUTTONOKAY
oTB:Show()
RETURN nil
Grazie per ogni suggerimento: certamente c'è qualcosa che manca...
Gfb
- Attachments
-
- Test-DoubleClick.zip
- (9.86 KiB) Downloaded 164 times
gfb
Re: Selezione con il mouse
Hi Gian,
Unfortunately due to the way the VOSDK and the DataBrowser is designed, you need to trap this at the browser level, in a subclass. Create one like this:
and then in the Init() of your StdDataWindow add this just after the SUPER:Init() call, in order to tell it to create the databrowser using your new class:
then, you can define a method in the window to do what you want:
Unfortunately due to the way the VOSDK and the DataBrowser is designed, you need to trap this at the browser level, in a subclass. Create one like this:
Code: Select all
CLASS ParentDataBrowser INHERIT DataBrowser
METHOD CellDoubleClick() CLASS ParentDataBrowser
IF IsMethod(SELF:Owner,#SubFormCellDoubleClick)
Send(SELF:Owner,#SubFormCellDoubleClick)
END IF
RETURN NIL
Code: Select all
SUPER:Init(oParentWindow)
SELF:BrowserClass := #ParentDataBrowser
Code: Select all
METHOD SubFormCellDoubleClick() CLASS StdDataWindow
SELF:Owner:ViewRecord()
RETURN NIL
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Re: Selezione con il mouse
Hi Chris,
thanks for your time!
In VO it works well; in XIDE it gives me this error: and this is the line of code that generates the error (line 54):
and this is the DoOpenFile() method
Thanks for the tips
gfb
thanks for your time!
In VO it works well; in XIDE it gives me this error: and this is the line of code that generates the error (line 54):
Code: Select all
SELF:oNewChild:ViewAs(#BrowseView)
Code: Select all
METHOD DoOpenFile(cFileName, lReadOnly, cIndex)
LOCAL oTB AS TextBox
IF (Len(cFileName) > 3 ) .AND. (Upper(Right(cFileName, 4)) == ".DBF")
SELF:oNewChild := StdDataWindow{SELF, cFileName, lReadOnly}
SELF:oNewChild:ViewAs(#BrowseView)
// Imposta ReadOnly
SELF:oNewChild:Browser:SetStandardStyle(gbsReadOnly)
SELF:oNewChild:Show(SHOWCENTERED)
ELSE
oTB := TextBox{SELF, "File Open Error", "Cannot open " + cFileName + " - Not a DBF file"}
oTB:Type := BUTTONOKAY
oTB:Show()
ENDIF
RETURN SELF
gfb
gfb
Re: Selezione con il mouse
Gian,
Add a constructor to the class
Robert
Add a constructor to the class
Code: Select all
CLASS ParentDataBrowser INHERIT DataBrowser
CONSTRUCTOR(oOwner, xID, oPoint, oDimension)
SUPER(oWin, xID, oPoint, oDimension)
RETURN
METHOD CellDoubleClick() CLASS ParentDataBrowser
IF IsMethod(SELF:Owner,#SubFormCellDoubleClick)
Send(SELF:Owner,#SubFormCellDoubleClick)
END IF
RETURN NIL
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Re: Selezione con il mouse
Thanks Robert,
but the error is the same on the line:
gfb
but the error is the same on the line:
Code: Select all
SELF:oNewChild:ViewAs(#BrowseView)
gfb
Re: Selezione con il mouse
If you remove the line
then the browser opens?
Robert
Code: Select all
SELF:BrowserClass := #ParentDataBrowser
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Re: Selezione con il mouse
If I remove the line:
there is a new error:
"..description : No exported method 'SETSTANDARDSTYLE'
Subsystem : BASE
GenCode : EG_NOMETHOD No exported method"
at line:.
If I remove this line too, the browser opens but Double Click doesn't work...
gfb
Code: Select all
SELF:BrowserClass := #ParentDataBrowser
"..description : No exported method 'SETSTANDARDSTYLE'
Subsystem : BASE
GenCode : EG_NOMETHOD No exported method"
at line:
Code: Select all
SELF:oNewChild:Browser:SetStandardStyle(gbsReadOnly)
If I remove this line too, the browser opens but Double Click doesn't work...
gfb
gfb