Welcome to the Project Developers' Table

Moderator: Rathinagiri

User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Welcome to the Project Developers' Table

Post by Roberto Lopez »

mrduck wrote:IMPORTANT:
hmg code must be updated for this change:
HB_*Class:from( pPtr ) => *ClassFromPointer( pPtr )
<...>
At first thanks.

Since you have adequate permissions already, could be better if you commit the changes yourself.

Thanks again.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Re: Welcome to the Project Developers' Table

Post by mrduck »

rathinagiri, can you please apply this patch to grid.prg ?
Its use is to set the value returned by the keypress event method when Enter is pressed... now the focus is moved to the next cell, while sometimes it is good to not move the cursor.

This change is perfectly compatible with how hmg 4 actually works (I think it is also compatible hmg 3) as the default value is .F.

Code: Select all


....
   DATA lReturnValueOnEnter                       INIT   .F.
....
   METHOD ReturnValueOnEnter                      SETGET
....
METHOD ReturnValueOnEnter( lValue ) CLASS GRID
   DEFAULT lValue TO .F.

   IF Pcount() == 0
      RETURN ::lReturnValueOnEnter
   ELSEIF Pcount() == 1
      ::lReturnValueOnEnter := lValue
   ENDIF

   RETURN NIL

and of course in METHOD DoCellKeyBoardEvents( e ) Class GRID

Code: Select all

        ::oQTObject:removeCellWidget( ::nCellRow-1,::nCellCol-1 )
        return ::lReturnValueOnEnter   // Here return the value
     CASE nKey == Qt_Key_Escape .and. nModifiers == Qt_NoModifier
        xValue := ::xOldValue
        Self:Cell( ::nCellRow,::nCellCol,xValue )
mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Re: Welcome to the Project Developers' Table

Post by mrduck »

Roberto Lopez wrote: Since you have adequate permissions already, could be better if you commit the changes yourself.
Since I cannot access svn repository from work I need convert from svn to mercurial (another system similar (but better :-)) to svn) on a server I have on the net and work from that repository... so I have no way to easily add that patch to svn in a relatively short time....

this is the reason why I propose the changes but don't commit myself

I hope you understand
User avatar
bedipritpal
Posts: 122
Joined: Thu Sep 02, 2010 10:47 pm

Re: Welcome to the Project Developers' Table

Post by bedipritpal »

Roberto Lopez wrote: Print text alignment is not working anymore.
What is the problem ?
enjoy hbIDEing... Pritpal Bedi
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Welcome to the Project Developers' Table

Post by Roberto Lopez »

mrduck wrote:
Roberto Lopez wrote: Since you have adequate permissions already, could be better if you commit the changes yourself.
Since I cannot access svn repository from work I need convert from svn to mercurial (another system similar (but better :-)) to svn) on a server I have on the net and work from that repository... so I have no way to easily add that patch to svn in a relatively short time....

this is the reason why I propose the changes but don't commit myself

I hope you understand
I understand.

I have no previous experience with diff utility, that was the reason for my request. I'll find one and start learning... :)
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Welcome to the Project Developers' Table

Post by Roberto Lopez »

bedipritpal wrote:
Roberto Lopez wrote: Print text alignment is not working anymore.
What is the problem ?
The text appears always left aligned, as if QTextOption() were not working.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
bedipritpal
Posts: 122
Joined: Thu Sep 02, 2010 10:47 pm

Re: Welcome to the Project Developers' Table

Post by bedipritpal »

Roberto Lopez wrote: The text appears always left aligned, as if QTextOption() were not working.
Did you check the value of "n" ?
It must be 0x0001, 0x0002, 0x0004, 0x0008 or combination.
enjoy hbIDEing... Pritpal Bedi
User avatar
bedipritpal
Posts: 122
Joined: Thu Sep 02, 2010 10:47 pm

Re: Welcome to the Project Developers' Table

Post by bedipritpal »

Roberto Lopez wrote:

Code: Select all

         IF valtype( nToRow )=='N' .and. valtype( nToCol )=='N'
            QRectF := QRectF( nCol , nRow , nToCol - nCol , nToRow - nRow )
            QTextOption := QTextOption()

            IF valtype( nAlignment ) == 'N'
               QTextOption:setAlignment( nAlignment )
            ELSE
               QTextOption:setAlignment( 0 )
            ENDIF

            ::qPainter:drawText( QRectF , cData , QTextOption )


It should be:

Code: Select all

 IF valtype( nToRow )=='N' .and. valtype( nToCol )=='N'
            qRectF := QRectF( nCol , nRow , nToCol - nCol , nToRow - nRow )
            qTextOption := QTextOption()

            IF valtype( nAlignment ) == 'N'
               qTextOption:setAlignment( nAlignment )
            ELSE
               qTextOption:setAlignment( 0 )
            ENDIF

            ::qPainter:drawText( QRectF , cData , QTextOption )

The variable prefix has to be cleaned in whole HMG.
It is very ambiqous and difficult to locate a bug.

QTextOption:setAlignment( nAlignment )

The line above, at a first glance, suggests that you are
calling the class object itself, NOT a method of class instance.
enjoy hbIDEing... Pritpal Bedi
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Welcome to the Project Developers' Table

Post by Roberto Lopez »

bedipritpal wrote:
Roberto Lopez wrote: The text appears always left aligned, as if QTextOption() were not working.
Did you check the value of "n" ?
It must be 0x0001, 0x0002, 0x0004, 0x0008 or combination.
The values are correct.

As I've already said, the code was working prior to conversion.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Welcome to the Project Developers' Table

Post by Roberto Lopez »

Roberto Lopez wrote: The text appears always left aligned, as if QTextOption() were not working.
The last version prior conversion, was working perfectly.

This is the code:

Code: Select all

 if valtype(nToRow)=='N' .and. valtype(nToCol)=='N'
   QRectF := QRectF( nCol , nRow , nToCol - nCol , nToRow - nRow )
   QTextOption := QTextOption()

   if valtype(nAlignment) == 'N'
      QTextOption:setAlignment(nAlignment)
   else
      QTextOption:setAlignment(0)
   endif
	
   ::qPainter:drawText_6( QRectF , cData , QTextOption )
Is possible that the problem be in drawText() call regarding the new code that allows us avoid the 'method_n()' format ?
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply