Condition for TabControl

Started by velasquez, September 30, 2008, 02:29:05 PM

Previous topic - Next topic

Fred Tomke

Hi, velasquez,

DecimalUnits do not accepts ",". I just had a test.

QuoteDo you know me to say because OnClicked is not added the c:tab_tabtest_chb_acceptcondition of your TabTest?

I have removed it manually  ;) .

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

velasquez

Hi Fred 
 
Did I look and didn't I find DecimalUnits in the filter styles? 
How to determine this?

Fred Tomke

#17
Sorry, in my German release it is called "Dezimalzahlen". In your English release it is NumericUnits.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

velasquez

Hi Fred 
NumericUinits accepts many characters that are not for me.   
See "----/ / / /....------++++-----" 
The work to manipulate is very big. 
I prefer to filter the entrance in ".0123456789 " 
 
I used your function for TabControl with Opendcl 4.1.2.2, she worked perfectly. 
Thank you very much for your help. 


I posted the methods below in " Feature Request ".

(dcl_Tab_DisableTab  Project1_Form1_TabControl1 nIndex [as Integer])

(dcl_Tab_EnableTab  Project1_Form1_TabControl1 nIndex [as Integer])

Fred Tomke

Hi velasquez, hm, unfortunately, you are right, that all mathematic characters are allowed in numeric styled textboxes. I think about our many customers and the very often textboxes in NumericUnits style. Until now never a customer had a problem with it.
However, numeric styled textboxes suppress the text-characters. For the rest I do the following:


(defun c:blocks_sc_block_size_edt_x (/ strText uVal)
    (if (and (setq strText (dcl_Control_getText blocks_sc_block_size_edt_x))
  (setq uVal (read_secure strText))
  (numberp uVal)
  (> uVal 0.0))
      (progn
        (setq reaX uVal)
      ); progn
      (dcl_Control_setText blocks_sc_block_size_edt_x (rtos reaX 2 4))
    ); if
  ); c:blocks_sc_block_size_edt_x

(defun read_secure (uValue)
  (if (not (and (= (type uValue) 'STR)
(setq uValue (if (= (substr uValue 1 1) ".") (strcat "0" uValue) uValue))
(setq uValue (if (= (substr uValue 1 2) "-.") (strcat "-0" (substr uValue 2)) uValue))
(setq uValue (vl-catch-all-apply 'read (list uValue)))
(not (vl-catch-all-error-p uValue))))
    (setq uValue nil)
  ); if
  uValue
); read_secure


This function c:blocks_sc_block_size_edt_x will be called when OnKillFocus or OnReturnPressed will be fired.

But you have another chance: Activate the OnEditChanged event and check if the value is correct or not. If not, reset the text to the value before. I know it's not understandable what I mean. I can give you an example tomorrow. I'm tired now.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Fred Tomke

Hello velasquez, I have just read that you wanted to post feature requests for dcl_Tab_DisableTab and dcl_Tab_EnableTab. Just if you didn't know: there are already two methods HideTab and ShowTab. Maybe they can help you. I use these methods.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

velasquez

Hello Fred, 
I tested the methods for and to Hide and to Show Tab. 
But I still believe that to incapacitate it would be the best solution. 
It is easier to show when a problem exists. 
Thanks

owenwengerd

Quote from: velasquez on September 30, 2008, 02:29:05 PM
How to prohibit the change in TabControl if a condition be not accepted.

In OpenDCL 5 Beta 1 the OnChanging event can be used to prevent the change. The event handler can return T to prevent the change, or anything else to allow it.

velasquez

Thank you Owen, 
 
Great your work. 
 
Velasquez