OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: velasquez on September 30, 2008, 02:29:05 PM

Title: Condition for TabControl
Post by: velasquez on September 30, 2008, 02:29:05 PM
Hi 
I need help for a problem. 
How to prohibit the change in TabControl if a condition be not accepted.
Title: Re: Condition for TabControl
Post by: Fred Tomke on October 01, 2008, 12:07:29 AM
Hello,

1. there are two events for tabs: OnChanged OnSelChanging. If the user changes the tab although the conditions are not accepted you could changed the selected tab back (with a message what the user has to to.

2. when OnSelChanging events will be fired you should disable all controls in the selected tab.

Regards
Fred
Title: Re: Condition for TabControl
Post by: Fred Tomke on October 01, 2008, 12:08:17 AM
... and you could use HideTab if the conditions are not accepted and use ShowTab if they are accepted.
Fred
Title: Re: Condition for TabControl
Post by: velasquez on October 01, 2008, 05:19:11 AM
Hello Fred 

I didn't get to do your suggestion to work. 
Please see the video that I posted. 

Regards 
Velasquez
Title: Re: Condition for TabControl
Post by: velasquez on October 01, 2008, 05:34:19 AM
Hello Fred 
I posted a video of my TabControl.
Title: Re: Condition for TabControl
Post by: Fred Tomke on October 01, 2008, 01:21:53 PM
yeeeees, and after the error message you should activate the configuration tab again (I believe SetCurSel).

BTW: how did you create the white-blue gradient in the left tab? Are these all images?

Fred
Title: Re: Condition for TabControl
Post by: velasquez on October 01, 2008, 01:44:15 PM
Hi Fred 
 
I used dcl_Tab_SetCurSel, but nothing impedes the change of TabControl. 
I believe that this is not possible. But it is a lot of imprtante. 
Do you have some other idea? 
 
See the image that I used in the bottom of TabControl.
Title: Re: Condition for TabControl
Post by: velasquez on October 01, 2008, 01:56:41 PM
Hi Fred     
   
I posted my file.odcl for you to see. 


Regards,   
Velasquez
Title: Re: Condition for TabControl
Post by: BazzaCAD on October 01, 2008, 06:42:54 PM
Great use of the PictureBox Velasquez, really good looking stuff.
Do you use PhotoShop to create the raised (Mouse Over) buttons, or is there an easier way?
Title: Re: Condition for TabControl
Post by: velasquez on October 02, 2008, 04:34:24 AM
Yes I used PhotoShop and SnagIt 8 Editor, to create all the images.
Title: Re: Condition for TabControl
Post by: velasquez on October 03, 2008, 10:59:13 AM
Does nobody know a form please of working around of my problem with TabControl?

Tanks
Title: Re: Condition for TabControl
Post by: Fred Tomke on October 05, 2008, 11:27:31 AM
Hi velasquez, tomorrow I'm in the office so I can have a try.

Fred
Title: Re: Condition for TabControl
Post by: Fred Tomke on October 05, 2008, 11:43:04 PM
Hi, velasquez,

I send you an example. If the checkbox is not checked you cannot change the tabs.

Sorry for the delay. I was out of office in the last week cause of a trade fair for surveyors, cities and governments. At these times I can only send short answers. Especially not at the days. In the next weeks I will be out very often for roadshows, customer trainings and so on.

Hope this helps.

Fred
Title: Re: Condition for TabControl
Post by: Fred Tomke on October 06, 2008, 04:26:32 AM
Hi velasquez,

the textbox "AlturaTextoDados" uses FilterStyle Text. Why don't you use DecimalUnits?

Fred
Title: Re: Condition for TabControl
Post by: velasquez on October 06, 2008, 06:15:05 AM
Hi Fred 
I didn't use DecimalUnits because he accepts "," and the height of the text not accepts. 
With FilterStyle Text it is easier to control this. 
I use the function below: 
(dcl_TextBox_SetFilter DuctilCAD_DuctilCAD_MainForm_AlturaTextoDados " .0123456789 ")

Do you know me to say because OnClicked is not added the c:tab_tabtest_chb_acceptcondition of your TabTest? 
Title: Re: Condition for TabControl
Post by: Fred Tomke on October 06, 2008, 07:41:32 AM
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
Title: Re: Condition for TabControl
Post by: velasquez on October 06, 2008, 09:52:49 AM
Hi Fred 
 
Did I look and didn't I find DecimalUnits in the filter styles? 
How to determine this?
Title: Re: Condition for TabControl
Post by: Fred Tomke on October 06, 2008, 11:19:09 AM
Sorry, in my German release it is called "Dezimalzahlen". In your English release it is NumericUnits.

Fred
Title: Re: Condition for TabControl
Post by: velasquez on October 06, 2008, 12:22:25 PM
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])
Title: Re: Condition for TabControl
Post by: Fred Tomke on October 06, 2008, 02:11:19 PM
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
Title: Re: Condition for TabControl
Post by: Fred Tomke on October 15, 2008, 07:18:53 AM
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
Title: Re: Condition for TabControl
Post by: velasquez on October 15, 2008, 10:11:33 AM
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
Title: Re: Condition for TabControl
Post by: owenwengerd on October 18, 2008, 09:38:51 AM
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.
Title: Re: Condition for TabControl
Post by: velasquez on October 18, 2008, 10:48:19 AM
Thank you Owen, 
 
Great your work. 
 
Velasquez