Home » Developer & Programmer » Forms » Code Sharing (Oracle Forms 11g)
Code Sharing [message #663370] Wed, 31 May 2017 13:21 Go to next message
sourabh2511
Messages: 3
Registered: May 2017
Junior Member
Hi,

I have a form where I have two buttons. There is a piece of code in button 1 which I want to use again in button2. IS there a way to share the code from button 1.


Regards
Sourabh


[MERGED by LF]

[Updated on: Fri, 02 June 2017 15:42] by Moderator

Report message to a moderator

Re: Code Sharing [message #663371 is a reply to message #663370] Wed, 31 May 2017 14:28 Go to previous messageGo to next message
Littlefoot
Messages: 21802
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Sure. Put that code into a procedure, and then call that procedure from both WHEN-BUTTON-PRESSED triggers.
Program unit [message #663419 is a reply to message #663370] Fri, 02 June 2017 09:42 Go to previous messageGo to next message
sourabh2511
Messages: 3
Registered: May 2017
Junior Member
Thank you Surprised I was able to do that.




Hi,

I have a program unit that I need to call from two triggers (When-button-pressed from two different buttons). Depending on which trigger is calling the program unit, I need to display a message. Can you please help me to understand as to how do I know which trigger is calling the program unit ?

[Updated on: Fri, 02 June 2017 15:41] by Moderator

Report message to a moderator

Re: Program unit [message #663424 is a reply to message #663419] Fri, 02 June 2017 12:44 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
Either send in some flag or display the message in the WBP trigger.
Re: Program unit [message #663427 is a reply to message #663424] Fri, 02 June 2017 13:15 Go to previous messageGo to next message
Michel Cadot
Messages: 68596
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

... or why just one program unit and not two, one for each trigger?

Re: Program unit [message #663449 is a reply to message #663427] Fri, 02 June 2017 15:45 Go to previous message
Littlefoot
Messages: 21802
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
@Michel: because we've just done the opposite. As this question is closely related to OP's previous topic, I merged them.

@sourabh2511: another option would be to add a parameter to the procedure. You'd pass it from the WBP triggers and display the appropriate message. Here's what I mean:
procedure your_prc (par_which_wbp in varchar2) is
begin
  ... your code here

  if par_which_wbp = 'first' then
     message('WBP 1 pressed');
  elsif 
     ...
  end if;
end;
Previous Topic: FRM-40202: Field must be entered.
Next Topic: FRM-40734 Internal Error PL/SQL error occurred with forms 11grt2 webutil
Goto Forum:
  


Current Time: Thu Feb 22 05:59:50 CST 2024