Harbour MiniGUI 2.7.1

HMG announcements; Latest HMG-related news, releases, fixes and updates.

Moderator: Rathinagiri

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

Re: Harbour MiniGUI 2.7.1

Post by esgici » Tue Mar 31, 2009 4:03 pm

Roberto Lopez wrote: ...
You can drag an item to the first position without problems.
...
Sorry, very sorry; you are right.

Mistaken by hasting :(

The problem is only for AFTER last item. That isn't ADDING/APPENDING, no INSERTING ?

Best Regards

--

Esgici
Viva INTERNATIONAL HMG :D

User avatar
Roberto Lopez
HMG Founder
Posts: 3919
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 15 times
Been thanked: 140 times

Post by Roberto Lopez » Tue Mar 31, 2009 4:12 pm

esgici wrote: The problem is only for AFTER last item. That isn't ADDING/APPENDING, no INSERTING ?
I've avoided move an item to the last position because WIN32 function DrawInsert is unable to draw the insertion mark for the last item.

Anyway I'm considerig to allow this (even when the marker is not shown) due the 'popular demand' :)

Please remove the lines I've indiceted in h_windows.prg and test it.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

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

Post by esgici » Tue Mar 31, 2009 4:22 pm

Roberto Lopez wrote:
And (as I've said to Sudip) If you eliminate the indicated lines in 'h_windows.prg' you'll be able to drag above the last item.

Please, test again.
Tested. The result is exactly what you say: (even when the marker is not shown) ADDING / APPENDING become possible.

BTW, since this isn't INSERTING, we can assume that Win32 is correct, by don't allow to draw the insertion mark for the last item :)

Anyway now we have possibility to changing position of any item to anywhere in LISTBOX by dragging it.

Thanks a lot.

Best Regards

--

Esgici
Viva INTERNATIONAL HMG :D

User avatar
Roberto Lopez
HMG Founder
Posts: 3919
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 15 times
Been thanked: 140 times

Post by Roberto Lopez » Tue Mar 31, 2009 4:50 pm

esgici wrote: BTW, since this isn't INSERTING, we can assume that Win32 is correct, by don't allow to draw the insertion mark for the last item :)
Yes. This was my thinking, but I'm reviewing my decision.

This could be solved using a 'dirty trick' such as adding an empty item to the end of the list while dragging, but it could be not easy to fine-tune.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Roberto Lopez
HMG Founder
Posts: 3919
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 15 times
Been thanked: 140 times

Post by Roberto Lopez » Tue Mar 31, 2009 4:54 pm

gfilatov wrote: I'm sorry for a bugreport about This.cellValue bug again but you've missed an underline symbol in the function name at my correction of this problem.
...
And... we missed other huge bugs in the same routine.

We forgot the possibility to specify a date or numeric textbox.

So, the (right?) code is as follows :) :

