Page 1 of 2
Error within BASIC class, New() method
Posted: Fri Sep 23, 2011 12:55 pm
by concentra
In the following code:
Code: Select all
#include "hmg.ch"
/***********************************/
FUNCTION Main()
/***********************************/
LOCAL oWindow
LOCAL oToolBar
LOCAL oButton1
HbQt_ErrorSys()
WITH OBJECT oWindow := Window():New()
WITH OBJECT oToolBar := ToolBar():New()
WITH OBJECT oButton1 := ToolButton():New("oButton1")
:Caption := 'Call dialog'
:OnClick := { || CallDialog() }
END WITH
END WITH
END WITH
oWindow:Activate()
RETURN NIL
/***********************************/
STATIC FUNCTION CallDialog()
/***********************************/
LOCAL oDlg
LOCAL oButtonBox
WITH OBJECT oDlg := Dialog():New( "oDlg" )
:Width := 200
:Center()
WITH OBJECT oButtonBox := ButtonBox():New("oButtonBox")
:addButton( BUTTON_OK ,, { || oDlg:Accept() } )
:addButton( BUTTON_CANCEL,, { || oDlg:Reject() } )
END WITH
END WITH
oDlg:Activate()
RETURN NIL
If the button that calls the dialog is clicked more than one time I get an error:
error within BASIC class, New() method
And I was unable to find why...
Re: Error within BASIC class, New() method
Posted: Fri Sep 23, 2011 2:18 pm
by mrduck
The problem reported is a serious one...
you can temporary solve with
concentra wrote:
WITH OBJECT oDlg := Dialog():New( )
but the underlying problem is more serious...
Re: Error within BASIC class, New() method
Posted: Fri Sep 23, 2011 3:55 pm
by concentra
Francesco, I don't know if it's related but if the buttonbox is removed, another error rises, related to eventloop, when the dialog is closed.
Re: Error within BASIC class, New() method
Posted: Fri Sep 23, 2011 4:04 pm
by mrduck
concentra wrote:Francesco, I don't know if it's related but if the buttonbox is removed, another error rises, related to eventloop, when the dialog is closed.
Please, a code snippet... I've never used dialog.... ( I think to know what this problem is, but I need a piece of code to test)
Re: Error within BASIC class, New() method
Posted: Fri Sep 23, 2011 4:17 pm
by concentra
mrduck wrote:Please, a code snippet... I've never used dialog.... ( I think to know what this problem is, but I need a piece of code to test)
The very same, without the buttonbox:
Code: Select all
#include "hmg.ch"
/***********************************/
FUNCTION Main()
/***********************************/
LOCAL oWindow
LOCAL oToolBar
LOCAL oButton1
HbQt_ErrorSys()
WITH OBJECT oWindow := Window():New()
WITH OBJECT oToolBar := ToolBar():New()
WITH OBJECT oButton1 := ToolButton():New("oButton1")
:Caption := 'Call dialog'
:OnClick := { || CallDialog() }
END WITH
END WITH
END WITH
oWindow:Activate()
RETURN NIL
/***********************************/
STATIC FUNCTION CallDialog()
/***********************************/
LOCAL oDlg
LOCAL oButtonBox
WITH OBJECT oDlg := Dialog():New( "oDlg" )
:Width := 200
:Center()
// WITH OBJECT oButtonBox := ButtonBox():New("oButtonBox")
// :addButton( BUTTON_OK ,, { || oDlg:Accept() } )
// :addButton( BUTTON_CANCEL,, { || oDlg:Reject() } )
// END WITH
END WITH
oDlg:Activate()
RETURN NIL
Re: Error within BASIC class, New() method
Posted: Fri Sep 23, 2011 4:22 pm
by mrduck
With or without that lines the problem stays.... I understand it, I will fix later.
Re: Error within BASIC class, New() method
Posted: Fri Sep 23, 2011 4:40 pm
by concentra
Another question...
Is keyboard navigation disabled by default in grids ?
I can't navigate using keyboard, only with mouse...
Code: Select all
#include "hmg.ch"
#include "hbqtgui.ch"
/*******/
FUNCTION Main()
/*******/
LOCAL oWindow
LOCAL oGrid
LOCAL I
LOCAL aStru := { { "FIELD1", "C", 12, 0 },;
{ "FIELD2", "C", 12, 0 },;
{ "FIELD3", "C", 12, 0 } }
HbQt_ErrorSys()
DBCREATE( "TESTE", aStru )
USE TESTE
FOR I := 1 TO 100
DBAPPEND()
TESTE->FIELD1 := "1111"
TESTE->FIELD2 := "2222"
TESTE->FIELD3 := "3333"
NEXT
GO TOP
WITH OBJECT oWindow := Window():New()
:Width := 780
:Height := 500
WITH OBJECT oGrid := VirtualGrid():New("oGrid")
:Width := 770
:Height := 490
:WorkArea := 'TESTE'
END WITH
END WITH
oWindow:Activate()
RETURN NIL
Re: Error within BASIC class, New() method
Posted: Fri Sep 23, 2011 4:49 pm
by Rathinagiri
Nope. Keyboard navigation is not disabled by default.
However, cellnavigation is disabled by default in HMG3.
Re: Error within BASIC class, New() method
Posted: Fri Sep 23, 2011 6:45 pm
by concentra
rathinagiri wrote:Nope. Keyboard navigation is not disabled by default.
It's related to Harbour build.
I returned a previous 3.1 Harbour version and the navigation is ok again.
Re: Error within BASIC class, New() method
Posted: Fri Sep 23, 2011 6:51 pm
by mrduck
Mauricio,
I have a set of commits to make, one solves this problem. DoKeyboardEvent in a point returns .T., change to .F.
An event that returns .T. stops the "event train", it means Qt doesn't handle the event... with .F. Qt handles the event...
In HMG4 Changelog this is described