From: Phil bayard on 2 Apr 2010 09:04 Hi everybody, i'm only using VO for 3 weeks now and i'm getting some troubles. I'm trying to find a way to know if a windows full of data has been edited by the user (the windows contains Combobox, textfield, bbrowser and checkbox). After some searchs, i'm trying to use a method i found. METHOD Dispatch( oE ) CLASS IgDataWindow LOCAL dwNotification as DWORD dwNotification := HiWord( oE:wParam ) IF oE:Message == WM_COMMAND // BN_CLICKED Sent on clicking push buttons, radio buttons and check boxes // CBN_EDITCHANGE Sent when manually changing info in the edit portion of a combo box // CBN_SELCHANGE Sent when changing the selection via mouse, or keyboard in the listbox portion of combo // EN_SELCHANGE Sent when changing data in a multi line text field or rich edit control // EN_CHANGE Sent when changing data in an SLE // Are we interested in the message IF dwNotification == BN_CLICKED .or. ; dwNotification == CBN_EDITCHANGE .or. ; dwNotification == CBN_SELCHANGE .or. ; dwNotification == EN_SELCHANGE .or. ; dwNotification == DTN_DATETIMECHANGE .or. ; dwNotification == EN_CHANGE // Yep, but have we done this before IF self:leditwin == FALSE // No we haven't, but are we to ignore this message. A typical ignore is when a button // is clicked. This, is most cases, shouldn't change the state of the form IF .not. LOGIC( _cast, SendMessage( ptr( _cast, oE:lParam ),0 , 0L ,0L ) ) self:leditwin := true self:Caption += ' - Modified' ENDIF ENDIF //RETURN 0L ENDIF ENDIF RETURN SUPER:Dispatch( oE ) But i'm getting some problems because this event happens even when i'm setting the value on my windows in the post init method. So i think of using a logic value to know when to start "catching" changes. Maybe when the windows is shown? Which event must i use? I know the expose event happens when the windows is paint. If you have some advise it would be great! P.S. Sorry for my bad english ;)
From: John Martens on 2 Apr 2010 11:29 How about using EditChange ? Something like: METHOD EditChange(oControlEvent) CLASS MyWindow SUPER:EditChange(oControlEvent) DO CASE CASE ! SELF:IsVisible() CASE oControlEvent:Control:NameSym == #PostKode ENDCASE Cheers, John Op 2-4-2010 15:04, Phil bayard schreef: > Hi everybody, i'm only using VO for 3 weeks now and i'm getting some > troubles. > > I'm trying to find a way to know if a windows full of data has been > edited by the user (the windows contains Combobox, textfield, bbrowser > and checkbox). After some searchs, i'm trying to use a method i found. > > METHOD Dispatch( oE ) CLASS IgDataWindow > LOCAL dwNotification as DWORD > > > dwNotification := HiWord( oE:wParam ) > > IF oE:Message == WM_COMMAND > > > // BN_CLICKED Sent on clicking push buttons, radio buttons and > check boxes > // CBN_EDITCHANGE Sent when manually changing info in the edit > portion of a combo box > // CBN_SELCHANGE Sent when changing the selection via mouse, or > keyboard in the listbox portion of combo > // EN_SELCHANGE Sent when changing data in a multi line text > field or rich edit control > // EN_CHANGE Sent when changing data in an SLE > > > // Are we interested in the message > IF dwNotification == BN_CLICKED .or. ; > dwNotification == CBN_EDITCHANGE .or. ; > dwNotification == CBN_SELCHANGE .or. ; > dwNotification == EN_SELCHANGE .or. ; > dwNotification == DTN_DATETIMECHANGE .or. ; > dwNotification == EN_CHANGE > > > // Yep, but have we done this before > IF self:leditwin == FALSE > // No we haven't, but are we to ignore this message. A typical > ignore is when a button > // is clicked. This, is most cases, shouldn't change the state > of the form > IF .not. LOGIC( _cast, SendMessage( ptr( _cast, oE:lParam ),0 , > 0L ,0L ) ) > self:leditwin := true > self:Caption += ' - Modified' > ENDIF > ENDIF > //RETURN 0L > ENDIF > ENDIF > > RETURN SUPER:Dispatch( oE ) > > > But i'm getting some problems because this event happens even when i'm > setting the value on my windows in the post init method. So i think of > using a logic value to know when to start "catching" changes. Maybe > when the windows is shown? Which event must i use? I know the expose > event happens when the windows is paint. > > If you have some advise it would be great! > > P.S. Sorry for my bad english ;)
From: Jack Konings on 3 Apr 2010 05:14 Hi Phil, I don't know if this will help but : * (almost) every control on your window hass a valuechanged access to indicate if its value has been changed. * The cycle through all of your controls in that window; the standard window class of VO has a GetAllChildren method Greetings, Jack "Phil bayard" <philbayard(a)gmail.com> wrote in message news:1fea550f-cf4f-4577-b268-de499db6a7ca(a)r27g2000yqn.googlegroups.com... > Hi everybody, i'm only using VO for 3 weeks now and i'm getting some > troubles. > > I'm trying to find a way to know if a windows full of data has been > edited by the user (the windows contains Combobox, textfield, bbrowser > and checkbox). After some searchs, i'm trying to use a method i found. > > METHOD Dispatch( oE ) CLASS IgDataWindow > LOCAL dwNotification as DWORD > > > dwNotification := HiWord( oE:wParam ) > > IF oE:Message == WM_COMMAND > > > // BN_CLICKED Sent on clicking push buttons, radio buttons and > check boxes > // CBN_EDITCHANGE Sent when manually changing info in the edit > portion of a combo box > // CBN_SELCHANGE Sent when changing the selection via mouse, or > keyboard in the listbox portion of combo > // EN_SELCHANGE Sent when changing data in a multi line text > field or rich edit control > // EN_CHANGE Sent when changing data in an SLE > > > // Are we interested in the message > IF dwNotification == BN_CLICKED .or. ; > dwNotification == CBN_EDITCHANGE .or. ; > dwNotification == CBN_SELCHANGE .or. ; > dwNotification == EN_SELCHANGE .or. ; > dwNotification == DTN_DATETIMECHANGE .or. ; > dwNotification == EN_CHANGE > > > // Yep, but have we done this before > IF self:leditwin == FALSE > // No we haven't, but are we to ignore this message. A typical > ignore is when a button > // is clicked. This, is most cases, shouldn't change the state > of the form > IF .not. LOGIC( _cast, SendMessage( ptr( _cast, oE:lParam ),0 , > 0L ,0L ) ) > self:leditwin := true > self:Caption += ' - Modified' > ENDIF > ENDIF > //RETURN 0L > ENDIF > ENDIF > > RETURN SUPER:Dispatch( oE ) > > > But i'm getting some problems because this event happens even when i'm > setting the value on my windows in the post init method. So i think of > using a logic value to know when to start "catching" changes. Maybe > when the windows is shown? Which event must i use? I know the expose > event happens when the windows is paint. > > If you have some advise it would be great! > > P.S. Sorry for my bad english ;) > > __________ Information from ESET NOD32 Antivirus, version of virus > signature database 4995 (20100402) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > >
From: richard.townsendrose on 5 Apr 2010 08:51 Hi Phil, there are two real ways apart from editchange() which is good in some cases - see below. a) vo's validation: FieldSpec:SetValidation() b) write your own based on editfocuschange() editchange() works on every keystroke - good for passwords etc e.g. METHOD EditChange(oControlEvent) CLASS Logon LOCAL oControl AS Control oControl := IIF(oControlEvent == NULL_OBJECT, NULL_OBJECT, oControlEvent:Control) SUPER:EditChange(oControlEvent) IF ocontrol:NameSym==#REFERENCE SELF:ShowName(TRUE) ENDIF RETURN NIL METHOD ShowName(lEditing) CLASS LogOn LOCAL lFound:=FALSE AS LOGIC IF ! Empty(SELF:oDCReference:TextValue) IF SELF:oNMServer:Seek(PadR(SELF:oDCReference:TextValue,8)) lFound:=TRUE SELF:oDCNamex:TextValue:=Trim(SELF:oNMServer:FIELDGET(#NAMEX)) SELF:oDCContact:TextValue:=Trim(SELF:oNMServer:FIELDGET(#CONTACT)) ENDIF ENDIF IF lFound SELF:oDCPassword:Enable() SELF:oCCDoOk:Enable() IF ! lEditing SELF:oDCPassword:SetFocus() ENDIF ELSE SELF:oDCPassword:Value:='' IF SysObject():AppNo == TDOC_ADM_APPNO SELF:oCCDoHelp:Show() SELF:oDCPassword:Enable() ELSE SELF:oDCPassword:Disable() ENDIF SELF:oCCDoOk:Disable() SELF:oDCNamex:TextValue:='' SELF:oDCContact:TextValue:='' ENDIF RETURN NIL for validation our way ... please email me for code as it is built into windopws, and when a field is invalid it changes background, and alo is built into window class. we have also built a "dirty" mechanism to trigger save and cancel methods, and also our tabcontrol class to make sure the user cannot lose chnaged data - thats from editchnage() email me if you want some code. richard
From: Willie Moore on 5 Apr 2010 09:24
Phil, I have subclassed the datawindow and dialog windows so I could handle datavalidation. It also handles the messages that come through before the window is shown. Email me at williem(a)wmconsulting.com and I will send you the subclassed datawindow. I did a class on it at Devfeast a few years ago. Regards, Willie "Phil bayard" <philbayard(a)gmail.com> wrote in message news:1fea550f-cf4f-4577-b268-de499db6a7ca(a)r27g2000yqn.googlegroups.com: > Hi everybody, i'm only using VO for 3 weeks now and i'm getting some > troubles. > > I'm trying to find a way to know if a windows full of data has been > edited by the user (the windows contains Combobox, textfield, bbrowser > and checkbox). After some searchs, i'm trying to use a method i found. > > METHOD Dispatch( oE ) CLASS IgDataWindow > LOCAL dwNotification as DWORD > > > dwNotification := HiWord( oE:wParam ) > > IF oE:Message == WM_COMMAND > > > // BN_CLICKED Sent on clicking push buttons, radio buttons and > check boxes > // CBN_EDITCHANGE Sent when manually changing info in the edit > portion of a combo box > // CBN_SELCHANGE Sent when changing the selection via mouse, or > keyboard in the listbox portion of combo > // EN_SELCHANGE Sent when changing data in a multi line text > field or rich edit control > // EN_CHANGE Sent when changing data in an SLE > > > // Are we interested in the message > IF dwNotification == BN_CLICKED .or. ; > dwNotification == CBN_EDITCHANGE .or. ; > dwNotification == CBN_SELCHANGE .or. ; > dwNotification == EN_SELCHANGE .or. ; > dwNotification == DTN_DATETIMECHANGE .or. ; > dwNotification == EN_CHANGE > > > // Yep, but have we done this before > IF self:leditwin == FALSE > // No we haven't, but are we to ignore this message. A typical > ignore is when a button > // is clicked. This, is most cases, shouldn't change the state > of the form > IF .not. LOGIC( _cast, SendMessage( ptr( _cast, oE:lParam ),0 , > 0L ,0L ) ) > self:leditwin := true > self:Caption += ' - Modified' > ENDIF > ENDIF > //RETURN 0L > ENDIF > ENDIF > > RETURN SUPER:Dispatch( oE ) > > > But i'm getting some problems because this event happens even when i'm > setting the value on my windows in the post init method. So i think of > using a logic value to know when to start "catching" changes. Maybe > when the windows is shown? Which event must i use? I know the expose > event happens when the windows is paint. > > If you have some advise it would be great! > > P.S. Sorry for my bad english ;) __________ Information from ESET NOD32 Antivirus, version of virus signature database 5000 (20100405) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com |