PDA

View Full Version : Problem with Codejock Menu Item



Mike Cooper
16-Dec-2010, 06:28 AM
I have a pretty small application and thought that it would be good to use the CodeJock menus for it.

So i created the menus and all works fine. Except that I noticed 1 of the views that I openfrom the menu will only open once and then if it is closed cannot be reopened. At first I thought it was the view, but it is so simple, there is very little code in there at all.

And to further prove the point, if I move the view to any other "position" in the CodeJock menu, it operates fine AND if I open any other view in the 2nd slot on this menu, it will then only open once.

Here is the code... The failing Codejock menu item is the second one "Employee YTD Report"



Object oReportsMenuItem is a cCJMenuItem
Set psCaption to "Reports"
Set psTooltip to "Print Reports."
Set peControlType to xtpControlPopup
//Set pbEnabled to False
Object oPayrollDetailRptMenuItem is a cCJMenuItem
Set psCaption to "Payroll Detail"
Set psTooltip to "Print Payroll Detail"

Procedure OnExecute
Send activate_oPayrollDetail to (Client_Area(Self))
End_Procedure
End_Object

//THIS IS THE ONE THAT ONLY OPENS ONCE.
Object oEmployeeYTDRptMenuItem is a cCJMenuItem
Set psCaption to "Employee YTD"
Set psTooltip to "Employee Year To Date report"

Procedure OnExecute
Send activate_oEMPYTD to (Client_Area(Self))
End_Procedure // OnClick

End_Object


Object oROERptMenuItem is a cCJMenuItem
Set psCaption to "Record of Employment"
Set psTooltip to "Generate/Print an R.O.E."

Procedure OnExecute
Send activate_oIssueROE to (Client_Area(Self))
End_Procedure // OnClick

End_Object

Object oT4RptMenuItem is a cCJMenuItem
Set psCaption to "T4s"
Set psTooltip to "Generate/Print T4/T4 Summary"

Procedure OnExecute
Send Activate_oPrintT4 to (Client_Area(Self))
End_Procedure // OnClick

End_Object

Object oMaxContribsRptMenuItem is a cCJMenuItem
Set psCaption to "CPP/EI Maximum Contributions"
Set psTooltip to "Prints a listing of CPP/EI Contributions by Employee"

Procedure OnExecute
Send Activate_oMaxContributionsRpt to (Client_Area(Self))
End_Procedure // OnClick

End_Object

Object oEmployeeDefTimecardRptMenuItem is a cCJMenuItem
Set psCaption to "Employee Default Timecards"
Set psTooltip to "Prints a listing Employee Default Timecards"

Procedure OnExecute
Send Activate_oEmpDefcardListing to (Client_Area(Self))
End_Procedure // OnClick

End_Object

Object oPayItemRptMenuItem is a cCJMenuItem
Set psCaption to "Pay Item Code Listing"
Set psTooltip to "Prints a listing of Paycard Item Codes"

Procedure OnExecute
Send Activate_oEmpDefcardListing to (Client_Area(Self))
End_Procedure // OnClick

End_Object

End_Object



Every other item and menu item in the program functions fine except for the 2nd choice on this particular menu. Whatever view I open will only open once.

When I debug it, it seems to fire the Activate_.... only once, and then never again.

It has spooked me enough to consider avoiding the CodeJock stuff altogether. Has anybody seen this before?

Mike

Garret Mott
16-Dec-2010, 09:16 AM
Hi Mike -

Are you manually building these? I ask because the code I get from automatically creating them is different:



Object oOrdersMenuItem is a cCJMenuItem
Set psCaption to "Orders"
Set psTooltip to "Sales Orders"

Procedure OnExecute Variant vCommandBarControl
Handle hoClient
Get Client_Id to hoClient
Send activate_oOrderView of hoClient
End_Procedure
End_Object


Maybe this will make a difference?

Mike Cooper
16-Dec-2010, 09:43 AM
UPDATE:
There seems to be nothing wrong with the CodeJock.

I have migrated this from VDF7 and there seems to be something else going on. Just ignore this post.

Thanks

Mike

Mike Cooper
16-Dec-2010, 09:45 AM
Hi Garret

I have found that I can reproduce this outside of the CodeJock menu, so will have to scrutinize the project code itself. I jumped the gun on thinking that it was CodeJock menus causing the problem. It is also NOT the view since I can reproduce it at will with any view at all. I think that there is an errant piece of code coming from the migration from VDF7

Thanks for the reply, though

Mike

Mike Cooper
16-Dec-2010, 01:39 PM
Odd one, but here is what I found:

If I use a CodeJock Menu OR the older style menu (CREATE_MENU)

and open a view with

send Activate_oMyView to (Client_Area(self))

I was getting the case where a view that was in a specific spot in the menu would open the first time, but if I closed it and then tried to re-open it, nothing would happen.

I change the code to Send Activate_View (oMyView(Client_Area(self))) and this behaviour goes away!

Head scratcher for sure (at least for me)... wasted about 8 hour tinkering with this but at least I am past it now.

Mike

Mike Cooper
16-Dec-2010, 01:49 PM
NOPE THAT WASN'T IT EITHER.

When I changed all of the options to use the Activate_view then the behaviour returned???????

Also if I open up the view from another view first, then it all functions properly... Back to the drinking (er I mean drawing) board.

M

Garret Mott
16-Dec-2010, 02:16 PM
NOPE THAT WASN'T IT EITHER.

When I changed all of the options to use the Activate_view then the behaviour returned???????

Also if I open up the view from another view first, then it all functions properly... Back to the drinking (er I mean drawing) board.

M

Hi Again -

Have you tried the code that the studio creates (that I posted above - note the handle to the client area)? I have many apps running the CJ menus & have never had this problem. In fact, when I have moved non-CJ menu apps up to the CJ menus, I have found it easiest (boring, but easiest) to use the functionality in the Studio to add the menu items.

Also - is this view (or your subclass?) doing anything unusual in Activating, Activate_View, etc?

Get busy drinking/drawing!

Mike Cooper
16-Dec-2010, 03:06 PM
Hi Garret...

I just tracked this down... Quite technical but it was a "SPE" (Stupid/Silly/Sloppy Programmer Error).... I would fire that guy but then I would be out of a job. Anyway, I have a Standard Login View that I use amongst my various programs and normally this login sends an Activate_View to a Menu View of some sort. Since I am using now a CodeJock, I remmed out the message. What was strange is that the Login view still closed and everything looked normal

I found that I had to simply put
Send Close_Panel to (self) in the Login view and then everything worked fine.

Why on earth it presented like it did is a mystery to me, but I think I can *finally* say that I am through this one.


Mike

Garret Mott
16-Dec-2010, 03:16 PM
Nice to know I have some competition in the King of SPE's department...

Glad you got it sorted out!