In my database I have a column where default_column_value = 1.
I currently have a button that displays the text "Pay Enabled". When clicked, this button toggles the column value between 1 and 0. When the column value is at 1 the button should display "Pay Enabled" When it is at 0 it should display "Pay Disabled". What is the best way to achieve this?
Below is the window where I have programmatically added the button.
btn_add("Pay Enabled", true)
btn_add()
ii_blank_btns += 1
blank_btns[ii_blank_btns].object.t_text.y = 50
blank_btns[ii_blank_btns].object.t_text.text = as_name
blank_btns[ii_blank_btns].object.c_color.expression = '0'
blank_btns[ii_blank_btns].GroupCalc()
blank_btns[ii_blank_btns].visible = true
Properties Image
Use a datawindow button, that is a button defined in the datawindow.
In the properties of that button, click on the 'Expression' icon of the text and put something like if(col_value = 1, 'Payment Enabled', 'Payment Disabled').
See hereunder the 'Expression' button is on the right of the text 'none' and contains the expression above.
Related
I have a button on a module pool screen. I need to change the icon, tooltip and text dynamically based on logic/a condition. I can successfully change the icon and text but am unable to change all three things (icon, text and tooltip) together.
Sample PBO code:
Data but(30) type c." here but is the name of button in screen.
write 'icon xxx' as ICON to but.
Concatenate but 'click here' into but separated by space.
It does not set the value of the tooltip, which should show "Please Click here to proceed". How can I do this?
Use ICON_CREATE FM instead.
Here is the sample how to change all three attributes on-the-fly:
PARAMETERS: p_icon TYPE icon_d MATCHCODE OBJECT h_icon,
p_text TYPE string,
p_toolt TYPE string.
SELECTION-SCREEN BEGIN OF SCREEN 500.
SELECTION-SCREEN PUSHBUTTON 49(30) but USER-COMMAND ret.
SELECTION-SCREEN END OF SCREEN 500.
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN 'ONLI'.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = p_icon
text = p_text
info = p_toolt
add_stdinf = 'X'
IMPORTING
result = but.
CALL SELECTION-SCREEN 500.
WHEN 'RET'.
LEAVE TO SCREEN 0.
WHEN OTHERS.
ENDCASE.
I have a radio button list set up for sorting with 2 possible choices. when the page loads i need to have one of those selected, however it has to be through code rather than manual section in the design screen.
For the first item selected:
myRbl.Items(0).Selected = True
Or the second:
myRbl.Items(1).Selected = True
Simply set their Checked flags to true/false.
rbFirstOne.Checked = True
rbSecondOne.Checked = False
Edit: Oh, radio button list, not just button. Sorry.
I have a rad grid dynamically created. I have a status column in database. When binding the value to the grid, I want to show a de-activate button when status is 0 and activate button when status is 1. Upon clicking the button, the status should change from active to inactive and vice versa? What should be the column type and how to write an event for the button click?
I have accomplished the same task as shown below :
GridButtonColumn btncol = new GridButtonColumn();
btncol.ButtonType = GridButtonColumnType.LinkButton; // setting ButtonType as LinkButton
btncol.DataTextField = "Active"; // setting DataTextField to first column in DataTable
this.RadGrid1.MasterTableView.Columns.Add(btncol);
Better example is given in following link :
http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html
I dynamically create buttons on a form and use the button text as ids so that I can pass that to an SQL query to pull saved data about that button when necessary, but I also use an image over buttons that have information saved about them. What I need to know is how do I keep the text on the button from appearing when there is an image assigned to that button? By default vb.net shows both the text and the image and no TextImageRelation values allow for the image to take precedence. I tried changing the text color to transparent, but the outline of the text is still visible through the image. Is there anyway to keep the text value as it is but just show the image on the button?
Don't use the .Text property of the button to store your information. Use the .Tag property for your IDs. Just set the .Text property to "" (empty string), that way it won't interfere with your image.
not sure, but why not just set the value to a variable to be passed to the SQL on the button click event and not place the text on the button? If you are using the same button click event for several buttons you could check the sender's ID and then set the variable based on that.
To Enable "Button1" Click (Visible)
Button1.Enable = True
To Disable "Button1" Click (Visible)
Button1.Enable = False
Hide "Button"
Button1.Visible = True
or
Button1.Show()
Show "Button"
Button1.Visible = False
or
Button1.Hide()
You can Also Used the code to any Tools (TextBox, Label, ComboBox, Radio Button, Button, Link, GroupBox)
I am working in a vb.net application.I've placed a button within the DatagridView control .Button caption is not displaying in DatagridView.Following properties are set to the button
Text as Browse
UseColumnTextForButtonValue as True
i got the answer .Set the Null value of the button same as the Text property of the button
just change the grid view button column "useColumntextforbutton" property to true it will show Your Text on Button