SubDataWindow:"Insert" := .T.

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
FFF
Posts: 1581
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

SubDataWindow:"Insert" := .T.

Post by FFF »

Guys,
this is an old one: if a column in a SDW is linked to a numeric field, by default any keyboard input will enter ONE digit, then the cursor jumps behind the decimal separator. Hitting "Insert" once will correct this, so only after entering the separator key following digits will be used as decimals.
I seem to remember from old days, that there was no way to "automate" this, but maybe this is wrong?
So, if anyone has a solution (and no, swapping to bBrowser is no option ;) ) i'd be grateful for this pre-christmas present.
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

SubDataWindow:"Insert" := .T.

Post by Karl-Heinz »

Hi Karl,

In the method GetEditObject() class DataColumn the #overwrite property of the cell editcontrol is set to OVERWRITE_ONKEY, and it seems that this setting causes the problem. Using a standalone "num decimal + OVERWRITE_ONKEY" SingleLineEdit control on a form shows excatly the same behaviour ! so I´m pretty sure, the problem is inside the singleLineEdit class and not the DataBrowser or DataColumn class.

A quick workaround might be this DataBrowser class. When a num value with decimal places is detected the #overwrite setting is changed to OVERWRITE_NEVER. it´s not perfect, but at least the decimal point problem should be solved.

Code: Select all

CLASS MyDataBrowser INHERIT DataBrowser 

METHOD __BeginEditField(hWin AS PTR, dwChar AS DWORD) AS VOID PASCAL CLASS MyDataBrowser  

	SUPER:__BeginEditField(hWin , dwChar )
, 

	IF oCellEdit:FieldSpec != NULL_OBJECT 
 
    		IF oCellEdit:FieldSpec:ValType == "N" .and. oCellEdit:FieldSpec:Decimals > 0 
    	
		   	IVarPut(oCellEdit, #Overwrite, OVERWRITE_NEVER )
	    
    		ENDIF 
    
	ENDIF 	        

	RETURN
BTW. Since I've been using the MatthiasSle class for decades, i´ve never seen this strange OVERWRITE_ONKEY behaviour. Searching the VO google group shows that Matthias even wrote a DataBrowser class that uses the MatthiasSle class instead of the SingleLineEdit class. Because the download location knowvo.com no longer exists, maybe Matthias jumps in ...

regards
Karl-Heinz
FFF
Posts: 1581
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

SubDataWindow:"Insert" := .T.

Post by FFF »

Karl-Heinz,
fortunately i already have an own databrowser in place, (providing some tricks for contextmenus), so i had only to add your method to this. And it works fine.
Maybe Chris wants to dive into the SLE codebase to see, what here is wrong, but for the time being, i'm grateful to have a solution to this long itching nuisance.

Many thx for this!
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Post Reply