Set width of custom control
Hi all
I have a cl_gui_custom_container in a dynpro. I would like to manage width of it. I tried to use method set_width, but it does not wrk. I try the get_width and it works. What am I missing? Is it possible to achieve width management?
thanks
Gabriele
Get_width will be working for the custom controller, but u will not keep the width for it. As the custom container is a considered as static container. so, u can't increase the size dynamically.
Similar Messages
-
How to have custom control in DataGridView display object's value?
I have a sample project located
here
The project has a main form `Form1` where the user can enter customers in a datagridview. The `CustomerType` column is a custom control and when the user clicks the button, a search form `Form2` pops up.
The search form is populated with a list of type `CustomerType`. The user can select a record by double-clicking on the row, and this object should be set in the custom control. The `DataGridView` should then display the `Description` property but in the background
each cell should hold the value (ie. the `CustomerType` instance).
The relevant code is located in the following classes:
The column class:
public class DataGridViewCustomerTypeColumn : DataGridViewColumn
public DataGridViewCustomerTypeColumn()
: base(new CustomerTypeCell())
public override DataGridViewCell CellTemplate
get { return base.CellTemplate; }
set
if (value != null && !value.GetType().IsAssignableFrom(typeof(CustomerTypeCell)))
throw new InvalidCastException("Should be CustomerTypeCell.");
base.CellTemplate = value;
The cell class:
public class CustomerTypeCell : DataGridViewTextBoxCell
public CustomerTypeCell()
: base()
public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
CustomerTypeSearch ctl = DataGridView.EditingControl as CustomerTypeSearch;
if (this.Value == null)
ctl.Value = (CustomerType)this.DefaultNewRowValue;
else
ctl.Value = (CustomerType)this.Value;
public override Type EditType
get { return typeof(CustomerTypeSearch); }
public override Type ValueType
get { return typeof(CustomerType); }
public override object DefaultNewRowValue
get { return null; }
And the custom control:
public partial class CustomerTypeSearch : UserControl, IDataGridViewEditingControl
private DataGridView dataGridView;
private int rowIndex;
private bool valueChanged = false;
private CustomerType value;
public CustomerTypeSearch()
InitializeComponent();
public CustomerType Value
get { return this.value; }
set
this.value = value;
if (value != null)
textBoxSearch.Text = value.Description;
else
textBoxSearch.Clear();
private void buttonSearch_Click(object sender, EventArgs e)
Form2 f = new Form2();
DialogResult dr = f.ShowDialog(this);
if (dr == DialogResult.OK)
Value = f.SelectedValue;
#region IDataGridViewEditingControl implementation
public object EditingControlFormattedValue
get
if (this.value != null)
return this.value.Description;
else
return null;
set
if (this.value != null)
this.value.Description = (string)value;
public object GetEditingControlFormattedValue(DataGridViewDataErrorContexts context)
return EditingControlFormattedValue;
public void ApplyCellStyleToEditingControl(DataGridViewCellStyle dataGridViewCellStyle)
this.BorderStyle = BorderStyle.None;
this.Font = dataGridViewCellStyle.Font;
public int EditingControlRowIndex
get { return rowIndex; }
set { rowIndex = value; }
public bool EditingControlWantsInputKey(Keys key, bool dataGridViewWantsInputKey)
return false;
public void PrepareEditingControlForEdit(bool selectAll)
//No preparation needs to be done
public bool RepositionEditingControlOnValueChange
get { return false; }
public DataGridView EditingControlDataGridView
get { return dataGridView; }
set { dataGridView = value; }
public bool EditingControlValueChanged
get { return valueChanged; }
set { valueChanged = value; }
public Cursor EditingPanelCursor
get { return base.Cursor; }
#endregion
private void CustomerTypeSearch_Resize(object sender, EventArgs e)
buttonSearch.Left = this.Width - buttonSearch.Width;
textBoxSearch.Width = buttonSearch.Left;
However, the `DataGridView` is not displaying the text and it also is not keeping the `CustomerType` value for each cell.
What am I missing?
Marketplace: [url=http://tinyurl.com/75gc58b]Itza[/url] - Review: [url=http://tinyurl.com/ctdz422]Itza Update[/url]Hello,
1. To display the text, we need to override the ToString method for CustomerType
public class CustomerType
public int Id { get; set; }
public string Description { get; set; }
public CustomerType(int id, string description)
this.Id = id;
this.Description = description;
public override string ToString()
return this.Description.ToString();
2. To get the cell's value changed, we could pass the cell instance to that editing control and get its value changed with the following way.
public partial class CustomerTypeSearch : UserControl, IDataGridViewEditingControl
private DataGridView dataGridView;
private int rowIndex;
private bool valueChanged = false;
private CustomerTypeCell currentCell = null;
public CustomerTypeCell OwnerCell
get { return currentCell; }
set
currentCell = null;
currentCell = value;
public CustomerTypeSearch()
InitializeComponent();
private void buttonSearch_Click(object sender, EventArgs e)
Form2 f = new Form2();
DialogResult dr = f.ShowDialog(this);
if (dr == DialogResult.OK)
currentCell.Value = f.SelectedValue;
this.textBoxSearch.Text = f.SelectedValue.Description;
#region IDataGridViewEditingControl implementation
public object EditingControlFormattedValue
get
if (this.currentCell.Value != null)
return (this.currentCell.Value as CustomerType).Description;
else
return null;
set
if (this.currentCell != null)
(this.currentCell.Value as CustomerType).Description = (string)value;
public object GetEditingControlFormattedValue(DataGridViewDataErrorContexts context)
return EditingControlFormattedValue;
public void ApplyCellStyleToEditingControl(DataGridViewCellStyle dataGridViewCellStyle)
this.BorderStyle = BorderStyle.None;
this.Font = dataGridViewCellStyle.Font;
public int EditingControlRowIndex
get { return rowIndex; }
set { rowIndex = value; }
public bool EditingControlWantsInputKey(Keys key, bool dataGridViewWantsInputKey)
return false;
public void PrepareEditingControlForEdit(bool selectAll)
//No preparation needs to be done
public bool RepositionEditingControlOnValueChange
get { return false; }
public DataGridView EditingControlDataGridView
get { return dataGridView; }
set { dataGridView = value; }
public bool EditingControlValueChanged
get { return valueChanged; }
set { valueChanged = value; }
public Cursor EditingPanelCursor
get { return base.Cursor; }
#endregion
private void CustomerTypeSearch_Resize(object sender, EventArgs e)
buttonSearch.Left = this.Width - buttonSearch.Width;
textBoxSearch.Width = buttonSearch.Left;
Cell:
public class CustomerTypeCell : DataGridViewTextBoxCell
public CustomerTypeCell()
: base()
public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
CustomerTypeSearch ctl = DataGridView.EditingControl as CustomerTypeSearch;
ctl.OwnerCell = this;
public override Type EditType
get { return typeof(CustomerTypeSearch); }
public override Type ValueType
get { return typeof(CustomerType); }
public override object DefaultNewRowValue
get { return null; }
Result:
Regards,
Carl
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Problem found in setting width of javafx.scene.control.Slider
I am trying to set the width of Slider control. But does not change whatever the value I provide.
I tried width value from 1 upto 100. It displays with constant width always.
Sample : Slider{width : 10.0}
Anyone have idea how to control the width of a Slider?Yes, I found the issue when I tried to use layout on the excellent application written by Baechul: [Node Bounding Rectangles & Coordinates|http://blogs.sun.com/baechul/entry/node_bounding_rectangles_coordinates]. Looks at comments for my version.
I found out that when in a layout, you have to set the width using the layoutInfo field. -
Set up for custom encode preset in Compressor for ATV2
using compressor 3.0.5 i would like to set up a customer encode preset for atv2.
ver 3.0.5 of compressor was released prior to atv2 so i would guess the current preset is for atv1.
here is a screen copy of the specs:
Name: H.264 for Apple TV
Description: H.264 1280x720 video @ 5Mbps, progressive. Audio is 44.1 kHz, stereo
File Extension: m4v
Estimated file size: 2.1 GB/hour of source
Device: Apple TV HD
Frame sync rate: 5 seconds
Video Encoder
Format: QT
Width and Height: Automatic
Pixel aspect ratio: Square
Crop: None
Padding: None
Frame rate: (100% of source)
Frame Controls: Automatically selected: Off
Codec Type: H.264
Multi-pass: Off, frame reorder: On
Pixel depth: 24
Spatial quality: 50
Min. Spatial quality: 50
Temporal quality: 50
Min. temporal quality: 50
Average data rate: 5 (Mbps)
Maximum data rate: 14 (Mbps)
Audio Encoder
Format: MPEG4
Sample Rate: 44.100kHz
Channels: 2
Bits Per Sample: 16
AAC encoder quality: high
Data rate: 128 Kbps
What changes should be made?
Thanks in advance.You have to add the Service Offerings and the Request Offerings in the Catalog Group. Nesting doesn't work because Service Offerings and Request Offerings are different types of objects.
This offers the option the manage the access to Service Offerings and Request Offerings very granular if needed. For instance you can control access to a Service Offering in one Catalog Group related to one user role (A) and use two additional Catalog Groups
with different Request Offerings related to other user roles (B) and (C). Result will lead to:
User in Role A and B -> Can see Service Offerings A containing Request Offerings B
User in Role A and C -> Can see Service Offerings A containing Request Offerings C
User in Role A, B and C -> Can see Service Offerings A containing Request Offerings B and C
User in Role A only -> Don's see anything because of the missing permission on any Request Offering. So the "empty" Service Request won't show up in the portal.
Hope his helps.
Andreas Baumgarten | H&D International Group -
How a custom control is advised it gains or looses focus?
Hey, at least I have a question to ask, instead of answering them... :-)
Actually, I already asked it in another thread, in one of my answers: [onMouseClicked Event Is Failing To Fire|http://forums.sun.com/thread.jspa?threadID=5391008] but I fear it is lost in a rather lengthly message, so I ask it in its own thread, because I was to bring the attention of knowledgeable people (hello Sun people! :-D).
The question is simple: In a custom control in JavaFX 1.2, with skin and behavior, how a control is advised when it gains or looses focus?
The purpose is to let the skin to change the look of the component upon these events, like it is done for standard controls (eg. putting a border around the focused control).
If the control is clicked, you know (unless it is disabled) that it will have the focus. But I see no way to see the lost of focus, nor when we gain (or loose) it with Tab/Shift+Tab (if it has focusTraversable to true).
I looked for onFocus() and onBlur() events (or similar), but found nothing. No mixin, nothing related in javafx.scene.input.TextInput and friends, etc.
I explored the Web but since 1.2 is still new, I found not much information. Only a fragment of source code in [Re: Further location optimizations|http://markmail.org/message/gsevtlkeq45rrdun] where I see scene.getFocusOwner() but this one isn't easily usable because it is package protected (and it is not an event, anyway).
A possible solution would be to have a timer to inspect the state focused of the nodes, but it is so kludgy I didn't even tried to implement it!
I hope I just missed the information... If there is no easy/official/working way in 1.2, I hope this will be corrected for next version!That's a very good remark, handling of focus highlight shouldn't be done at control (model)'s level. I hesitated to put it in behavior, but it feels more natural in the skin, so I did as you suggested.
you'll need an interface, and JavaFX does not do thatYou have mixins. But I didn't used them here.
focused variable never is set to trueHave you included the
public override var focusTraversable = true;
line?
To support multiple skins, my control becomes:
public class StyledControl extends Control
// Data related to the control (the model)
public var count: Integer;
public override var focusTraversable = true;
init
if (skin == null) // Not defined in instance
// Define a default styler
skin = ControlStyler {}
package function Incr(): Void
if (count < 9)
count++;
}quite bare bones (I intendedly keep the model simple).
Note I still define a default skin in case user doesn't provide it: they shouldn't care about this detail unless they want to change it.
I defined an abstract default skin, implementing most variables (particularly the public ones that can be styled) and the focus change:
public abstract class DefaultControlStyler extends Skin
//-- Skinable properties
public var size: Number = 20;
public var fill: Color = Color.GRAY;
public var textFill: Color = Color.BLACK;
public var focusFill: Color = Color.BLUE;
package var mainPart: Node; // Decorations (id, focus) are kept out of layout
package var focusHighlight: Node;
package var idDisplay: Text;
package var valueDisplay: Text;
init
behavior = ControlBehavior { info: bind control.id }
node = Group
//-- Behavior: call controller for actions
onMouseReleased: function (evt: MouseEvent): Void
(behavior as ControlBehavior).HandleClick(evt);
postinit
// Once defined by the sub-class, insert into the node
insert [ mainPart, idDisplay, valueDisplay ] into (node as Group).content;
public abstract function ShowIncrement(): Void;
var hasFocus = bind control.focused on replace
if (hasFocus)
ShowFocus();
else
HideFocus();
// Default handling of focus display, can be overriden if needed
public function ShowFocus(): Void
insert focusHighlight into (node as Group).content;
public function HideFocus(): Void
delete focusHighlight from (node as Group).content;
public override function contains(localX: Number, localY: Number): Boolean
return mainPart.contains(localX, localY);
public override function intersects(localX: Number, localY: Number,
localWidth: Number, localHeight: Number): Boolean
return mainPart.intersects(localX, localY, localWidth, localHeight);
}and the concrete skins implement the mainPart, idDisplay, valueDisplay, focusHighlight nodes, override ShowIncrement with an animation, override getPrefWidth and getPrefHeight to set to mainPart size and might override ShowFocus or HideFocus (if we want it behind mainPart for example).
The behavior is:
public class ControlBehavior extends Behavior
public var info: String; // Only for debug information...
// Convenience vars, to avoid casting each time
var control = bind skin.control as StyledControl;
var csSkin = bind skin as DefaultControlStyler;
public override function callActionForEvent(evt: KeyEvent)
println("{info}{control.count}: KeyEvent: {evt}");
if (evt.char == '+')
Incr();
package function HandleClick(evt: MouseEvent): Void
control.requestFocus();
Incr();
function Incr(): Void
control.Incr();
println("{info}: Ouch! -> {control.count}");
csSkin.ShowIncrement();
}and knows only the abstract default skin (to apply feedback of user input to skin).
I use it as follow:
Stage
title: "Test Styling Controls"
scene: Scene
width: 500
height: 500
content:
HBox
translateX: 50
translateY: 100
spacing: 50
content:
StyledControl { id: "Bar" },
StyledControl { /* No id */ layoutInfo: LayoutInfo { vpos: VPos.BOTTOM } },
StyledControl { id: "Foo" },
StyledControl { id: "Gah" },
StyledControl { id: "Bu", skin: AltCtrlStyler {} },
stylesheets: "{__DIR__}../controlStyle.css"
}BTW, I tried layoutY: 50 in place of the layoutInfo definition, but the control remained at default place. Am I reading incorrectly the ref. or is this a bug? -
I Just started using LV touch Panel module with an NI TPC-2106.
I have two differenct problems:
1) I was planning on using the "Meter" control quite a bit. I can set up the meter exactly how I like on the host PC, but on the touch Panel computer it seems to ignore my adjustments, mainly the start and end of the scale - i.e. I would like control to run from 0 to 360 with 0 straight up, using the entire circle. However, on the Touch panel computer it always puts 0 at about 7 o'clock and 360 at about 5 o'clock. I have also tried adding markers to no avail.
2) I am communicating with a compact fieldpoint controller. I can creat a shared variable that is a simple double with no problems. However, I have some shared variables that use a custom control for the variable type - bascially a cluster with a couble doubles, a time stamp, and an enumeration. It lets me drag the shared variable into my diagram, but it seems to ignore it when I run it.Ipshita_C,
- I am using LV 8.6.1f1and LV Touch Panel 8.6.1.
- I have attached a simplified VI that shows how I want to use the meter. Notice that the placement of the endpoitns does not work correctly on the touch panel, and that it ignores the arbitrary markers that I placed.
- I also have included an XY graph control that displays on the TPC with margins around the graph area that I removed from the graph control.
- For the shared variable, it appears to be an issue related to the touch panel, not fieldpoint. I found another thread in this forum that mentioned that clusters containing Enumerations do not work in shared variables on the touch panel. I changed the enumeration to an integer and it now works fine.
In general, there seem to be a disappointing number of limitations in the touch panel implementation. My biggest concern is that I have not found any documentation from NI that lists these limitations. I seem to have to try things out and see what works and what does not work. Can you point me to a comprehensive list of touch panel modules limitations?
Attachments:
test 2.vi 10 KB -
In custom control , I wnt to save the layout with variant -
Hi,
In custom control , I want to save the layout using variant and i want to choose the layout from the variant
Plz give me the details.
Rerards,
RaniHello Rani
I assume you have an ALV grid displayed within a custom control. For this ALV grid you want to be able to save layouts.
Assuming that you are using class CL_GUI_ALV_GRID you have set the following IMPORTING parameters when calling method go_grid->set_table_for_first_display:
" Fill variant parameter with following values:
gs_variant-report = syst-repid.
gs_variant-handle = 'GRID'. " 4-digit handle; required if you have multiple ALV grids
- I_SAVE = 'A' " allows saving of user-specific and global layouts
- IS_VARIANT = gs_variant
Regards,
Uwe -
How to change the height and width of a control?
Dear all,
is there anyway to change the height and width of a control?
In the property nodes, i am just able to read the bound values but cudnt write to it.
How can i set the bound values for a control?
Thanks,
RiteshNot all controls can be sized this way. For example to change the vertical size of a simple numeric, you would need to change the font size.
LabVIEW Champion . Do more with less code and in less time . -
Property binding between custom control and its aggregations
Hi,
I have a custom control with some properties, e.g., visible, and I would like to bind these properties to its aggregated controls without losing the two-way binding functionality. For example, imagine the following control:
sap.ui.core.Control.extend('dev.view.control.MyControl', {
metadata: {
properties: {
'visible': {type: 'boolean', defaultValue: false},
aggregations : {
_innerTable : {type : 'sap.m.Table', multiple : false, visibility: 'hidden'}
So in this example, I would like to bind the "visible" property of the _innerTable to the "visible" property of MyControl without losing two-way binding. That means that I do not want to read the "visible" property once in a constructor or so and set it on the inner table. Instead I want _innerTable to react on changes of the "visible" property of MyControl so that I can bind it, for example, with "visible={/model/visible}" on an instance of MyControl and _innerTable changes when the model changes.
Does anyone know if such a "piping" or "chaining" of properties is possible and how it would be done?It's close to my case, but you pass the label to your custom control from outside, where you also perform the data binding. In this case, you know which path should be bound to the label property.
In my case, the control is hidden inside my control, so I do not know which path from the model should be bound to the inner control. I want to somehow connect the property of my control with the property of the inner control.
So taking part of your example, the control would look like:
sap.ui.core.Control.extend('xcontrol', {
metadata: {
properties: {
'visible': {type: 'boolean', defaultValue: true}
aggregations : {
_header : {type : 'sap.m.Label', multiple : false, visibility: 'hidden'}
init: function() {
this.setAggregation('_header', new sap.m.Label({
visible: <????>
renderer: function(oRm, oControl) {
oRm.write("<div");
oRm.writeControlData(oControl);
var header = oControl.getAggregation('_header');
if (header) {
oRm.renderControl(header);
oRm.write('</div>');
At point <????> I want to somehow bind the visible attribute of the label to the visible property of xcontrol without losing the two-way binding, i.e., the label should react on changes of the visible property just like xcontrol would. -
TOP of PAGE using ABAP oo with single CUSTOM CONTROL
Can anybody please tell me how to handle TOP_OF_PAGE using ABAP OBJECTS with a SINGLE CUSTOM CONTROL and not with SPLIT CONTAINER(i.e. using single CL_GUI_CUSTOM_CONTAINER and single grid CL_GUI_ALV_GRID ). Is it possible if so Please help me out?
Hi Ravi,
Here is my code. i didn't handle the top_of_page event yet but created a method to handle.
REPORT ZSATEESH_ALV_CONTAINER MESSAGE-ID ZZ
LINE-SIZE 150 NO STANDARD PAGE HEADING.
PROGRAM id : ZSATEESH_ALV_CONTAINER *
Title : Sales document report *
Author : Sateesh *
Date : *
CR# : *
Dev Initiative :
Description :ALV GRID/LIST Report which displays the sales
document header data using ABAP Objects.
Modification Log
Corr. no date programmer description
TYPES Declaration
*--Type for the Header Sales data
TYPES: BEGIN OF TY_VBAK ,
INDICAT LIKE ICON-ID, " Icon
VBELN LIKE VBAK-VBELN, " Sales Document
AUDAT LIKE VBAK-AUDAT, " Document date
VBTYP LIKE VBAK-VBTYP, " SD document category
AUART LIKE VBAK-AUART, " Sales Document Type
AUGRU LIKE VBAK-AUGRU, " Order reason
NETWR LIKE VBAK-NETWR, " Net Value
WAERK LIKE VBAK-WAERK, " SD document currency
END OF TY_VBAK.
DATA Declaration
*--Tableto hold the header sales data
DATA: TB_VBAK TYPE STANDARD TABLE OF TY_VBAK.
*--Table to hold the Icons
DATA: BEGIN OF TB_ICON OCCURS 0,
ID TYPE ICON-ID, " Icon
NAME TYPE ICON-NAME, " Name of an Icon
END OF TB_ICON.
*--Declaration of ALV Grid Tables
DATA: TB_FDCAT TYPE LVC_T_FCAT, " Fieldcatalog
TB_SORT TYPE LVC_T_SORT. " Sorting
DATA: OK_CODE LIKE SY-UCOMM. " sy-ucomm
*--Reference variables for container and grid control.
DATA: CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
" Container reference
OBJ_ALV_GRID TYPE REF TO CL_GUI_ALV_GRID.
" Alv Grid reference
S T R U C T U R E S
DATA: X_FDCAT TYPE LVC_S_FCAT, " Fieldcatalog
X_LAYOUT TYPE LVC_S_LAYO, " layout
X_SORT TYPE LVC_S_SORT, " Sorting
X_VBAK TYPE TY_VBAK, " sales header stucture
X_ICON LIKE TB_ICON. " icons structure
C O N S T A N T S
*--Declaration of Constants
CONSTANTS :
C_GREEN(40) TYPE C VALUE 'ICON_GREEN_LIGHT',
C_RED(40) TYPE C VALUE 'ICON_RED_LIGHT',
C_YELLOW(40) TYPE C VALUE 'ICON_YELLOW_LIGHT',
C_X TYPE C VALUE 'X'. " Flag
SELECTION SCREEN
*--Block 1.
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETER: P_AUDAT LIKE VBAK-AUDAT
DEFAULT '20050101'(003). " doc date.
SELECTION-SCREEN: END OF BLOCK B1.
*--bLOCK 2.
SELECTION-SCREEN : BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
PARAMETER :P_ALVDIS AS CHECKBOX. " For List/Grid
SELECTION-SCREEN : END OF BLOCK B2.
Class LC_VBAK definition
CLASS LC_VBAK DEFINITION.
PUBLIC SECTION.
METHODS: VBAK_POPULATE, " sales header population
ICON_POPULATE, " Icons population
FINAL_POPULATE, " Final ALV population
DISPLAY, " Displaying ALV
TOP_OF_PAGE FOR EVENT TOP_OF_PAGE OF CL_GUI_ALV_GRID
IMPORTING E_DYNDOC_ID.
ENDCLASS. "LC_VBAK DEFINITION
Class LC_VBAK IMPLEMENTATION
CLASS LC_VBAK IMPLEMENTATION.
METHOD VBAK_POPULATE.
*-- selecting from VBAK
SELECT VBELN
AUDAT
VBTYP
AUART
AUGRU
NETWR
WAERK
INTO CORRESPONDING FIELDS OF TABLE TB_VBAK
FROM VBAK
WHERE AUDAT > P_AUDAT AND
NETWR > 0.
IF SY-SUBRC <> 0.
SORT TB_VBAK BY AUART VBTYP WAERK .
ENDIF.
ENDMETHOD . "VBAK_POPULATE
METHOD ICON_POPULATE.
*--selecting from ICON table
SELECT ID
NAME
INTO TABLE TB_ICON
FROM ICON.
IF SY-SUBRC = 0.
SORT TB_ICON BY NAME .
ENDIF.
ENDMETHOD . "ICON_POPULATE
METHOD FINAL_POPULATE.
*--looping through VBAK table into the work area
LOOP AT TB_VBAK INTO X_VBAK .
IF X_VBAK-NETWR <= 10.
*--Reading the ICON table into work area comparing field NAME
READ TABLE TB_ICON INTO X_ICON WITH KEY NAME = C_GREEN
BINARY SEARCH.
IF SY-SUBRC = 0.
X_VBAK-INDICAT = X_ICON-ID.
*--modifying the TB_VBAK table
MODIFY TB_VBAK FROM X_VBAK.
ENDIF.
ELSEIF X_VBAK-NETWR > 10 AND X_VBAK-NETWR < 100.
*--Reading the ICON table into work area comparing field NAME
READ TABLE TB_ICON INTO X_ICON WITH KEY NAME = C_YELLOW
BINARY SEARCH.
IF SY-SUBRC = 0.
X_VBAK-INDICAT = X_ICON-ID.
*--modifying the TB_VBAK table
MODIFY TB_VBAK FROM X_VBAK.
ENDIF.
ELSEIF X_VBAK-NETWR >= 100.
*--Reading the ICON table into work area comparing field NAME
READ TABLE TB_ICON INTO X_ICON WITH KEY NAME = C_RED
BINARY SEARCH.
IF SY-SUBRC = 0.
X_VBAK-INDICAT = X_ICON-ID.
*--modifying the TB_VBAK table
MODIFY TB_VBAK FROM X_VBAK.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD. "FINAL_POPULATE
METHOD top_of_page *
METHOD TOP_OF_PAGE.
PERFORM EVENT_TOP_OF_PAGE USING E_DYNDOC_ID.
ENDMETHOD. "top_of_page
METHOD DISPLAY.
*--Building fieldcatalog table
PERFORM FIELDCATLOG.
*--FOr making the Layout settings
PERFORM LAYOUT.
*--For sorting the fields
PERFORM SORTING.
*--perform for displaying the ALV
PERFORM ALV_GRID_DISPLAY.
ENDMETHOD. "DISPLAY
ENDCLASS. "LC_VBAK IMPLEMENTATION
*& Form FIELDCATLOG
Building the FIELDCATALOG
FORM FIELDCATLOG .
CLEAR: X_FDCAT,TB_FDCAT[].
X_FDCAT-ROW_POS = 1.
X_FDCAT-COL_POS = 1.
X_FDCAT-FIELDNAME = 'INDICAT'(004) .
X_FDCAT-TABNAME = 'TB_VBAK'(005).
X_FDCAT-SCRTEXT_L = 'STATUS_INDICATOR'(006).
APPEND X_FDCAT TO TB_FDCAT.
X_FDCAT-ROW_POS = 1.
X_FDCAT-COL_POS = 2.
X_FDCAT-FIELDNAME = 'VBELN'(007) .
X_FDCAT-TABNAME = 'TB_VBAK'(005).
X_FDCAT-SCRTEXT_L = 'SALES DOC'(008).
APPEND X_FDCAT TO TB_FDCAT.
X_FDCAT-ROW_POS = 1.
X_FDCAT-COL_POS = 3.
X_FDCAT-FIELDNAME = 'AUDAT'(009) .
X_FDCAT-TABNAME = 'TB_VBAK'.
X_FDCAT-SCRTEXT_L = 'DOC DATE'(010).
APPEND X_FDCAT TO TB_FDCAT.
X_FDCAT-ROW_POS = 1.
X_FDCAT-COL_POS = 4.
X_FDCAT-FIELDNAME = 'VBTYP'(011) .
X_FDCAT-TABNAME = 'TB_VBAK'.
X_FDCAT-SCRTEXT_L = 'SALES CATEGORY'(012).
APPEND X_FDCAT TO TB_FDCAT.
X_FDCAT-ROW_POS = 1.
X_FDCAT-COL_POS = 5.
X_FDCAT-FIELDNAME = 'AUART'(013) .
X_FDCAT-TABNAME = 'TB_VBAK'.
X_FDCAT-SCRTEXT_L = 'DOC TYPE'(014).
APPEND X_FDCAT TO TB_FDCAT.
X_FDCAT-ROW_POS = 1.
X_FDCAT-COL_POS = 6.
X_FDCAT-FIELDNAME = 'AUGRU'(015) .
X_FDCAT-TABNAME = 'TB_VBAK'.
X_FDCAT-SCRTEXT_L = 'REASON'(016).
APPEND X_FDCAT TO TB_FDCAT.
X_FDCAT-ROW_POS = 1.
X_FDCAT-COL_POS = 7.
X_FDCAT-FIELDNAME = 'NETWR'(017) .
X_FDCAT-TABNAME = 'TB_VBAK'.
X_FDCAT-SCRTEXT_L = 'NET VALUE'(018).
X_FDCAT-DO_SUM = C_X.
APPEND X_FDCAT TO TB_FDCAT.
X_FDCAT-ROW_POS = 1.
X_FDCAT-COL_POS = 8.
X_FDCAT-FIELDNAME = 'WAERK'(019) .
X_FDCAT-TABNAME = 'TB_VBAK'.
X_FDCAT-SCRTEXT_L = 'UNIT'(020).
APPEND X_FDCAT TO TB_FDCAT.
ENDFORM. " FIELDCATLOG
*& Module STATUS_0007 OUTPUT
module for setting the pf status
MODULE STATUS_0007 OUTPUT.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0007 OUTPUT
*& Module USER_COMMAND_0007 INPUT
module for handling the user commands
MODULE USER_COMMAND_0007 INPUT.
OK_CODE = SY-UCOMM.
CASE OK_CODE.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0007 INPUT
*& Form LAYOUT
ALV Layout settings
FORM LAYOUT .
CLEAR X_LAYOUT.
*-- making Layout settings
X_LAYOUT-GRID_TITLE = 'Sales Header Document'(021).
X_LAYOUT-ZEBRA = C_X.
IF P_ALVDIS = C_X.
X_LAYOUT-NO_HGRIDLN = C_X.
X_LAYOUT-NO_VGRIDLN = C_X.
ENDIF.
ENDFORM. " LAYOUT
*& Form SORTING
sub routine for sorting criteria
FORM SORTING .
CLEAR X_SORT.
X_SORT-SPOS = '1'(022).
X_SORT-FIELDNAME = 'AUART'.
X_SORT-UP = C_X.
APPEND X_SORT TO TB_SORT.
CLEAR X_SORT.
X_SORT-SPOS = '2'(023).
X_SORT-FIELDNAME = 'VBTYP'.
X_SORT-UP = C_X.
APPEND X_SORT TO TB_SORT.
CLEAR X_SORT.
X_SORT-SPOS = '3'(024).
X_SORT-FIELDNAME = 'WAERK'.
X_SORT-UP = C_X.
X_SORT-SUBTOT = C_X.
APPEND X_SORT TO TB_SORT.
ENDFORM. " SORTING
*& Form CREATE_CONTAINER_OBJECT
subroutine to create object of container
FORM CREATE_CONTAINER_OBJECT .
CREATE OBJECT CUSTOM_CONTAINER
EXPORTING
CONTAINER_NAME = 'CUST_CONTROL'(025)
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " CREATE_CONTAINER_OBJECT
*& Form CREATE_ALV_GRID_OBJECT
subroutine to create object of ALV GRID
FORM CREATE_ALV_GRID_OBJECT .
CREATE OBJECT OBJ_ALV_GRID
EXPORTING
I_PARENT = CUSTOM_CONTAINER
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " CREATE_ALV_GRID_OBJECT
*& Form ALV_GRID_DISPLAY
subroutine to call method for displaying the ALV GRID
FORM ALV_GRID_DISPLAY .
CALL METHOD OBJ_ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = X_LAYOUT
CHANGING
IT_OUTTAB = TB_VBAK
IT_FIELDCATALOG = TB_FDCAT
IT_SORT = TB_SORT
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL SCREEN 0007.
ENDFORM. " ALV_GRID_DISPLAY
START OF SELECTION
START-OF-SELECTION.
*--Creating a reference variable for the class LC_VBAK
DATA : OBJ1 TYPE REF TO LC_VBAK.
*--Creating a container object
PERFORM CREATE_CONTAINER_OBJECT.
*--Creating a ALV GRID control object
PERFORM CREATE_ALV_GRID_OBJECT.
*--Creating a object of class LC_VBAK
CREATE OBJECT OBJ1.
*--calling vbak population method
CALL METHOD OBJ1->VBAK_POPULATE.
*--calling icon population method
CALL METHOD OBJ1->ICON_POPULATE.
*--calling fianl table population method
CALL METHOD OBJ1->FINAL_POPULATE.
*--calling final method for display
CALL METHOD OBJ1->DISPLAY.
*& Form EVENT_TOP_OF_PAGE
text
-->P_E_DYNDOC_ID text
FORM EVENT_TOP_OF_PAGE USING P_E_DYNDOC_ID TYPE REF TO
CL_DD_DOCUMENT.
ENDFORM. " EVENT_TOP_OF_PAGE -
Have to set up a customer in Palestine - what country
Hi,
Have a requirement to set up a customer on SAP that lives in Palestine- what country do I assign the customer to?
Rgds
AideenHi Aideen,
It was proclaimed on November 15, 1988, in Algiers by the Palestine Liberation Organization's (PLO) Palestinian National Council (PNC) as an affirmation of the Palestinian people's right to self determination in form of an independent, sovereign state, at a time when the PLO did not exercise any control over the territory in question. The declaration designated Jerusalem the capital of Palestine
As per that Define Country( Palestine as PI ) in T-Code-OY01
And you give the same in Customer Master
Regards,
Seegal -
How to create custom control in SE51
Hi,
Can any1 help me out to create a custom control in se51.
Thanks in advance.*****Class variables*********
DATA:
GO_GRID type ref to cl_gui_alv_grid,
go_custom_container type ref to cl_gui_custom_container.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ZMENU'.
PERFORM CREATE_OBJECTS.
PERFORM DISP_DATA.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form CREATE_OBJECTS
text
--> p1 text
<-- p2 text
FORM CREATE_OBJECTS .
CREATE OBJECT GO_CUSTOM_CONTAINER
EXPORTING
CONTAINER_NAME = 'CUST_CONTROL'.
CREATE OBJECT GO_GRID
EXPORTING
I_PARENT = GO_CUSTOM_CONTAINER.
*& Form DISP_DATA
text
--> p1 text
<-- p2 text
FORM DISP_DATA .
CALL METHOD GO_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = LS_LVCLAYOUT
IS_PRINT = LS_PRINT
IT_TOOLBAR_EXCLUDING = IT_EXCLUDE
CHANGING
IT_OUTTAB = <TEMP_TAB>
IT_FIELDCATALOG = LT_LVCFIELDCAT[]
IT_SORT = LVC_TSORT[]. -
How to save Custom control records ?
Hi guru ,
1. How to save Custom control records module pool program ?
I wrote multiple lines of record in custom control
Who to save that records ?
thanking you.
Regards,
Subash.REPORT ZCUSTOMC.
CLASS event_handler DEFINITION.
PUBLIC SECTION.
METHODS: handle_f1 FOR EVENT f1 OF cl_gui_textedit
IMPORTING sender,
handle_f4 FOR EVENT f4 OF cl_gui_textedit
IMPORTING sender.
ENDCLASS.
DATA: ok_code LIKE sy-ucomm,
save_ok LIKE sy-ucomm.
DATA: init,
container TYPE REF TO cl_gui_custom_container,
editor TYPE REF TO cl_gui_textedit.
DATA: event_tab TYPE cntl_simple_events,
event TYPE cntl_simple_event.
DATA: line(256) TYPE c,
text_tab LIKE STANDARD TABLE OF line,
field LIKE line.
DATA handle TYPE REF TO event_handler.
START-OF-SELECTION.
line = 'First line in TextEditControl'.
APPEND line TO text_tab.
line = '----
APPEND line TO text_tab.
line = '...'.
APPEND line TO text_tab.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
IF init is initial.
init = 'X'.
CREATE OBJECT: container EXPORTING container_name = 'TEXTEDIT',
editor EXPORTING parent = container,
handle.
event-eventid = cl_gui_textedit=>event_f1.
event-appl_event = ' '. "system event
APPEND event TO event_tab.
event-eventid = cl_gui_textedit=>event_f4.
event-appl_event = 'X'. "application event
APPEND event TO event_tab.
CALL METHOD: editor->set_registered_events
EXPORTING events = event_tab.
SET HANDLER handle->handle_f1
handle->handle_f4 FOR editor.
ENDIF.
CALL METHOD editor->set_text_as_stream EXPORTING text = text_tab.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'INSERT'.
CALL METHOD editor->get_text_as_stream IMPORTING text = text_tab.
WHEN 'F1'.
MESSAGE i888(sabapdocu) WITH text-001.
WHEN OTHERS.
MESSAGE i888(sabapdocu) WITH text-002.
CALL METHOD cl_gui_cfw=>dispatch. "for application events
MESSAGE i888(sabapdocu) WITH text-003.
ENDCASE.
SET SCREEN 100.
ENDMODULE.
CLASS event_handler IMPLEMENTATION.
METHOD handle_f1.
DATA row TYPE i.
MESSAGE i888(sabapdocu) WITH text-004.
CALL METHOD sender->get_selection_pos
IMPORTING from_line = row.
CALL METHOD sender->get_line_text
EXPORTING line_number = row
IMPORTING text = field.
CALL METHOD cl_gui_cfw=>set_new_ok_code "raise PAI for
EXPORTING new_code = 'F1'. "system events
CALL METHOD cl_gui_cfw=>flush.
ENDMETHOD.
METHOD handle_f4.
DATA row TYPE i.
MESSAGE i888(sabapdocu) WITH text-005.
CALL METHOD sender->get_selection_pos
IMPORTING from_line = row.
CALL METHOD sender->get_line_text
EXPORTING line_number = row
IMPORTING text = field.
CALL METHOD cl_gui_cfw=>flush.
ENDMETHOD.
ENDCLASS.
aniruddh -
Scene Builder: cannot edit when I embed a custom control!
Hi guys, I'm having an issue with Scene Builder and embedded custom controls...
I have a LoginPanel .fxml/.java module, which contains two re-usable custom controls I've built:
* StatusZone .fxml/.java
* LanguageSelector .fxml/.java
The application runs.
However, I can't open LoginPanel.fxml to edit it with SceneBuilder v1.1 (developer preview).
To be specific, in LoginPanel.fxml, I have this data:
<StatusZone fx:id="statusZone" />
<LanguageSelector fx:id="languageSelector" />
SCENARIO 1
-- LoginPanel.fxml --
<?import kalungcasev2.view.StatusZone?>
<?import kalungcasev2.view.LanguageSelector?>
I get:
Warning: File 'LoginPanel.fxml' contains references to types that could not be loaded.
Missing types are [kalungcasev2.view.StatusZone]
I can click 'Set up classpath', but no matter which folder I choose, it doesn't seem to fix the problem.
SCENARIO 2:
-- LoginPanel.fxml --
<?import kalungcasev2.view.*?>
I get:
Warning: File 'LoginPanel.fxml' contains references to types that could not be loaded.
Missing types are: [StatusZone, LanguageSelector]
I can click 'Set up classpath', but no matter which folder I choose, it doesn't seem to fix the problem.
How do I fix this?Hi,
If no ClassLoader is configured in the FXMLLoader, then the FXMLLoader will try to load the
classes using the System/Context class loader.
This works well in the context of an application where everything is in the system class loader.
In SceneBuilder however - your classes will not be in the System class loader, but in a special
URL class loader that SceneBuilder created for your FXML file.
SceneBuilder sets this ClassLoader on the FXMLLoader that loads your top FXML file,
but it can't do anything for the instances of FXMLLoader that your own code creates.
Therefore - it's best to configure your FXMLLoader with the appropriate class loader,
which is usually the class loader that loaded your custom type.
See https://javafx-jira.kenai.com/browse/DTL-5177 for more details.
-- daniel
Edited by: daniel on Apr 25, 2013 7:33 AM
Sorry - to be more precise:
loader.setClassLoader(this.getClass().getClassLoader());
is the correct line. -
Unable to programmatically get content of extended properties in custom control
Hi all
I am facing some problems with a custom control which I applied to the Business Service class form. The goal of this control is to automatically populate the DisplayName property of a Business Service based on two properties which are part of a Business
Service class extension. The control is working fine and gets applied successfully to the Business Service forms.
Also populating DisplayName as well as other OOB Business Service properties works fine, but when it comes to extended properties, it seems as if the instance I am working with in the custom control is not aware of those... However when getting the class
of the given instance and searching propertyCollection, both properties are visible.
It seems so me as if the instance I am working with is just no aware of properties coming from a class extension. I never ran into that when building my own custom forms.
Any thoughts about this?
private void ServicePriceListView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
//Check if we get an IDataItem
if (this.DataContext is IDataItem)
//Get the IDataItem
inst = (IDataItem)this.DataContext;
IDataItem dataItemClass = inst["$Class$"] as IDataItem;
Dictionary<string, IDataItem> dataItemClassProperties = dataItemClass["PropertyCollection"] as Dictionary<string, IDataItem>;
// dataItemClassProperties contains both extended properties
string displayName = inst["DisplayName"].ToString(); // Works fine
string serviceID = inst["scsmlabid"].ToString(); // Does not find property scsmlabid
string serviceDescription = inst["scsmlabdescription"].ToString(); // Does not find property scsmlabdescription
//Set DisplayName
inst["DisplayName"] = inst["mchserviceid"] + " - " + inst["mchdescription"];
Blog: http://scsmlab.com Twitter:
@scsmlabThe "FormView" object is, for all intents and purposes, your parent form object. You can use FormUtilities.GetFormView() and send pretty much any control from your form as a parameter to that method. It'll send back the top-level FormView object.
(More precisely, the FormView's "Form" property is your parent form object..ie: FormView MyMainForm = FormUtilities.GetFormView(this); MyMainForm.Form;)
With that object you can subscribe to all of the typical FrameworkElement events. If you want to subscribe to the SCSM Console API events, use the FormEvents class and add a handler to MyMainForm.Form using .AddHandler() and .RemoveHandler().
Here's a little primer from Microsoft on the Console form events:
https://technet.microsoft.com/en-us/library/ff461071.aspx
Maybe you are looking for
-
1) please tell me some examples on RFC lookups? 2) difference between Business system and Logical system
-
EmailEventGenerator Document and attachment names
Hi, I am using this method call to get the email attachment names from the EmailEventGeneratorDocument this.emailEventGeneratorDocument.getEmailEventGenerator().getAttachments() The method returns a string of comma delimited file names attached with
-
Hi, Could anybody clear the following question? Which way does jsp compiler make import of packages on weblogic 6.0? I looked through JSP examples and did not find any import declaration in some of them, but there were s
-
Replacing an iphone bought in another country
HI, I have bought my iphone in singapore, while I live in India. The service centre here says that only the country that the phone has been bought in can service it. The phone is in warranty. How do I activate this service? Tried to contact a premium
-
BRCONNECT returned error status E
Below is my Developmwnt platform Windows NT Oracle 8.1.7 SAP R/3 4.6C When I am trying to run Check DB..I am getting the following error.Please help me to resolve this. Job started Ste