Is this a bug ?

Moderator: Rathinagiri

User avatar
esgici
Posts: 4363
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 247 times
Been thanked: 91 times
Contact:

Is this a bug ?

Post by esgici » Mon Apr 20, 2009 9:28 pm

Hi All

I'm very desolated and ashamed with this post.

- I had already sent "clean" report on 2.8.6
- This subject introduced by my "spinners" sample
- It's not correct way changing value of controls by interactive manner
- Roberto is very struggled with this "double execution" problem

Nonetheless I feel must inform. Because in new HMG-Ex version ( applied all new Grid features ), the spinner sample works no problem :((((

Now our problem is : when spinners activated (added to test sample) up and down arrow key causing double skip on rows.

This occurs after first row. That is: down arrow select second row from first, but fourth (not third) from second.

The worst is this isn't new, exists since beginning.

Again, I am very sorry.

Best Regards

--

Esgici
Viva INTERNATIONAL HMG :D

User avatar
Roberto Lopez
HMG Founder
Posts: 3902
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 137 times

Post by Roberto Lopez » Mon Apr 20, 2009 9:42 pm

Esgici,

Please, could be you so kind to post the sample again in this thread (I have not the file anymore).

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
esgici
Posts: 4363
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 247 times
Been thanked: 91 times
Contact:

Post by esgici » Mon Apr 20, 2009 9:47 pm

Code: Select all

/*
* MiniGUI Grid Demo
* (c) 2009 Roberto Lopez
*/

#include "minigui.ch"

Function Main

Local aRows [40] [3]
	
	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 640 ;
		HEIGHT 400 ;
		TITLE 'Mixed Data Type Grid Test' ;
		MAIN 
		
        ON KEY ESCAPE ACTION Form_1.Release
        
		DEFINE MAIN MENU
			DEFINE POPUP 'File'
				MENUITEM 'Set Value To {5,2}'	ACTION Form_1.Grid_1.Value := {5,2}
				MENUITEM 'Set Value To {0,0}'	ACTION Form_1.Grid_1.Value := {0,0}
				MENUITEM 'Get Value'		ACTION GetSelectionValue()
				MENUITEM 'Delete Item 5'	ACTION Form_1.Grid_1.DeleteItem(5)
				MENUITEM 'AddItem'		ACTION Form_1.Grid_1.AddItem({'X','X','X'})
				MENUITEM 'Delete All Items'	ACTION Form_1.Grid_1.DeleteAllItems
			END POPUP
		END MENU

		aRows [1]	:= {'Simpson','Homer','555-5555'}
		aRows [2]	:= {'Mulder','Fox','324-6432'} 
		aRows [3]	:= {'Smart','Max','432-5892'} 
		aRows [4]	:= {'Grillo','Pepe','894-2332'} 
		aRows [5]	:= {'Kirk','James','346-9873'} 
		aRows [6]	:= {'Barriga','Carlos','394-9654'} 
		aRows [7]	:= {'Flanders','Ned','435-3211'} 
		aRows [8]	:= {'Smith','John','123-1234'} 
		aRows [9]	:= {'Pedemonti','Flavio','000-0000'} 
		aRows [10]	:= {'Gomez','Juan','583-4832'} 

		aRows [11]	:= {'Fernandez','Raul','321-4332'} 
		aRows [12]	:= {'Borges','Javier','326-9430'} 
		aRows [13]	:= {'Alvarez','Alberto','543-7898'} 
		aRows [14]	:= {'Gonzalez','Ambo','437-8473'} 
		aRows [15]	:= {'Batistuta','Gol','485-2843'} 
		aRows [16]	:= {'Vinazzi','Amigo','394-5983'} 
		aRows [17]	:= {'Pedemonti','Flavio','534-7984'} 
		aRows [18]	:= {'Samarbide','Armando','854-7873'} 
		aRows [19]	:= {'Pradon','Alejandra','???-????'} 
		aRows [20]	:= {'Reyes','Monica','432-5836'} 

		aRows [21]	:= {'Fernandez','Raul','321-4332'} 
		aRows [22]	:= {'Borges','Javier','326-9430'} 
		aRows [23]	:= {'Alvarez','Alberto','543-7898'} 
		aRows [24]	:= {'Gonzalez','Ambo','437-8473'} 
		aRows [25]	:= {'Batistuta','Gol','485-2843'} 
		aRows [26]	:= {'Vinazzi','Amigo','394-5983'} 
		aRows [27]	:= {'Pedemonti','Flavio','534-7984'} 
		aRows [28]	:= {'Samarbide','Armando','854-7873'} 
		aRows [29]	:= {'Pradon','Alejandra','???-????'} 
		aRows [30]	:= {'Reyes','Monica','432-5836'} 

		aRows [31]	:= {'Fernandez','Raul','321-4332'} 
		aRows [32]	:= {'Borges','Javier','326-9430'} 
		aRows [33]	:= {'Alvarez','Alberto','543-7898'} 
		aRows [34]	:= {'Gonzalez','Ambo','437-8473'} 
		aRows [35]	:= {'Batistuta','Gol','485-2843'} 
		aRows [36]	:= {'Vinazzi','Amigo','394-5983'} 
		aRows [37]	:= {'Pedemonti','Flavio','534-7984'} 
		aRows [38]	:= {'Samarbide','Armando','854-7873'} 
		aRows [39]	:= {'Pradon','Alejandra','???-????'} 
		aRows [40]	:= {'Reyes','Monica','432-5836'} 
		 
		DEFINE GRID Grid_1 
		    ROW             10
		    COL             10 
			WIDTH           500 
			HEIGHT          322 
			HEADERS         {'Column 1','Column 2','Column 3'} 
			WIDTHS          {100,100,100} 
			ITEMS           aRows 
			VALUE           { 1, 1 } 
			ALLOWEDIT       .T.
			CELLNAVIGATION  .T. 
			ONCHANGE { ||  IF( ( _IsControlDefined( "spnRow", "Form_1" ) .AND. ; 
                                 _IsControlDefined( "spnCol", "Form_1" ) ) ,; 
                                 ( aCurValue := this.value,;
                                 SetProperty( "Form_1", "spnRow", "Value", aCurValue[ 1 ] ),;
                                 SetProperty( "Form_1", "spnCol", "Value", aCurValue[ 2 ] ) ), '' ) }

		END GRID // Grid_1 
            
        @ 13, 520 LABEL lblRow WIDTH 50 VALUE "Row No:"
        @ 53, 520 LABEL lblCol WIDTH 50 VALUE "Col No:"
        			
		DEFINE SPINNER spnRow 
		   ROW   10				
           COL   580 
           WIDTH 50
           RANGEMIN 1 
           RANGEMAX LEN( aRows )   
           VALUE 1 
           ONCHANGE { || aCurValue := GetProperty( "Form_1", "Grid_1", "Value" ),; 
                         aCurValue[ 1 ] :=  this.Value,;
                         SetProperty( "Form_1", "Grid_1", "Value", aCurValue ) }

        END SPINNER // spnRow			

		DEFINE SPINNER spnCol 
		   ROW   50				
           COL   580 
           WIDTH 50
           RANGEMIN 1 
           RANGEMAX 3
           VALUE 1            
           ONCHANGE { || aCurValue := GetProperty( "Form_1", "Grid_1", "Value" ),; 
                         aCurValue[ 2 ] :=  this.Value,;
                         SetProperty( "Form_1", "Grid_1", "Value", aCurValue ) }

        END SPINNER // spnCol			
        
	END WINDOW

 	Form_1.Grid_1.setfocus

	CENTER WINDOW Form_1

	ACTIVATE WINDOW Form_1

Return


Function GetSelectionValue
Local a

	a := Form_1.Grid_1.Value

	MsgInfo( Str (  a [1] ) + ' ' + Str (  a [2] ) )

Return nil
Viva INTERNATIONAL HMG :D

User avatar
Roberto Lopez
HMG Founder
Posts: 3902
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 137 times

Post by Roberto Lopez » Mon Apr 20, 2009 9:57 pm

Roberto Lopez wrote:Esgici,

Please, could be you so kind to post the sample again in this thread (I have not the file anymore).

Regards,

Roberto.
Some clarification:

Your sample was very useful.

From it, I've created the 'GRID_23' sample. It probes that interactively or programmatically, 'OnChange' event is executed once and the value property passed to the event is correct.

As I've said to you in another thread, IMHO the problem with your original sample could be solved checking current value of the control prior to set to the same value again (yet I've not tested).

From an HMG perspective, we could do the same. This means, that _SetValue internal function, test the value passed and if is the same as current, do nothing.

Again, I've not tested, so, this is only a theory.

Moreover, we should consider the implications that a change on _SetValue could have on current applications.

Since you mentioned HMG extended, perhaps, Grigory be informed about this issue and can help us.


Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Roberto Lopez
HMG Founder
Posts: 3902
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 137 times

Post by Roberto Lopez » Mon Apr 20, 2009 10:00 pm

esgici wrote:

Code: Select all

/*
* MiniGUI Grid Demo
* (c) 2009 Roberto Lopez
*/
<...>
[/quote]

Thanks.

I'll work on it.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
esgici
Posts: 4363
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 247 times
Been thanked: 91 times
Contact:

Post by esgici » Mon Apr 20, 2009 10:01 pm

Hi Roberto

Thanks you very much.

Now I feel less depressed :)

Best Regards

--

Esgici
Viva INTERNATIONAL HMG :D

User avatar
Roberto Lopez
HMG Founder
Posts: 3902
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 137 times

Post by Roberto Lopez » Mon Apr 20, 2009 10:46 pm

Well...

A 'good' person should not say 'I told you' but...

I told you :)

Code: Select all

/*
* MiniGUI Grid Demo
* (c) 2009 Roberto Lopez
*/

#include "minigui.ch"

Function Main

Local aRows [40] [3]
   
   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 640 ;
      HEIGHT 400 ;
      TITLE 'Mixed Data Type Grid Test' ;
      MAIN
      
        ON KEY ESCAPE ACTION Form_1.Release
       
      DEFINE MAIN MENU
         DEFINE POPUP 'File'
            MENUITEM 'Set Value To {5,2}'   ACTION Form_1.Grid_1.Value := {5,2}
            MENUITEM 'Set Value To {0,0}'   ACTION Form_1.Grid_1.Value := {0,0}
            MENUITEM 'Get Value'      ACTION GetSelectionValue()
            MENUITEM 'Delete Item 5'   ACTION Form_1.Grid_1.DeleteItem(5)
            MENUITEM 'AddItem'      ACTION Form_1.Grid_1.AddItem({'X','X','X'})
            MENUITEM 'Delete All Items'   ACTION Form_1.Grid_1.DeleteAllItems
         END POPUP
      END MENU

      aRows [1]   := {'Simpson','Homer','555-5555'}
      aRows [2]   := {'Mulder','Fox','324-6432'}
      aRows [3]   := {'Smart','Max','432-5892'}
      aRows [4]   := {'Grillo','Pepe','894-2332'}
      aRows [5]   := {'Kirk','James','346-9873'}
      aRows [6]   := {'Barriga','Carlos','394-9654'}
      aRows [7]   := {'Flanders','Ned','435-3211'}
      aRows [8]   := {'Smith','John','123-1234'}
      aRows [9]   := {'Pedemonti','Flavio','000-0000'}
      aRows [10]   := {'Gomez','Juan','583-4832'}

      aRows [11]   := {'Fernandez','Raul','321-4332'}
      aRows [12]   := {'Borges','Javier','326-9430'}
      aRows [13]   := {'Alvarez','Alberto','543-7898'}
      aRows [14]   := {'Gonzalez','Ambo','437-8473'}
      aRows [15]   := {'Batistuta','Gol','485-2843'}
      aRows [16]   := {'Vinazzi','Amigo','394-5983'}
      aRows [17]   := {'Pedemonti','Flavio','534-7984'}
      aRows [18]   := {'Samarbide','Armando','854-7873'}
      aRows [19]   := {'Pradon','Alejandra','???-????'}
      aRows [20]   := {'Reyes','Monica','432-5836'}

      aRows [21]   := {'Fernandez','Raul','321-4332'}
      aRows [22]   := {'Borges','Javier','326-9430'}
      aRows [23]   := {'Alvarez','Alberto','543-7898'}
      aRows [24]   := {'Gonzalez','Ambo','437-8473'}
      aRows [25]   := {'Batistuta','Gol','485-2843'}
      aRows [26]   := {'Vinazzi','Amigo','394-5983'}
      aRows [27]   := {'Pedemonti','Flavio','534-7984'}
      aRows [28]   := {'Samarbide','Armando','854-7873'}
      aRows [29]   := {'Pradon','Alejandra','???-????'}
      aRows [30]   := {'Reyes','Monica','432-5836'}

      aRows [31]   := {'Fernandez','Raul','321-4332'}
      aRows [32]   := {'Borges','Javier','326-9430'}
      aRows [33]   := {'Alvarez','Alberto','543-7898'}
      aRows [34]   := {'Gonzalez','Ambo','437-8473'}
      aRows [35]   := {'Batistuta','Gol','485-2843'}
      aRows [36]   := {'Vinazzi','Amigo','394-5983'}
      aRows [37]   := {'Pedemonti','Flavio','534-7984'}
      aRows [38]   := {'Samarbide','Armando','854-7873'}
      aRows [39]   := {'Pradon','Alejandra','???-????'}
      aRows [40]   := {'Reyes','Monica','432-5836'}
      
      DEFINE GRID Grid_1
          ROW             10
          COL             10
         WIDTH           500
         HEIGHT          322
         HEADERS         {'Column 1','Column 2','Column 3'}
         WIDTHS          {100,100,100}
         ITEMS           aRows
         VALUE           { 1, 1 }
         ALLOWEDIT       .T.
         CELLNAVIGATION  .T.
         ONCHANGE 	GridChange()
      END GRID // Grid_1
           
        @ 13, 520 LABEL lblRow WIDTH 50 VALUE "Row No:"
        @ 53, 520 LABEL lblCol WIDTH 50 VALUE "Col No:"
                 
      DEFINE SPINNER spnRow
         ROW   10            
           COL   580
           WIDTH 50
           RANGEMIN 1
           RANGEMAX LEN( aRows )   
           VALUE 1
           ONCHANGE 	SpinnerRowChange()

        END SPINNER // spnRow         

      DEFINE SPINNER spnCol
         ROW   50            
           COL   580
           WIDTH 50
           RANGEMIN 1
           RANGEMAX 3
           VALUE 1           
           ONCHANGE 	SpinnerColChange()

        END SPINNER // spnCol         
       
   END WINDOW

   Form_1.Grid_1.setfocus

   CENTER WINDOW Form_1

   ACTIVATE WINDOW Form_1

Return


Function GetSelectionValue
Local a

   a := Form_1.Grid_1.Value

   MsgInfo( Str (  a [1] ) + ' ' + Str (  a [2] ) )

Return nil

Procedure GridChange

Local aCurValue

	IF	_IsControlDefined( "spnRow", "Form_1" )  .AND. ;
		_IsControlDefined( "spnCol", "Form_1" )

		aCurValue := this.value

		If aCurValue [1] <> GetProperty( "Form_1", "spnRow", "Value")
			SetProperty( "Form_1", "spnRow", "Value", aCurValue[ 1 ] )
		EndIf

		If aCurValue [2] <> GetProperty( "Form_1", "spnCol", "Value")
			SetProperty( "Form_1", "spnCol", "Value", aCurValue[ 2 ] )
		EndIf

	EndIf

Return

Procedure SpinnerRowChange

Local aCurValue

	aCurValue := GetProperty( "Form_1", "Grid_1", "Value" )

	If aCurValue[ 1 ] <>  this.Value
		aCurValue[ 1 ] :=  this.Value
		SetProperty( "Form_1", "Grid_1", "Value", aCurValue )
	EndIf

Return

procedure SpinnerColChange

Local aCurValue

	aCurValue := GetProperty( "Form_1", "Grid_1", "Value" )

	If aCurValue[ 2 ] <>  this.Value

		aCurValue[ 2 ] :=  this.Value

		SetProperty( "Form_1", "Grid_1", "Value", aCurValue ) 

	EndIf

Return
Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Roberto Lopez
HMG Founder
Posts: 3902
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 137 times

Post by Roberto Lopez » Mon Apr 20, 2009 10:55 pm

Now, that the 'problem' is identified we must to make a decision.

- Should internal HMG funtion _SetValue() be changed to test current value prior to take action?

It could esily done, but:

- Does that impact on current code, breaking backwards compatibility?

I'm listening...

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
esgici
Posts: 4363
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 247 times
Been thanked: 91 times
Contact:

Post by esgici » Mon Apr 20, 2009 11:05 pm

Roberto Lopez wrote: A 'good' person should not say 'I told you' but...
I told you :)
Personally, I'm not a "good" person; only a "sassy" student !

So I can say only : "Yes sir, you have already told me !"

Best Regards

--

Esgici
Viva INTERNATIONAL HMG :D

User avatar
esgici
Posts: 4363
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 247 times
Been thanked: 91 times
Contact:

Post by esgici » Mon Apr 20, 2009 11:08 pm

Roberto Lopez wrote: - Should internal HMG funtion _SetValue() changed to test current value prior to take action?
IMHO, yes.
- Does that impact on current code, breaking backwards compatibility?
IMHO, no.

Best Regards

--

Esgici
Viva INTERNATIONAL HMG :D

Post Reply