Array scroll bar event
Is there any way that I could get the event from array scroll bar in LabVIEW 8.5? I have an one-dimensional array and I made the vertical scroll bar visible. What I want to do is that when I drag the scroll bar to change array index value, I need to change the content of another array that will display the visible line number of the first array. Array index display only is not suitable for my application.
Jason2006 wrote:
I need to change the content of another array that will display the visible line number of the first array.
I don't quite understand what you mean by "visible line number of the first array". Arrays don't have line numbers. Do you just want to scroll it to the same element as the first array?
In this case you could do something like the following (hey, it even works for multidimensional arrays! ):
LabVIEW Champion . Do more with less code and in less time .
Attachments:
MultiScroll.vi 19 KB
Similar Messages
-
Future support for Scroll Bar Events?, Any workarounds?
I am wondering whether there is an intention to add scroll bar
events to Forms. These would be incredibly useful in a number of
situations ie
1) You have a window with two stacked canvases. One contains
items in a tabular MR block style. It has a horizontal scroll
bar. When the user scrolls this view, I want to move another
stacked canvas by the scrolled amount, to keep it in synch with
the underlying items.
2) Similar problem for block scroll bars. In a MR block, I have
a list item on a stacked canvas, that I reposition over the the
current record. This is acheived by writing a When-New-record-
Instance trigger. Unfortunately, when the user scrolls with the
scroll bar, the stacked canvas obviously doesn't move.
The only solution I have found is to use timers, which is very
messy
nullHello,
This is a well-known issue with this code, as you can see in the thread you copied the code from.
In the following post, Laura is presenting an IE only solution, based on a different code I wrote - Re: How to implement fixed column headers . Cross browser solution is yet to be found.
Regards,
Arie. -
Scroll Bar code in Awt Required Plz Help me
Hi,
My requirment is to add Vertical Scrollbar to the table.There are 12 rows in a table like from January to December.
I am able to see data of rows as jan,feb,mar,apr only .
i want to see the data of rows of next months by adding vertical scroll bar using Awt code.
I added vertical scroll bar using awt code. When i click on that Vertical scroll bar event is going to below method.
public void adjustmentValueChanged(AdjustmentEvent e) {
I tried with some logic inside above method but it is not working.what is the code i have to write inside the above method inorder to scroll the next months.
Plz Help me.
Thanks In Advance.........But i want to do this code In Using Awt only......Well, a JTable is a Swing component so I have no idea what you are talking about.
To control the size of the table you can use:
table.setPreferredScrollableViewportSize(???);
JScrollPane scrollPane = new JScrollPane( table ); -
Handling Scroll bar in SHDB recording
hi,
can any one help me in handling scroll bar events while recording a transaction which is further used in BDC.
thanks in advance,
Swamy mantha.Hi swamy,
in transaction VB01 (in the second screen) at the bottom of the tablecontrol there´s a buttom allowing to create a "
New Entry". This button has the create icon.
I think you should proceed in this way when recording in shdb.
1.- introduce in the first line the corresponding material
2.- do intro (that is okcode = /00)
3.- click on the "New Entry button"
4.- do intro
the important part in the recording is:
SAPMV13G 1001 X
BDC_CURSOR KOMGG-MATNR(02)
BDC_OKCODE =NEWP
so you can see here that using the "New Entry button"
will mean KOMGG-MATNR(02). (02) won´t change.
Hoping to have helped
Best regards -
Scroll bar on embedded blog on events page & rolls over header
I've just entered the embedded html code for the events page in the tutorial (part 4) & now have a vertical & horizantal scroll bar showing + the blog rolls over the header rather than under it. How can I fix this? I've just downloaded the latest update for Muse & think the recent changes in master positioning may have changed?
I found a fix, although I'm not sure it is the best way. In Muse CC it looks like layers have replaced the ability to arrange certain items on top of other items (the move to feature). When I added the HTML code, it comes in as it's own layer, but still seems to be within the default layer for that page. So what I did was create a new layer in the layers panel, then I dragged the HTML code layer to be inside of that layer instead. Then I made sure that my new layer was under the layer holding the header and everything else. Seems to do the trick.
-
Disable array indicator but enable scroll bar ?
Dear All,
is there a way to disable an array without disabling the ability to scroll down with the mouse (scroll bar is also disabled if you choose disable in properties). The array indicator is clickable althoug not writable but causes confusion for the user...as if you can write something.
thank you .Hi mbhatti2000,
- Could you put up a small example of what you mean?
If you just want to disable the array indicator and gray it out, then you can use the property shown below.
Regards,
Peter D
Attachments:
DisableIndicator.vi 9 KB -
Link a single scroll bar to two arrays
I am trying to link a single scroll bar to a pair of arrays (one is dbl, one boolean; both single dimension), so they line up correctly as I move the bar. Any ideas on how to get this to work? I tried a cluster, but no luck (Maybe I missed somethng?). Thanks!
Hi Templar,
use property nodes:
read shown array index (property "Index values") from 1st array and set the same indices for the 2nd array...
Message Edited by GerdW on 07-26-2007 04:03 PM
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
Adding Scroll bar InPanel Array
I want to add scroll bar in panel array .Kindly help me to sort this problem immdiatedly
Kindly help me to sort this problem immdiatedly Based on the information provided, I doubt we will be able to.
The general advice is add your panel to the scrollPane and add the scrollPane to the GUI. Its that simple.
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting. -
JTextArea w/Scroll bar wont scroll AND code drops through if statements
Hi, I'm still having trouble with the text area in the following code. When you run the code, you get the top arrow on the scroll bar, but the bottom is cut off. Also, a big problem is that no matter what choice is selected from the combo box, the code drops through to the last available value each time. Someone on the forums suggested using an array list for the values in the combo box, but I have not been able to figure out how to do that. A quick example would be apprciated.
Thank you in advance for any help
//Import required libraries
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
import java.io.*;
import java.text.*;
import java.math.*;
import java.util.*;
//Create the class
public class Week3Assignment407B extends JFrame implements ActionListener
//Panels used in container
private JPanel jPanelRateAndTermSelection;
//Variables for Menu items
private JMenuBar menuBar;
private JMenuItem exitMenuItem;
private JMenu fileMenu;
//Variables for user instruction and Entry
private JLabel jLabelPrincipal;
private JPanel jPanelEnterPrincipal;
private JLabel jLabelChooseRateAndTerm;
private JTextField jTextFieldMortgageAmt;
//Variables for combo box and buttons
private JComboBox TermAndRate;
private JButton buttonCompute;
private JButton buttonNew;
private JButton buttonClose;
//Variables display output
private JPanel jPanelPaymentOutput;
private JLabel jLabelPaymentOutput;
private JPanel jPanelErrorOutput;
private JLabel jLabelErrorOutput;
private JPanel jPanelAmoritizationSchedule;
private JTextArea jTextAreaAmoritization;
// Constructor
public Week3Assignment407B() {
super("Mortgage Application");
initComponents();
// create a method that will initialize the main frame for the GUI
private void initComponents()
setSize(700,400);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container pane = getContentPane();
GridLayout grid = new GridLayout(15, 1);
pane.setLayout(grid);
//declare all of the panels that will go inside the main frame
// Set up the menu Bar
menuBar = new JMenuBar();
fileMenu = new JMenu();
fileMenu.setText("File");
exitMenuItem = new JMenuItem();
exitMenuItem.setText("Exit");
fileMenu.add(exitMenuItem);
menuBar.add(fileMenu);
pane.add(menuBar);
//*******************TOP PANEL ENTER PRINCIPAL*****************************//
// Create a label that will advise user to enter a principle amount
jPanelEnterPrincipal = new JPanel();
jLabelPrincipal = new JLabel("Amt to borrow in whole numbers");
jTextFieldMortgageAmt = new JTextField(10);
GridLayout Principal = new GridLayout(1,2);
jPanelEnterPrincipal.setLayout(Principal);
jPanelEnterPrincipal.add(jLabelPrincipal);
jPanelEnterPrincipal.add(jTextFieldMortgageAmt);
pane.add(jPanelEnterPrincipal);
//****************MIDDLE PANEL CHOOSE INTEREST RATE AND TERM*****************//
// Create a label that will advise user to choose an Int rate and term combination
// from the combo box
jPanelRateAndTermSelection = new JPanel();
jLabelChooseRateAndTerm = new JLabel("Choose the Rate and Term");
buttonCompute = new JButton("Compute Mortgage");
buttonNew = new JButton("New Mortgage");
buttonClose = new JButton("Close");
GridLayout RateAndTerm = new GridLayout(1,5);
//FlowLayout RateAndTerm = new FlowLayout(FlowLayout.LEFT);
jPanelRateAndTermSelection.setLayout(RateAndTerm);
jPanelRateAndTermSelection.add(jLabelChooseRateAndTerm);
TermAndRate = new JComboBox();
jPanelRateAndTermSelection.add(TermAndRate);
TermAndRate.addItem("7 years at 5.35%");
TermAndRate.addItem("15 years at 5.5%");
TermAndRate.addItem("30 years at 5.75%");
jPanelRateAndTermSelection.add(buttonCompute);
jPanelRateAndTermSelection.add(buttonNew);
jPanelRateAndTermSelection.add(buttonClose);
pane.add(jPanelRateAndTermSelection);
//**************BOTTOM PANEL TEXT AREA FOR AMORITIZATION SCHEDULE***************//
jPanelAmoritizationSchedule = new JPanel();
jTextAreaAmoritization = new JTextArea(26,50);
// add scroll pane to output text area
JScrollPane scrollBar = new JScrollPane(jTextAreaAmoritization,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
jPanelAmoritizationSchedule.add(scrollBar);
pane.add(jPanelAmoritizationSchedule);
//***************ADD THE ACTION LISTENERS TO THE GUI COMPONENTS*****************//
// Add ActionListener to the buttons and menu item
exitMenuItem.addActionListener(this);
buttonCompute.addActionListener(this);
buttonNew.addActionListener(this);
buttonClose.addActionListener(this);
TermAndRate.addActionListener(this);
jTextFieldMortgageAmt.addActionListener(this);
//*************** Set up the Error output area*****************//
jPanelErrorOutput = new JPanel();
jLabelErrorOutput = new JLabel();
FlowLayout error = new FlowLayout();
jPanelErrorOutput.setLayout(error);
pane.add(jLabelErrorOutput);
setContentPane(pane);
pack();
setVisible(true);
//Display error messages
private void OutputError(String ErrorMsg){
jLabelErrorOutput.setText(ErrorMsg);
jPanelErrorOutput.setVisible(true);
//create a method that will clear all fields when the New Mortgage button is chosen
private void clearFields()
jTextAreaAmoritization.setText("");
jTextFieldMortgageAmt.setText("");
//**************CREATE THE CLASS THAT ACTUALLY DOES SOMETHING WITH THE EVENT*****//
//This is the section that receives the action source and directs what to do with it
public void actionPerformed(ActionEvent e)
Object source = e.getSource();
String ErrorMsg;
double principal;
double IntRate;
int Term;
double monthlypymt;
double TermInYears = 0 ;
if(source == buttonClose)
System.exit(0);
if (source == exitMenuItem) {
System.exit(0);
if (source == buttonNew)
clearFields();
if (source == buttonCompute)
//Make sure the user entered valid numbers
try
principal = Double.parseDouble(jTextFieldMortgageAmt.getText());
catch(NumberFormatException nfe)
ErrorMsg = (" You Entered an invalid Mortgage amount"
+ " Please try again. Please do not use commas or decimals");
jTextAreaAmoritization.setText(ErrorMsg);
principal = Double.parseDouble(jTextFieldMortgageAmt.getText());
if (TermAndRate.getSelectedItem() == "7 years at 5.35%") ;
Term = 7;
IntRate = 5.35;
if (TermAndRate.getSelectedItem() == "15 years at 5.5%") ;
Term = 15;
IntRate = 5.5;
if (TermAndRate.getSelectedItem() == "30 years at 5.75%") ;
Term = 30;
IntRate = 5.75;
//Variables have been checked for valid input, now calculate the monthly payment
NumberFormat formatter = new DecimalFormat ("$###,###.00");
double intdecimal = intdecimal = IntRate/(12 * 100);
int months = Term * 12;
double monthlypayment = principal *(intdecimal / (1- Math.pow((1 + intdecimal),-months)));
//Display the Amoritization schedule
jTextAreaAmoritization.setText(" Loan amount of " + formatter.format(principal)
+ "\n"
+ " Interest Rate is " + IntRate + "%"
+ "\n"
+ " Term in Years " + Term
+ " Monthly payment "+ formatter.format(monthlypayment)
+ "\n"
+ " Amoritization is as follows: "
+ "------------------------------------------------------------------------");
public Insets getInsets()
Insets around = new Insets(35,20,20,35);
return around;
//Main program
public static void main(String[]args) {
Week3Assignment407B frame = new Week3Assignment407B();
}here's your initComponents with a couple of changes, the problem was the Gridlayout(15,1)
also, the scrollpane needed a setPreferredSize()
private void initComponents()
setSize(700,400);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Container pane = getContentPane();
JPanel pane = new JPanel();
//GridLayout grid = new GridLayout(15, 1);
GridLayout grid = new GridLayout(2, 1);
pane.setLayout(grid);
menuBar = new JMenuBar();
fileMenu = new JMenu();
fileMenu.setText("File");
exitMenuItem = new JMenuItem();
exitMenuItem.setText("Exit");
fileMenu.add(exitMenuItem);
menuBar.add(fileMenu);
//pane.add(menuBar);
setJMenuBar(menuBar);
jPanelEnterPrincipal = new JPanel();
jLabelPrincipal = new JLabel("Amt to borrow in whole numbers");
jTextFieldMortgageAmt = new JTextField(10);
GridLayout Principal = new GridLayout(1,2);
jPanelEnterPrincipal.setLayout(Principal);
jPanelEnterPrincipal.add(jLabelPrincipal);
jPanelEnterPrincipal.add(jTextFieldMortgageAmt);
pane.add(jPanelEnterPrincipal);
jPanelRateAndTermSelection = new JPanel();
jLabelChooseRateAndTerm = new JLabel("Choose the Rate and Term");
buttonCompute = new JButton("Compute Mortgage");
buttonNew = new JButton("New Mortgage");
buttonClose = new JButton("Close");
GridLayout RateAndTerm = new GridLayout(1,5);
jPanelRateAndTermSelection.setLayout(RateAndTerm);
jPanelRateAndTermSelection.add(jLabelChooseRateAndTerm);
TermAndRate = new JComboBox();
jPanelRateAndTermSelection.add(TermAndRate);
TermAndRate.addItem("7 years at 5.35%");
TermAndRate.addItem("15 years at 5.5%");
TermAndRate.addItem("30 years at 5.75%");
jPanelRateAndTermSelection.add(buttonCompute);
jPanelRateAndTermSelection.add(buttonNew);
jPanelRateAndTermSelection.add(buttonClose);
pane.add(jPanelRateAndTermSelection);
jPanelAmoritizationSchedule = new JPanel();
jTextAreaAmoritization = new JTextArea(26,50);
JScrollPane scrollBar = new JScrollPane(jTextAreaAmoritization,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
scrollBar.setPreferredSize(new Dimension(500,100));//<------------------------
jPanelAmoritizationSchedule.add(scrollBar);
getContentPane().add(pane,BorderLayout.NORTH);
getContentPane().add(jPanelAmoritizationSchedule,BorderLayout.CENTER);
exitMenuItem.addActionListener(this);
buttonCompute.addActionListener(this);
buttonNew.addActionListener(this);
buttonClose.addActionListener(this);
TermAndRate.addActionListener(this);
jTextFieldMortgageAmt.addActionListener(this);
jPanelErrorOutput = new JPanel();
jLabelErrorOutput = new JLabel();
FlowLayout error = new FlowLayout();
jPanelErrorOutput.setLayout(error);
//pane.add(jLabelErrorOutput);not worrying about this one
//setContentPane(pane);
pack();
setVisible(true);
}instead of
if (TermAndRate.getSelectedItem() == "7 years at 5.35%") ;
Term = 7;
IntRate = 5.35;
you would be better off setting up arrays
int[] term = {7,15,30};
double[] rate = {5.35,5.50,5.75};
then using getSelectedIndex()
int loan = TermAndRate.getSelectedIndex()
Term = term[loan];
IntRate = rate[loan]; -
Hi
I want to set scroll bar in my report ..my column names should be fixed header...I surely need vertical scroll bar than horizontal scroll bar...I used the following javascript code to display scroll bar.
<script language="JavaScript" type="text/javascript">
<!-- Hide
//Function Builds Static Header and Scrollable Div called with document onload
function MakeStaticHeader(xDataGridName,xScrollHeight){
//Grab the Table object
var theTable = document.getElementById(xDataGridName);
//Create a holder div so div header can be added correctly before table
var myHolderDiv = document.createElement("div");
myHolderDiv.setAttribute('id','tableHolder_'+ xDataGridName)
//Create the Header Div, setting id and adding to Holder
var myHeaderDiv = document.createElement("div");
myHeaderDiv.setAttribute('id','divHeader_' + xDataGridName)
myHolderDiv.appendChild(myHeaderDiv);
//Insert the Holder and Header divs
theTable.parentNode.insertBefore(myHolderDiv,theTable);
//Append the Child
myHolderDiv.appendChild(theTable)
//More messy code with IE
if(document.all){
theName = "hold2_" + xDataGridName;
else{
theName = xDataGridName;
//Create Body Div for scrollable body (IE creates a holder, mozilla creates the scroller)
var theBodyDiv = document.createElement("div");
theBodyDiv.setAttribute('id','divBody_' + theName);
theBodyDiv.setAttribute('style','OVERFLOW-Y: scroll; OVERFLOW-X: auto; OVERFLOW: auto; HEIGHT: ' + xScrollHeight + ';')
theTable.parentNode.insertBefore(theBodyDiv,theTable);
theBodyDiv.appendChild(theTable);
//Since IE can not apply the style to the new Child above, we need to make it messy! (IE is making this hard!)
//Converts the holder to a scroller
if(document.all){
var theMessDiv = document.getElementById('divBody_' + theName);
startDiv1 = '<div id="divBody_'+ xDataGridName +'" style="OVERFLOW-Y: scroll; OVERFLOW-X: auto; OVERFLOW: auto; HEIGHT: '+ xScrollHeight +';">';
endDiv1 = '</div>';
theMessDiv.innerHTML = startDiv1 + theMessDiv.innerHTML + endDiv1;
//The following Code Builds the header
theTable = document.getElementById(xDataGridName); // Arie
//Grab border widths (have to check for different ways to define it!)
var borderWidth = parseInt(theTable.style.borderwidth);
if(!borderWidth){
borderWidth = parseInt(theTable.border); }
if(!borderWidth){
borderWidth = parseInt(0); }
//Grab the table Headers (if exsists)
var theThs = theTable.getElementsByTagName("th");
var hasThs = parseInt(theThs.length);
var hasHeadCells = false;
//See if the Table Headers exist
if(hasThs>0){
hasHeadCells = true;
//Grab the table rows
var theTrs = theTable.getElementsByTagName("tr");
//Find the number of columns
var theTrsTds = theTrs[1].getElementsByTagName("td");
var numberOfColumns = parseInt(theTrsTds.length);
//Grab all of the table cells
var theTds = theTable.getElementsByTagName("td");
//Determine the widths of the columns of the table
var totalWidth = 0;
var theWidths = new Array();
for(i=0;i<numberOfColumns;i++){
if(hasHeadCells){
theWidths[i] = theThs.offsetWidth;
else{
theWidths[i] = theTds[i].offsetWidth;
theTds[i+numberOfColumns].style.width = theWidths[i];
totalWidth += parseInt(theWidths[i]);
//Set the width of the div so the scroll bar is on the edge of the table
document.getElementById("divBody_" + xDataGridName).style.width = document.getElementById("divBody_" + theName).offsetWidth;
//Grab the content for the headers
theHeaderCode = theTrs[0].innerHTML;
//This is for IE only since it does not support getComputedStyle which is alot easier!
var theStyle = "";
if(document.getElementById("divBody_" + xDataGridName).currentStyle){
//Grab the innerHTML and locate the style
theX = document.getElementById("divBody_" + xDataGridName).innerHTML;
theX = theX.split("style");
//Verify that there is a style tag in the table tag
if(theX[0].indexOf(xDataGridName) >= 0 && theX[1].indexOf("<TBODY>") >=0){
//split aprt to get the style
theQ = theX[1].split('"');
//set the style string
theStyle= "style='" + theQ[1] + "'";
//Create the table code and set it on the document
tbCode = "<table id='theAddon_"+ xDataGridName +"' "+ theStyle +">" + theHeaderCode + "</table>";
document.getElementById("divHeader_" + xDataGridName).innerHTML = tbCode;
//Apply the CSS Class and the Widths to the header Elements
if(hasThs > 0){lookFor = "th";}
else{lookFor = "td";}
theNewTD = document.getElementById("divHeader_" + xDataGridName).getElementsByTagName(lookFor);
for(i=0;i<theNewTD.length;i++){
theNewTD[i].style.width = theWidths[i];
/* Arie Workaround - English version*/
//theNewTD[i].style.borderStyle = "solid none solid solid";
//theNewTD[i].style.borderWidth = "1px";
//Apply CSS to the static table
theOrgTable = document.getElementById(xDataGridName);
theNewTable = document.getElementById("theAddon_" + xDataGridName);
for(x=0;x<theOrgTable.attributes.length;x++){
if(theOrgTable.attributes[x].nodeValue && theOrgTable.attributes[x].nodeName.toLowerCase() != "id"){
theNewTable.setAttribute(theOrgTable.attributes[x].nodeName,theOrgTable.attributes[x].nodeValue);
// Calculate the scrollbar width and streach the last header cell
var scrollbarWidth = document.getElementById("divHeader_" + xDataGridName).offsetWidth - document.getElementById("theAddon_" + xDataGridName).offsetWidth
var lastHeaderCell = theNewTD.length - 1;
theNewTD[lastHeaderCell].style.width = theWidths[lastHeaderCell] + scrollbarWidth;
theNewTD[lastHeaderCell].style.borderStyleLeft = "solid";
theNewTD[lastHeaderCell].style.borderWidthLeft = "1px";
//Hide the orginal header row
theTrs[0].style.display = "none";
//Make mozilla browsers see the applied styles
makeSame(theOrgTable,theNewTable)
//Function to make Mozilla have the same inline styles
function makeSame(elem_1, elem_2){
if (window.getComputedStyle){
elem_1x=window.getComputedStyle(elem_1, "");
elem_2x=window.getComputedStyle(elem_2, "");
elem_2x = elem_1x;
// End Hide -->
</script>
I called the script code in onload event like
onload="MakeStaticHeader('table_grab',50)"
but my problem is that it is not displaying the data in proper format(not displaying data under correct columns)...i got this problem only when I have more columns(horizontally large)..I am not finding any problem if i have less columns with much data(vertically large)....
I gave a sample report in the following link...
http://apex.oracle.com/pls/otn/f?p=9608:1:409755984054854:::::
Can anyone say how to set vertical scroll bar with fixed column headers in neat format even the number of columns are more...?
FazilaHello,
This is a well-known issue with this code, as you can see in the thread you copied the code from.
In the following post, Laura is presenting an IE only solution, based on a different code I wrote - Re: How to implement fixed column headers . Cross browser solution is yet to be found.
Regards,
Arie. -
I do not understand Scroll Bars!!
OK, here is my code:
JList List = new JList(Definitions);
JScrollPane scrollableList = new JScrollPane(List); If it is any help, definitions is a string array.
So, now that I have that, and please read this whole question, which do I add to the pane? List or scrollableList? Also even if i do add both of them to my pane, I don't see either of them having a scroll bar! If scrollableList is now my Listbox, how do I add event listeners to it? the regular JList listeners do not work. I want the user to be able to scroll down, view all of the strings in the listbox, and I want to be able to write an event handler for every time they select a new index. Can anyone please help me?
thanks, lateralusBefore doing anything I'd go here:
http://java.sun.com/docs/books/tutorial/uiswing/components/list.html#scrollingapi
Check out what the programmer did on "how to display the list."
Then see what methods they called for the actual JScrollPane
And, you DO add the JScrollPane object to the panel. -
How do i control 2 text boxes with 1 scroll bar? (CS4)
I want to control 2 Dynamic Text boxs with the 1 scroll bar component? I want them to scroll simultaneously with the user only needing to use the one component. Thank you in advance for your help
The textfields should have the same number of lines. You can have the scrollbar (sb) assigned to one textfield (t1) and then have an event listener/handler for the scrollbar adjust the other textfield's (t2) scrollV property to match the first one's scrollV property:
import fl.events.ScrollEvent;
sb.addEventListener(ScrollEvent.SCROLL, adjustTs);
function adjustTs(evt:ScrollEvent):void {
t2.scrollV = t1.scrollV; -
Hi Ppl,
I am using REUSE_ALV_COMMENTARY_WRITE to display top of page in ALV. The issue is i want to restrict the top-of-page height.
As of now if i have 10 lines to print...the top-of-page comes with 10 lines in display.
But i want some (say 4 or 5) to be visible with scroolbar and rest can be viewed by use of the scroll--bar movement!!
Any soln?? Please reply
Regards,
Santosh!!Hi Santosh,
I am not sure if that is possible by using FM approach. - REUSE_ALV_COMMENTARY_WRITE
But yes its possible if you are using Docking Container. with split container approach. ie. OOPs .
Refer sample code.
Constants Declaration
CONSTANTS: c_x TYPE c VALUE 'X',
c_mode TYPE char1 VALUE 'O',
c_mask TYPE char9 VALUE ',*.*,*.*.',
c_error_log TYPE tabname VALUE 'ZERROR_LOG',
c_succ TYPE iconname VALUE '@01@', "#EC *
c_fail TYPE iconname VALUE '@02@',
c_object TYPE emg_object VALUE 'PARTNER'," Legacy obj
c_opbuk TYPE opbuk_kk VALUE 'UK01',
c_split TYPE c
VALUE cl_abap_char_utilities=>horizontal_tab,
c_path TYPE char100
VALUE '/local/data/interface/A28/DM/OUT'.
*Variables Declaration
DATA: flg_pre TYPE c, " Flag - Presentation browse
flg_x TYPE c,
cnt_total TYPE char8, " Total Records processed
cnt_success TYPE char8, " Total Records success
cnt_failed TYPE char8, " Total Records failed
cnt_repeat TYPE char8.
*-- ALV Grid data declaration
CLASS v_lcl_event_receiver DEFINITION
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_print_top_of_page FOR EVENT print_top_of_page OF
cl_gui_alv_grid,
handle_top_of_page FOR EVENT top_of_page OF
cl_gui_alv_grid.
ENDCLASS. "o_lcl_event_receiver DEFINITION
ALV Data declaration
DATA : o_alvgrid TYPE REF TO cl_gui_alv_grid,
o_split TYPE REF TO cl_gui_easy_splitter_container,
o_dockingcontainer TYPE REF TO cl_gui_docking_container,
<b> o_container_top TYPE REF TO cl_gui_container,
o_container_bot TYPE REF TO cl_gui_container,
o_html TYPE REF TO cl_dd_document,</b> o_event_receiver TYPE REF TO lcl_event_receiver,
ok_code LIKE sy-ucomm,
i_fieldcat TYPE lvc_t_fcat,
wa_fieldcat TYPE lvc_s_fcat,
wa_layout TYPE lvc_s_layo.
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
*-- Top of Page
METHOD handle_print_top_of_page.
ENDMETHOD. "handle_print_top_of_page
METHOD handle_top_of_page.
ENDMETHOD. "handle_top_of_page
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
*-- ALV List data declaration
DATA: i_field_cat1 TYPE slis_t_fieldcat_alv,
w_lay_out1 TYPE slis_layout_alv,
w_field_cat TYPE slis_fieldcat_alv,
i_events1 TYPE slis_t_event,
w_event TYPE slis_alv_event,
w_print TYPE slis_print_alv.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STANDARD'.
SET TITLEBAR 'TITLE'.
*-- Create Instances
PERFORM f0040_create_object.
*-- Create Field catalog
PERFORM f0050_field_catalog
TABLES i_fieldcat
USING c_error_log.
*-- Modify Field Catalog
PERFORM f0060_modify_fldcatalog
TABLES i_fieldcat.
*-- Set ALV Layout
PERFORM f0070_layout.
*-- Generate ALV Grid
PERFORM f0080_display_list
TABLES i_error
i_fieldcat
USING wa_layout.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form f0040_create_object
FORM f0040_create_object .
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
*-- Create Container
CREATE OBJECT o_dockingcontainer
EXPORTING
ratio = '95'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc NE 0.
MESSAGE i000 WITH text-013. " Error in object creation
LEAVE LIST-PROCESSING.
ENDIF.
*--Create Splitter Container
CREATE OBJECT o_split
EXPORTING
parent = o_dockingcontainer
sash_position = 20
with_border = 0
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
*--Get the containers of the splitter control
o_container_top = o_split->top_left_container.
o_container_bot = o_split->bottom_right_container.
ENDIF.
CREATE OBJECT o_alvgrid
EXPORTING
i_parent = o_container_bot.
*-- Print Top of Page
PERFORM f0041_top_of_page.
ENDFORM. " f0040_create_object
<b>&----
*& Form f0041_top_of_page</b>
FORM f0041_top_of_page .
DATA: lws_text TYPE sdydo_text_element.
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
*-- Object for HTML top container
CREATE OBJECT o_html
EXPORTING style = 'ALV_GRID'
background_color = 35.
*-- Top of Page
CALL METHOD o_alvgrid->list_processing_events
EXPORTING
i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = o_html.
*-- Total Record Text
CALL METHOD o_html->add_text
EXPORTING
text = text-014
sap_emphasis = text-017.
CALL METHOD o_html->add_gap
EXPORTING
width = 8.
**-- Total record Value
lws_text = cnt_total.
CALL METHOD o_html->add_text
EXPORTING
text = lws_text
sap_emphasis = text-017.
CLEAR lws_text.
CALL METHOD o_html->new_line
EXPORTING
repeat = 1.
**-- Total Success text
CALL METHOD o_html->add_text
EXPORTING
text = text-015
sap_emphasis = text-017
fix_lines = c_x.
CALL METHOD o_html->add_gap
EXPORTING
width = 12.
lws_text = cnt_success.
CALL METHOD o_html->add_text
EXPORTING
text = lws_text
sap_emphasis = text-017
fix_lines = c_x.
CLEAR lws_text.
CALL METHOD o_html->new_line
EXPORTING
repeat = 1.
*-- Total Failed text
CALL METHOD o_html->add_text
EXPORTING
text = text-016
sap_emphasis = text-017
fix_lines = c_x.
CALL METHOD o_html->add_gap
EXPORTING
width = 16.
lws_text = cnt_failed.
CALL METHOD o_html->add_text
EXPORTING
text = lws_text
sap_emphasis = text-017
fix_lines = c_x.
CLEAR lws_text.
*-- Display Report Header
<b> CALL METHOD o_html->display_document
EXPORTING
parent = o_container_top.</b>
ENDIF.
ENDFORM. " f0041_top_of_page
*& Form f0050_field_catalog
FORM f0050_field_catalog TABLES p_fieldcat STRUCTURE lvc_s_fcat
USING value(p_structure).
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_structure
CHANGING
ct_fieldcat = p_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE i000(zo_spa) WITH text-017.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " f0050_field_catalog
*& Form f0070_layout
FORM f0070_layout .
wa_layout-zebra = c_x.
wa_layout-cwidth_opt = c_x.
ENDFORM. " f0070_layout
*& Form f0080_display_list
FORM f0080_display_list TABLES p_output
p_fieldcat
USING value(p_layout).
*-- Display Report
CALL METHOD o_alvgrid->set_table_for_first_display
EXPORTING
i_save = 'A'
is_layout = p_layout
CHANGING
it_outtab = p_output[]
it_fieldcatalog = p_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i000(zo_spa) WITH text-022. " Error in Displaying
LEAVE LIST-PROCESSING.
ENDIF.
**-- Create Event object
CREATE OBJECT o_event_receiver.
SET HANDLER o_event_receiver->handle_print_top_of_page
FOR o_alvgrid.
ENDFORM. " f0080_display_list
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
ok_code = sy-ucomm.
CASE ok_code.
WHEN 'EXIT' OR 'CANC'.
PERFORM f4000_free_objects:
USING o_alvgrid 'ALV' text-031,
USING o_dockingcontainer 'DOCKING' text-032.
LEAVE PROGRAM.
WHEN 'BACK'.
PERFORM f4000_free_objects:
USING o_alvgrid 'ALV' text-031,
USING o_dockingcontainer 'DOCKING' text-032.
SET SCREEN '0'.
LEAVE SCREEN.
WHEN OTHERS.
PERFORM f4000_free_objects:
USING o_alvgrid 'ALV' text-031,
USING o_dockingcontainer 'DOCKING' text-032.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form f4000_free_objects
FORM f4000_free_objects USING pobject
value(ptype)
value(ptext) TYPE c.
DATA: lo_objectalv TYPE REF TO cl_gui_alv_grid.
CASE ptype.
WHEN 'ALV'.
lo_objectalv = pobject.
IF NOT ( lo_objectalv IS INITIAL ).
CALL METHOD lo_objectalv->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
CLEAR: pobject, lo_objectalv.
PERFORM f4010_error_handle USING ptext.
ENDIF.
WHEN 'DOCKING'.
DATA: lo_objectdock TYPE REF TO cl_gui_docking_container.
lo_objectdock = pobject.
IF NOT ( lo_objectdock IS INITIAL ).
CALL METHOD lo_objectdock->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
CLEAR: pobject, lo_objectdock.
PERFORM f4010_error_handle USING ptext.
ENDIF.
WHEN OTHERS.
sy-subrc = 1.
PERFORM f4010_error_handle
USING text-031.
ENDCASE.
ENDFORM. " f4000_free_objects
*& Form f4010_error_handle
FORM f4010_error_handle USING value(ptext) TYPE c.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = text-031
txt2 = sy-subrc
txt1 = ptext.
ENDIF.
ENDFORM. " f4010_error_handle
Reward points if this Helps.
Manish -
Just exploring flash as a beginner, still.
I've come across this website:
http://www.jeremiahshoaf.com/
I'm a fan of the scrolling portfolio idea the designer has used in the centre of the website's front page.
Any ideas how this is produced?
My presumption would be a MovieClip with images various other MovieClips inside (holding images etc) and then a scrollbar controlling how far across the screen the images are shown with actionscript?
Knowing me I'm wrong, but any ideas would help me out to explore and learn further.
Thanks for your great advice, as always.
.. Also, I wondered if this could be produced, and as well as the scrollbar, the ability to add scrolling with the keyboard, left and right keys? Again, only a presumption, but I was thinking this might be simple with actionscript? Simply a piece of code to tell the scrollbar to move to the next MovieClip, if my initial presumption was correct.
The above is only a small side note for those who feel they can assist - but thanks again for any help you can provide!
This forum has been a huge help to me, in learning Flash so far.
Thanks a lot.Well first you need a really long MovieClip with some graphics inside on it. That should be simple enough to do. Then you need a scrollbar. Just a rectangle should do for now. On this MovieClip give it a MOUSE_DOWN event listener and on that event use the "startDrag" function to add dragging functionality. Add a MOUSE_UP event listener to the stage and when that happens call "stopDrag" on the scroll bar clip. Then you can have an ENTER_FRAME event that actually updates the scrolling. On this event, check the scrollbar's x position and do some math to figure out the percentage you have scrolled. It might look like this:
var percent:Number = scrollbar.x / (stage.width - scrollbar.width);
Then update the main image container by the percent:
var minPosition:Number = -500;
bigImage.x = percent * minPosition;
Hopefully that should be enough info to get you started. -
Issue with Multithreading and vertical scroll bar - help needed to debug!!!
I have been working on a desktop Visual Studio 2010 application for quite a few years. It is written in C++ and MFC. This code is a combination of code I have written and code I inherited. It worked great for years on Windows XP, but when I ported
it to Windows 7, a tricky problem has come up that I am having the darnest time trying to figure out
In summary, it is a single .exe desktop application. There is the main thread (thread A), which launches another thread (thread B). Both threads share a pointer to a single window object which displays events. This window also implements a vertical and horizontal
scroll bar.
The interaction and message processing between the threads seems a little sticky to me. Both threads A and B call the same member function of the CWnd object. BUT, Thread B ALSO posts messages to thread A's queue.
So, in thread B, you will see code like this, which makes a direct call to the output window object, AND THEN it also posts a message to Thread A's mainframe window like this...
if( m_pEventLog )
pOutputWindow->AddLine("Some test...");
if( m_phNotifyWnd[RECEIVE] && m_puiEventWMsg[RECEIVE] ) {
::PostMessage( m_phNotifyWnd[RECEIVE], m_puiEventWMsg[RECEIVE], 0, (LPARAM) pPkt );
WHEN thread A receives the message that thread B posted above, it only does the following:
LRESULT CMainFrame::OnSocketReceive( WPARAM, LPARAM lParam )
CSPkt* pPkt;
CRWPkt* pRWPkt;
CSPktSocket* pSocket;
ULONG ulType;
CString csTemp;
CBSWords bsWords;
CSSSWords sssWords;
CRWPkt* pLoopBackRWMsg; // used if we have to send a loopback msg back to sender
CLMsg lmsg;
m_wndTextWindow.AddLine("Test message");
return 0;
So both threads are writing to the output window via the .AddLine() member function.
void COutputWnd::AddLine( CString& strLine, COLORREF crColor )
UpdateVScroll();
return;
And this function then makes a call to :UpdateVScroll(). The problem seems to arise because thread B does a
post to thread A, where thread A in turn writes to the output window. Eventually, the program
HANGS in the call to
SetScrollInfo() below...
void COutputWnd::UpdateVScroll()
CSingleLock lock( &m_CSVertScrollLock ); // lock things up while we are in here
BOOL bok = lock.Lock();
if (lock.IsLocked() == TRUE)
int iMax = m_FifoIndices.GetHighestIndex();
if( iMax < ( m_iMaxViewableLines - 1 ) )
iMax = 0;
//SetScrollRange( SB_VERT, 0, iMax, FALSE );
//SetScrollRange( SB_VERT, 0, 9, FALSE );
SCROLLINFO scrollinfo;
scrollinfo.cbSize = sizeof(SCROLLINFO);
scrollinfo.fMask = SIF_RANGE;
scrollinfo.nMin=0;
scrollinfo.nMax= iMax;
SetScrollInfo(SB_VERT, &scrollinfo, FALSE);
lock.Unlock();
It doesn't take long for the program to hang...maybe about 10 seconds.
When I hit DEBUG->BREAK ALL, I get the output below in the CALL STACK WINDOW.
ntdll.dll!770070f4()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
user32.dll!76c0cde0()
user32.dll!76c018d9()
>
mfc100d.dll!AfxInternalPumpMessage() Line 153 + 0x13 bytes
C++
mfc100d.dll!CWinThread::PumpMessage() Line 900
C++
mfc100d.dll!CWinThread::Run() Line 629 + 0xd bytes
C++
mfc100d.dll!_AfxThreadEntry(void * pParam=0x0022f6a4) Line 122 + 0x13 bytes
C++
msvcr100d.dll!_callthreadstartex() Line 314 + 0xf bytes
C
msvcr100d.dll!_threadstartex(void * ptd=0x004f97c0) Line 297
C
kernel32.dll!762cee1c()
ntdll.dll!770237eb()
ntdll.dll!770237be()
NOTE: If I never make the call to SetScrollInfo(), the program never HANGS.
Sooo....I am trying to determine if there is a fundamental issue with the way the threads are communicating that is causing the issue, or if maybe I have a memory overwrite. It always hangs in ::SetScrollInfo(), no matter what I comment and uncomment. This
makes me think that scroll bat behavior is different in Windows 7 than on XP, but I have not been able to find any documentation about it.
Can anyone provide any insight as to what may be the cause of the program hanging>It might look like working but it will crash eventually. The windows are thread affine and other thread must never touch other threads windows. Sometimes you might get along but usually it just crashes.
Thread B must use PostMessage ( or SendMessage if suncronous action is require) to thread A's windows to achieve correct updating. Some very basic calls are implemented directly with SendMessage so they are safe to use but then you must individually check
which ones are safe.
Also having multiple SendMessage calls from B to A require rendezvous which might cause other problems ( thread B stalls or program deadlocks, depending on other program structure).
So PostMessage is the way to do it ( or create yourself another inter-thread mechanism, possible but usually too much troble)
Maybe you are looking for
-
I am using Windows XP SP2 Professional. Firefox is my default browser. I currently have version 17.0.1 on auto update. Java is enable and the version is SE 7 U9 10.9.2.5. However, whenever I go to check my plugins I am told that I intend my Java 7 U9
-
AS Above. Edited in FCPX. Excellent sound file. Using Compressor 4 to DVD Studio 4. Wanting AIFF or WAVE sound for acurate sound. Previously DVD Studio 4 has accepted AIFF etc and delivered sound as reuired. Now, during the burn process everything ot
-
Background info: I have music on my iphone that i would like to change / delete / update manually. Software versions of both itunes and iphone are up to date. So, in chronological order: When i connect my iphone to my PC, itunes detects it. Fine. No
-
Trying to update LR, get a prompt for serial number
I'm already a CC subscriber and when I updated LR to 5.3, I get a "serial number or try it" prompt. Did I go about the update the wrong way? I should just get all updates automatically, right?
-
i have an iphon 4s and i want to delete apps on my i cloud so as if they do not apear in not on this phone in the app store?