Date Picker Attribute Type, Whenever Selected

Hello all,

 

I am trying to make it so that whenever you click on a date attribute of an object, a date picker window drops down. I basically don't want to have to type in the date each time I want to enter or change the object's attribute. I know I can make it a DXL attribute, but I want the DXL attribute's script to run whenever you click it, instead of running when you open the module. Is this possible? Here's what I currently have, which only works on the current object when you first open a module. It needs a lot of work still.

(BTW: I am using IBM Rational DOORS 9.6)


Object obj = current
DB datePickerBox = create("Choose Date ", styleCentered)
Date init = dateAndTime(today)   
DBE oDate= date(datePickerBox , 30,init, true)


void doGet(DB datePickerBox ) {
Date d = get(oDate)
obj."Date" = d
}

apply(datePickerBox , "Go", doGet)
realize(datePickerBox)
show(datePickerBox )

 

Hersh


HershSangani - Mon Aug 07 14:00:57 EDT 2017

Re: Date Picker Attribute Type, Whenever Selected
Mathias Mamsch - Mon Aug 14 11:08:19 EDT 2017

What you can try is to use a "sync" trigger to determine if the user changed to current object. On the sync event you would then refresh the GUI to show the current values and update "obj". You can even put a "change" event to the date picker to update immediately when the user chooses a new date (instead of having to click "Go". 

You should not try to have this Dialog popup whenever the user enters "edit" mode on the attribute (which might be possible, but is awkward to program and probably not stable). Instead I would use a "topMost" dialog that will stay on top, while the user works on the module. This way the user can launch the script, use the date picker on the current object inside the GUI to set the attribute and close the GUI when he is done. 

Maybe that helps, regards, Mathias

Re: Date Picker Attribute Type, Whenever Selected
HershSangani - Tue Aug 15 10:26:57 EDT 2017

Mathias Mamsch - Mon Aug 14 11:08:19 EDT 2017

What you can try is to use a "sync" trigger to determine if the user changed to current object. On the sync event you would then refresh the GUI to show the current values and update "obj". You can even put a "change" event to the date picker to update immediately when the user chooses a new date (instead of having to click "Go". 

You should not try to have this Dialog popup whenever the user enters "edit" mode on the attribute (which might be possible, but is awkward to program and probably not stable). Instead I would use a "topMost" dialog that will stay on top, while the user works on the module. This way the user can launch the script, use the date picker on the current object inside the GUI to set the attribute and close the GUI when he is done. 

Maybe that helps, regards, Mathias

Hi Mathias,

 

Thank you for responding!

With your method, will it be possible to edit different date attributes of the same object? My module has many objects, and each object has many attributes that are of the type "date."

Do you mean that I can keep the dialog open and use it to edit different attributes on the same object?

 

Hersh

 

Re: Date Picker Attribute Type, Whenever Selected
Mathias Mamsch - Tue Aug 15 15:58:54 EDT 2017

HershSangani - Tue Aug 15 10:26:57 EDT 2017

Hi Mathias,

 

Thank you for responding!

With your method, will it be possible to edit different date attributes of the same object? My module has many objects, and each object has many attributes that are of the type "date."

Do you mean that I can keep the dialog open and use it to edit different attributes on the same object?

 

Hersh

 

Sure. You can have three date pickers on the dialog (for each attribute). If you have a fixed set of attributes its pretty easy to do. To dynamically create date pickers for each date attribute in the module is more complicated.

You can find an example for a dialog box with a sync trigger here: 

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014271926&ps=25

Regards, Mathias