(Please, let me know if I've forgot something again).

Code: Select all


*-----------------------------------------------------------------------------*
Procedure _HMG_SetGridCellEditValue ( arg )
*-----------------------------------------------------------------------------*

	IF	ValType ( arg ) == 'C'

		SetProperty ( "_hmg_grid_inplaceedit" , "t" , "value" , arg )

	ELSEIF	ValType ( arg ) == 'D'

		If _IsControlDefined ( 't' , "_hmg_grid_inplaceedit")

			SetProperty ( "_hmg_grid_inplaceedit" , "t" , "value" , arg )

		ElseIf _IsControlDefined ( 'd' , "_hmg_grid_inplaceedit")

			SetProperty ( "_hmg_grid_inplaceedit" , "d" , "value" , arg )

		EndIf

	ELSEIF	ValType ( arg ) == 'N'

		If _IsControlDefined ( 'c' , "_hmg_grid_inplaceedit")

			SetProperty ( "_hmg_grid_inplaceedit" , "c" , "value" , arg )

		ElseIf _IsControlDefined ( 's' , "_hmg_grid_inplaceedit")

			SetProperty ( "_hmg_grid_inplaceedit" , "s" , "value" , arg )

		ElseIf _IsControlDefined ( 't' , "_hmg_grid_inplaceedit")

			SetProperty ( "_hmg_grid_inplaceedit" , "t" , "value" , arg )

		EndIf

	ELSEIF	ValType ( arg ) == 'L'

		SetProperty ( "_hmg_grid_inplaceedit" , "c" , "value" , arg )

	ENDIF

return



TIA.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Roberto Lopez
HMG Founder
Posts: 3919
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 15 times
Been thanked: 140 times

Post by Roberto Lopez » Tue Mar 31, 2009 5:25 pm

Grigory,

I've tested the new (fixed) code with this sample:

Code: Select all


#include "minigui.ch"

Function Main

Local aRows [20] [3]

	Private fColor := { || if ( This.CellRowIndex/2 == int(This.CellRowIndex/2) , { 0,0,255 } , { 0,255,0 } ) }	

	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 640 ;
		HEIGHT 400 ;
		TITLE 'Mixed Data Type Grid Test' ;
		MAIN 

		DEFINE MAIN MENU
			DEFINE POPUP 'File'
				MENUITEM 'Set Item'	ACTION SetItem()
				MENUITEM 'Get Item'	ACTION GetItem()
			END POPUP
		END MENU

		aRows [1]	:= {113.12,date(),1,1 , .t. }
		aRows [2]	:= {123.12,date(),2,2 , .f. } 
		aRows [3]	:= {133.12,date(),3,3, .t. } 
		aRows [4]	:= {143.12,date(),1,4, .f. } 
		aRows [5]	:= {153.12,date(),2,5, .t. } 
		aRows [6]	:= {163.12,date(),3,6, .f. } 
		aRows [7]	:= {173.12,date(),1,7, .t. } 
		aRows [8]	:= {183.12,date(),2,8, .f. } 
		aRows [9]	:= {193.12,date(),3,9, .t. } 
		aRows [10]	:= {113.12,date(),1,10, .f. } 
		aRows [11]	:= {123.12,date(),2,11, .t. } 
		aRows [12]	:= {133.12,date(),3,12, .f. } 
		aRows [13]	:= {143.12,date(),1,13, .t. } 
		aRows [14]	:= {153.12,date(),2,14, .f. } 
		aRows [15]	:= {163.12,date(),3,15, .t. } 
		aRows [16]	:= {173.12,date(),1,16, .f. } 
		aRows [17]	:= {183.12,date(),2,17, .t. } 
		aRows [18]	:= {193.12,date(),3,18, .f. } 
		aRows [19]	:= {113.12,date(),1,19, .t. } 
		aRows [20]	:= {123.12,date(),2,20, .f. } 

		@ 10,10 GRID Grid_1 ;
			WIDTH 620 ;
			HEIGHT 330 ;
			HEADERS {'Column 1','Column 2','Column 3','Column 4','Column 5'} ;
			WIDTHS {140,140,140,140,140} ;
			ITEMS aRows ;
			EDIT ;
			COLUMNCONTROLS { {'TEXTBOX','NUMERIC','$ 999,999.99'} , {'DATEPICKER','DROPDOWN'} , {'COMBOBOX',{'One','Two','Three'}} , { 'SPINNER' , 1 , 20 } , { 'CHECKBOX' , 'Yes' , 'No' } } ;
			DYNAMICFORECOLOR { fColor , fColor, fColor, fColor, fColor } ;
			COLUMNVALID 	{ ;
					{ || Test1() }	,	;
					{ || Test2() }	,	;
					{ || Test3() }	,	;
					{ || Test4() }	,	;
					{ || Test5() }		;
					} 

	END WINDOW

	CENTER WINDOW Form_1

	ACTIVATE WINDOW Form_1

Return

PROCEDURE SETITEM()

	Form_1.Grid_1.Item (2) := { 123.45 , date() , 2 , 10 , .T. }

RETURN

PROCEDURE GETITEM()
local a

	a := Form_1.Grid_1.Item (2) 

	msginfo ( str ( a [1] )				, '1' )
	msginfo ( dtoc ( a [2] )			, '2' )
	msginfo ( str( a [3] )				, '3' )
	msginfo ( str ( a [4] )				, '4' )
	msginfo ( if ( a [5] == .t. , '.t.' , '.f.' )	, '5' )

RETURN


procedure test1()

	If This.CellValue == 0

		This.CellValue := 999

	EndIf

return

procedure test2()

	If Year (This.CellValue) <> 2009

		This.CellValue := Date()

	EndIf

return

procedure test3()

	If This.CellValue == 3

		This.CellValue := 1

	EndIf

return

procedure test4()

	If This.CellValue == 1

		This.CellValue := 9

	EndIf

return

procedure test5()

	If This.CellValue == .F.

		This.CellValue := .T.

	EndIf

return

Please, let me know if you find a problem.

TIA.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
gfilatov
Posts: 578
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 16 times
Been thanked: 145 times
Contact:

Post by gfilatov » Tue Mar 31, 2009 6:51 pm

Roberto Lopez wrote:Grigory,

I've tested the new (fixed) code with this sample:

...
Please, let me know if you find a problem.
Roberto,

Thanks a lot. It works OK now. :!:

I've done this function in such way:

Code: Select all

*-----------------------------------------------------------------------------*
PROCEDURE _SetGridCellEditValue ( arg )
*-----------------------------------------------------------------------------*
   LOCAL FormName := "_hmg_grid_inplaceedit"
   LOCAL ControlName

   SWITCH ValType ( arg )
	CASE 'C'

		ControlName := Iif( _IsControlDefined ( "t" , FormName ), "t", Nil )
		Exit

	CASE 'D'

		ControlName := Iif( _IsControlDefined ( "d" , FormName ), "d", ;
			Iif( _IsControlDefined ( "t" , FormName ), "t", Nil ) )
		Exit

	CASE 'N'

		ControlName := Iif( _IsControlDefined ( "c" , FormName ), "c", ;
			Iif( _IsControlDefined ( "s" , FormName ), "s", ;
			Iif( _IsControlDefined ( "t" , FormName ), "t", Nil ) ) )
		Exit

	CASE 'L'

		ControlName := Iif( _IsControlDefined ( "c" , FormName ), "c", Nil )
   END

   IF ISCHARACTER( ControlName )

      SetProperty ( FormName , ControlName , "value" , arg )

   ELSE

      MsgMiniGuiError ( "CellValue replace: type mismatch. Program Terminated" )

   ENDIF

RETURN
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

User avatar
Roberto Lopez
HMG Founder
Posts: 3919
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 15 times
Been thanked: 140 times

Post by Roberto Lopez » Tue Mar 31, 2009 7:18 pm

gfilatov wrote: Thanks a lot. It works OK now. :!:
Thanks for your help on this.

Regarding to your implementation, is very interesting the way you handles the error on data type.

Anyway, maybe I use a different approach, since I don´t like SWITCH too much :)

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Roberto Lopez
HMG Founder
Posts: 3919
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 15 times
Been thanked: 140 times

Post by Roberto Lopez » Tue Mar 31, 2009 7:36 pm

gfilatov wrote: I've done this function in such way:
May be a little problem with error checking.

Please consider the following:

When you assign a character type to a numeric textbox column, error checking will fail since a control named 't' exists, so, no error will be generated (please, correct me if I'm wrong).

Perhaps, the error checking should be based on COLUMNCONTROLS array.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
gfilatov
Posts: 578
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 16 times
Been thanked: 145 times
Contact:

Post by gfilatov » Wed Apr 01, 2009 8:59 am

Roberto Lopez wrote: May be a little problem with error checking.

Please consider the following:

When you assign a character type to a numeric textbox column, error checking will fail since a control named 't' exists, so, no error will be generated (please, correct me if I'm wrong).

Perhaps, the error checking should be based on COLUMNCONTROLS array.
Hi Roberto,

I'm glad to see you in this forum.

Many thanks for your remark. You are right, of course.

I've adde the following verify condition in the function:

Code: Select all

...
	CASE 'C'
		ControlName := Iif( _IsControlDefined ( "t" , FormName ) .and. ;
			!(ValType ( _GetValue ( "t" , FormName ) ) == "N"), "t", Nil )
		Exit
...
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

Post Reply