1. Aleš Vojáček
  2. PowerBuilder
  3. Thursday, 24 June 2021 13:20 PM UTC

Hi all,

I'm using on some fields in datawindow dropdown calendar. If I choose date from calendar then event ItemChanged on datawindow is fired, but when I type date manualy into field and tab out from that field, then ItemChanged event is not fired.

Is there some workaround to be able to react on both type of changed value?

 

Thank you Ales

P.S. I'm using PB2019R3

 

EDIT:

In case that someone will face the same problem.

Problem was not in using editchanged event, but in using SetItem and hoping that ItemChanged will be fired.

When I changed SetItem to SetText, everything working now.

I had little break from PB (15y) so some hidden gems I forgot or may be never knew. I have to support some apps in PB which I did not develop or even know, so some bugs will be challenging for me. :-) 

TY all for their time spent on helping me.

 

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 24 June 2021 14:04 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi, Alex -

Manually entering a date, then tabbing out of a DW column where the data type is "date" and the DatePicker control is enabled fires the iItemChanged event in my test using PB 2019R3 using a base DW control (no ancestor) in a new, test window. The only other code in the DW control is "InsertRow(0)" in the Constructor event.

Using the DatePicker to select a date, the ItemChanged event does not fire until I tab to the next column or click in another column.

If this is not the behavior you are experiencing, then I suggest you try a test case that mimics what I have done to see if behaves similarly. If it does, then you probably have code in the DW control and/or window that exhibits the problem that is interfering with the default behavior.

Best regards
John

Comment
  1. John Fauss
  2. Thursday, 24 June 2021 18:58 PM UTC
Aleš; your original post did not mention your app uses the PFC. If the PFC/PFE libraries are old, then I agree 100% with Chris that you should update them. As an additional test, I tried similar test as before except using a relatively recent version of the PFC libraries, in a DW control inherited from u_dw in a window inherited from w_sheet, and the ItemChanged event fires regardless of whether the date is manually typed or selected via the PB DropDown Calendar.
  1. Helpful
  1. Aleš Vojáček
  2. Thursday, 24 June 2021 22:45 PM UTC
Thank you all.

I had a little pause from PB (15 years) now I have to support few PB apps and I have to learn some things again. Some things are confusing me. I remember some hacking in PB6.5 so my bad was that this will be one of them, which has to be done.

I will try to use new pfcs, but I can imagine that transition will give me some challenges.



Again thank you a lot.
  1. Helpful
  1. Aleš Vojáček
  2. Thursday, 24 June 2021 23:08 PM UTC
Problem solved (kind of).

There is code in editchanged (in u_dw):

string ls_col

Integer li_rok



IF gnv_app.ii_rok > 0 THEN

li_rok = gnv_app.ii_rok

ELSE

li_rok = year (today ())

END IF



ls_col = dwo.name



if this.describe (ls_col + ".coltype") = "date" then

if right (data, 4) = "0000" and isdate (left (data, 6) + string (li_rok)) then

this.SetItem (row, ls_col, date (left (data, 6) + string (li_rok)))

end if

end if

which is filling year after typing day and month into date field.

If I comment out this code it calls ItemChanged on that field.

Is there any propper way to set year and get called itemchanged?



Thank you.

A.



  1. Helpful
There are no comments made yet.
Aleš Vojáček Accepted Answer Pending Moderation
  1. Friday, 25 June 2021 06:51 AM UTC
  2. PowerBuilder
  3. # 1

So in case that someone face the same problem.

Problem was not in using editchanged event, but in using SetItem and hoping that ItemChanged will be fired. When I changed SetItem to SetText, everythink working now.

 

Thanks for your time.

A.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.