Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC:

SubDataWindow:"Insert" := .T. 09 Dec 2020 14:51 #16897

  • FFF
  • FFF's Avatar
  • Topic Author


  • Posts: 1391
  • 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 (X# 2.14.0.4; Xide 1.33; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    Last edit: by FFF.

    SubDataWindow:"Insert" := .T. 19 Dec 2020 14:42 #16980

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • 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.

    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

    Please Log in or Create an account to join the conversation.

    SubDataWindow:"Insert" := .T. 19 Dec 2020 21:46 #16984

    • FFF
    • FFF's Avatar
    • Topic Author


  • Posts: 1391
  • 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 (X# 2.14.0.4; Xide 1.33; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1