Make a hotspot cell F4-enabled while insert. Possible? - abap

My requirement is as follows:
I show records in an alv grid (CL_GUI_ALV_GRID), where the user can add new ones.
I have a keyfield, MATNR, which is disabled on existing records. This one does
not really need to have a working F4 SH icon. It must have a hotspot.
When the user decides to add a new record, I want to allow F4,make the field a
hotspot and enable it.
However, it turns out, that neither combining cellstyles 1-4 works (appearently there is no combining of their raws resulting in a multiple style) , nor does fieldcat-f4available = abap_true work together with fieldcat-hotspot = abap_true.
I must admit, that I do not come often over this kind of requirements... therefore I am asking in here, if anybody knows a way (best practice preferred).
Until now I set the cellstyles depending on row-contents, and the fieldcat is set up more or less statically.
So in the fieldcat, F4 is set up, and in the celltab style MC_HOTSPOT is set up.
However, this also forbids to entering values manually. Only the F4 value remapping works.

I have just had this problem and thought I'd share my solution.
Apparently the way to combine styles is with bitwise operations:
ls_style-style = cl_gui_alv_grid=>mc_style_hotspot BIT-OR
cl_gui_alv_grid=>mc_style_f4 BIT-OR
cl_gui_alv_grid=>mc_style_enabled.
Should create an editable field with hotspot and F4.
You should also mark edit and hotspot in the field catalog.

I needed to have: editable field with f4 and hotspot. My solutions:
I set in ls_fcat :
hotspot = abap_true, and f4avaliable = abap_true
In style of field, I set:
style = cl_gui_alv_grid=>mc_style_f4 BIT-OR cl_gui_alv_grid=>mc_style_enabled

Related

Access Setting Theme VBA using MsoThemeColorSchemeIndex is off by 1

When setting a control/form theme, I often use VBA, as I can change the color on the fly. Works great. I have been trying to move my Database away from using hard-coded numbers, and built up a theme module that is included which has themes mapped so I could just change them there instead of everywhere else.
Then I realized, hey, there's an easier way to do this (or...so I thought).
Enter Enums MsoThemeColorIndex and MsoThemeColorSchemeIndex. This way, I can even do fancy things like decide that when I use myInternalTheme1 constant, I could just switch it out with MsoThemeColorSchemeIndex.msoThemeAccent1.
A long while back I noticed that if I used what is shown on the help docs (above), the themes were "off" by 1. Namely 5 (msoThemeAccent1 "Theme1"), instead of mapping to msoThemeAccent1 actually maps to "Theme2", and "Theme 2" Color is displayed. So, I just manually adjusted. But I'm wondering if I'm missing something here, and I'm using the value incorrectly?
I've used SaveAsText to export these forms after saving the values, and when I do, the field that's had "Theme 1" manually applied in Properties shows that the value 4 is used, which "should" map to msoThemeColorLight2, but doesn't.
Field's Backtheme setting:
BackThemeColorIndex =4
How I'm using this:
' In my "modColor"
Public Const MythemeAccent1 As Integer = 4 ' (help docs specify this as MsoThemeColorIndex.msoThemeColorLight2)
' This one colors the header in Theme2 "wrong color, correct enum value???"
' MsoThemeColorSchemeIndex.msoThemeAccent1 = 5 (as docs say)
Me.section(acHeader).BackThemeColorIndex = MsoThemeColorSchemeIndex.msoThemeAccent1
' This one colors the header with Theme1 "correct color, wrong enum value???"
' MsoThemeColorSchemeIndex.msoThemeLight2 = 4 (as docs say)
Me.section(acHeader).BackThemeColorIndex = MsoThemeColorSchemeIndex.msoThemeLight2
' my internal module, this works correctly (code looks correct, and correct color used).
Me.section(acHeader).BackThemeColorIndex = MythemeAccent1
If I assign the color in Design View via Form Properties > FormHeader > Format > Back Color > "Accent 1" it works correctly, and the theme is properly applied.
FormHeader Properties Format
I've verified the theme is correct, numerous times. I exported the theme, and verified that the XML for "Accent 1" is correct, and that "Accent2" is different. "Theme 1" is "Bluish" and "Theme 2" is "Redish" for reference, so it's not like my monitor rendering is just making me think it's different.
Excerpted XML from .Thmx file:
<a:accent1>
<a:srgbClr val="5C83B4"/>
</a:accent1>
<a:accent2>
<a:srgbClr val="E74B4B"/>
</a:accent2>

How to convert the spectrum type ("Spectrum" -> "Convert Data to")

