I want the user to notice that the report he's currently using is deprecated and replaced by another one. Therefore I'll need to have a popup like an info message on program start.
But when I try to run my code like this:
INITIALIZATION.
MESSAGE i355(zz).
The message only appears in the status bar.
This approach would look okay from user side:
INITIALIZATION.
DATA: w_mes TYPE string.
MESSAGE i355(zz) INTO w_mes.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1 = w_mes.
But in fact it's very messy.
Is there a smoother way to display an info message on program start?
According to the behavior matrix of the MESSAGE statement in Dialog Processing, that is not possible. You might want to move the statement to a different section, e. g. START-OF-SELECTION.
You could use DISPLAY LIKE for a message that is originally of type E to achieve what you want but then the users will not be able to execute this deprecated version at all.
INITIALIZATION.
MESSAGE e184(sabapdocu) WITH 'Sorry, Batory!' DISPLAY LIKE 'I'.
Such a message will be displayed as a popup.
One can imagine that this is not allowed to preserve both the ability to call report programs using SUBMIT from all contexts(i.e. batch, rfc, update) and to allow external subroutine calls(PERFORM ABC IN PROGRAM XYZ).
In instances where this sort of thing is required, perhaps it is best to configure a transaction code(using SE93) to call the program in some way such that the message is displayed.
Here's a quick example using a local class:
CLASS lcl_selcr_mess DEFINITION.
PUBLIC SECTION.
METHODS
start. "#EC CALLED
ENDCLASS.
CLASS lcl_selcr_mess IMPLEMENTATION.
METHOD start.
MESSAGE i001(00) WITH 'Deprecated...' DISPLAY LIKE 'I'.
CALL SELECTION-SCREEN 1000.
ENDMETHOD.
ENDCLASS.
If you feel this approach is obtrusive, I suspect this can also be done by creating a "dummy" screen which only displays the message, then passes flow to the selection screen. Create a dialog transaction to call the dummy screen.
Related
Relatively new to coding and have taken up lots of small projects to help learn the basics, and I have now set myself a challenge of a "bigger" one. Essentially I want to recreate the Message Box but with my own styling and customisable elements.
I have got the basics in a class and created it, however I want the class to have two options.
1) load all the details from an XML file for the message, I have done this and that works.
2) I want it to be like the standard message box where you can pass in parameters.
My question is, How can I achieve number 2.
I have tried adding details into the Show/Load subs but no luck, the only way around it I can see is with properties but that would take too long.
I want to be something like the below.
classname.show("message","tittle",icon,"buttons",imagefile,"caption")
However alot of my code is done in the load method as opposed to show, so it needs to be visible / accessible there.
Any help / advice would be appreciated.
Properties are definitely the way to go. It also makes sense: Conceptually, the message being shown is a property of the message box.
Your Show method would look like this:
Public Shared Show(message As String, title As String, ...)
Dim box as New MyMessageBoxWindow()
box.Message = message
box.Title = title
...
box.ShowDialog()
End Sub
In the Load method of MyMessageBoxWindow, you access these properties and configure the UI elements.
I'm trying to write a class method which recieves a string and prints it.
I've tried this:
log: aMessage
Transcript show: aMessage; cr.
and tried to use it as follows:
ContractObject log: 'aaa'.
(ContractObject is the name of class) but it didn't work.
I'm assuming it has something to do with the fact that it's a dynamic language and that it's not known that it's a string.
I tried to convert it etc. Nothing worked.
No, types are definitely not the problem here. What do you mean by "it didn't work"? What was the error message you got? Did you get any at all?
Do you have the Transcript open? If it's not open you wont see anything. You can open it programmatically by evaluating Transcript open or manually by using the menu.
Also, make sure that you have implemented #log: on the class side (that's what you see when you click the class button in the code browser).
Is there any sort of flag or way to call a method without triggering any event handlers?
FOR EXAMPLE
I'm handling a controlTextDidChange method and checking to see if the character returned by a keystroke is valid. If it's not, I remove it; if it is, I append a word. The problem is that when I change the text while in controlTextDidChange, controlTextDidChange is called again and the program will loop indefinitely. I know I can use an instance variable to get around this, but is there any sort of flag or way to call a method without triggering any event handlers?
To expand the comment into a quick answer.
You have a method that issues a notification by design. You want it to not issue that notification. You don't have an alternative available that does the same thing w/o the notification. If you want it to never issue that notification, and you have access to the code for the method, you could swizzle the method to a version where you've just commented out the notification. Of course, if you had the code, you could just add another method, and call that one. So you don't have the code, and all that's moot.
Can't you just bracket that invocation in code that removes the listener and then restores the listener? In other words, psuedocode like this:
[self.controlThingy removeObserver:self]
[self.controlThingy myMethod]
[self.controlThingy addObserver:self]
You've then made self deaf to notifications for that one invocation of myMethod. I've done similar things with bindings and KVO.
I made a game have two objects in the hierarchy panel. One called GameScreen and another called Clock I set up. Each has its own script attached. GameScreen uses game.js and the other uses clock.js.
When I win the game a popup box appears and says, "You've won!" This is caused by the game.js script. However, the clock.js is still running, so my clock is still counting down. When the time is up the clock.js makes a popup box saying, "you lose!"
This causes for a "you win" screen to pop up when you win and then later a you lose screen to appear. As you can probably guess, this is super annoying. If there was a way I could change variables in one script from another,, I could get the clock to stop when you won or I could get the game to stop when the time ran out.
Is there some way to do this??
For example here are two javascript files one on clock and the other on GameScreen . I want the first one to change the variable changeMe in the second to two.
1.js:
function start(){
}
2.js:
var changeMe:int;
When you win the game, you can change clock's variable from game.js this way:
GameObject.Find("Clock").GetComponent("clock.js").variable_name = new_value;
, where [variable_name] and [new_value] obviously depend on your project. variable_name has to be an exposed variable.
You can simply use SendMessage() it will make you able to call a function from another object easily.Basically you need to write a function to destroy the clock after wining the game,let's say your function is called destroyClock so you should add that to your game.js script:
gameobject.Find("here goes the name of your clock obj").sendMessage("destroyClock")
I have two page application and the main page is default is "MainPage.xaml" and the second one is "AddPerson.xaml" when user click a button on main page I want the app to take user to "AddPerson" page.
And I wrote following for the Click event of the button
Me.Frame.Navigate(System.Type.GetType("AddPerson.xaml"))
and I am getting the following error
An exception of type 'System.NullReferenceException' occurred in MedicineSchedule.exe but was not handled in user code
Additional information: Object reference not set to an instance of an object.
If there is a handler for this exception, the program may be safely continued.
I tried other method of navigationservice.navigate which I cannot find the class in VS2013 express at all. The only method available is Me.Frame.Navigate in my project, please let me know how I can get this simple thing to work.
If it was .net 2.0 I would simple called new form with form.lod or something similar.
This doesn't work?
this.Frame.Navigate(typeof(AddPerson));
If you want/have to use a string take a look at the reply here:
convert string to type of page