Is there a manner in which one can convert the spectrum type, for instance to EELS, by DM scripting? This screenshot represents what I'm referring to. I'd like to import a dataset using the GMS 3.4 Python interface, and then turn that into a EELS dataset for further processing (ideally without having to manually interface with the screenshotted menu bar).
Yes there is.
The "type" is simply a meta-data tag
which you can easily set with the TagGroup commands.
There is, however, one complication:
Data "registers" itself with DM when it first appears. Changing the meta-tags manually doesn't change this registration. (The menu command, however, does.)
Thus, you will only see effect of the type change when
either:
You save, close and reopen the data
You clone the data, throw away the original, and display the clone
The second option might cause issues with data-linkage though, as the unique image ID of the data is newly created.
Example using the first method (requires save & load):
image img:=GetFrontImage()
TagGroup tg = img.ImageGetTagGroup()
tg.TagGroupSetTagAsString("Meta Data:Signal","EELS")
imageDocument doc = img.ImageGetOrCreateImageDocument()
doc.ImageDocumentSave(0)
string path = doc.ImageDocumentGetCurrentFile()
doc.ImageDocumentClose(0)
doc = NewImageDocumentFromFile(path)
doc.ImageDocumentShow()
An alternative option is to rely on the menu command. If it is present, then you can simply use the ChoseMenuItem() command to invoke it.
However, the command will only be available with the UI when the data you want to change is front-most (i.e. not a script window!) You will need to ensure by script, that this is the case. A simple ShowWindow() will do.
image img:=GetFrontImage()
img.ShowImage()
if ( !ChooseMenuItem("Spectrum","Convert Data To","None") )
Throw( "Conversion to none failed.")
if ( !ChooseMenuItem("Spectrum","Convert Data To","EDS") )
Throw( "Conversion to none failed.")
Disadvantage of this solution: You will get the user-prompts.

Reporting Services - aligning Layout direction Tablix dynamic

Deal All,
Is there a way to have same report show in both layout direction based on parameter?
I have two data set one for label and one for data based on specific parameter show the labels
needed and the data needed but i am unable to switch the lay out direction it keeps LTR.
I need if anyone have an idea to change the layout direction from parameter.
I am having 50 reports and i don't like to have 150 reports because i am having 3 language.
I don't need to change the design of reports if there a new adding columns or changing columns.
I did it in data base by sending paramater name of the report and then get the dataset for it and then use the parameter of language to get label and data.
thanks in advance
I dont know if this helps, because I have no experience with RTL, however if you select a TextBox and open the properties via F4, you can select for the text direction not only LTR or RTL but also an expression. Maybe this gives you the flexibility, you are looking for?
Please right click on the report and choose view code or press F7 and insert below code for the field:
<Style>
<FontFamily />
<TextAlign>Right</TextAlign>
</Style>
and
<Direction>RTL</Direction>

Accessing the changed state of a radio button using rollout creator (Maxscript)

I've run across another issue using the dynamic rollouts. I'd like to add a handler for when a radio button group's selection is changed. Here is what I have:
--Instantiate a new dynamic rollout object
dro = rolloutCreator "CustomParamsRollout" "Edit Custom Parameters"
--Begin building rollout
dro.begin()
--Create an array to hold the names of the radio button options
dro.addLocal "RadioOptions" init: #("Predefined", "Custom")
--add control --type --label --displayed name --labels --alignment
dro.addControl #radiobuttons #rdo_1 "radio_1" paramStr: "labels:RadioOptions align:#left"
--Add a handler for the first radio button
dro.addHandler #rdo_1 #changed filter:on paramStr:"1" codeStr:"MessageBox #Hey#"
createDialog (dro.end())
The error I keep getting is:
Compile error: Bad number or time syntax
In line: on rdo_1 changed 1do
Whenever I click on a radio button. I'm most certain that my syntax is poorly written, as that has been the biggest hangup in this project so far. Any helpful hints would be appreciated.
Thank you.
Since 3ds Max 2012 you need to add an extra space to the parameter string (in Max 2011 and earlier version it works without glitches. So instead of paramStr:"state" it would have to be paramStr:"state " – note that using integer for a name of variable will not work, rollout handlers don't in any way work like pattern matching, you need to handle different parameters inside the handler scope.

dojox.grid.DataGrid: how to access data from a click event?

I'm using Dojo 1.5 (including dojox). I have a dojox.grid.DataGrid where each row represents a user. When I click a row, I want to redirect to a URL like /users/USER_ID. The user ID is one of the fields in the grid, so all I need to do in my onRowClick callback is to grab the user ID for the row that was clicked.
The click event contains a rowIndex property, and, indeed, I found a (rather old) post elsewhere that suggested I should be able to do:
var row = dijit.byId('grid').model.getRow(e.rowIndex);
/* (Then grab the 0th field of the row, which is the user ID.) */
(Sorry, I've since lost the URL.)
But my grid object has no model attribute. What's up with that? Has the API changed? (My grid certainly is populated with data, which I can see, click, sort by column, et cetera).
So I'm stuck for now. Note, BTW, that it won't work to use rowIndex to directly access the grid's underlying dojo.data.ItemFileReadStore. That's because the grid is sortable, so there's no guarantee that the grid's rows will be in the same order as the store's.
Any hints would be deeply appreciated. I hope that the question is clear, and sufficiently general that any answers can help others in my predicament. Many thanks.
I have a similar scenario and I grab the value like this:
onRowClick: function(e) {
open_link(my_grid._getItemAttr(e.rowIndex, 'object_path'));
}
In this case my_grid is a reference to the datagrid and object_path is the column where I store the path to the object. open_link is of course a custom function of mine that as it implies, requests a server path.
So just change the specifics to suite your case and you should be fine.