Sorting problem with simple dataset
I'm new to spry, but even so I have to think I'm just missing
something stupid here. The script is below ... basically just added
an onclick to each of the column headers in a table that sorts by
that column. Whenever I actually run it though, it always sorts by
the first column, Rank. What am I doing wrong?
<div spry:region="reportData">
<table border=1 cellspacing=2 cellpadding=2>
<tr>
<th
onClick="javascript:reportData.sort('Rank','toggle');">Rank</th>
<th
onClick="javascript:reportData.sort('Player','toggle');">Player</th>
<th
onClick="javascript:reportData.sort('Team','toggle');">Team</th>
<th
onClick="javascript:reportData.sort('Bye','toggle');">Bye</th>
<th
onClick="javascript:reportData.sort('Games','toggle');">Games</th>
<th
onClick="javascript:reportData.sort('Average','toggle');">Average</th>
<tbody spry:repeatchildren="reportData">
<tr>
<td>{@Rank}</td>
<td><a
href="javascript:makeWin('rosters.pl?PlayerId={@PlayerId}', 400,
600 );">{@Player}</a></td>
<td>{@Team}</td>
<td>{@Bye}</td>
<td>{@Games}</td>
<td>{@Average}</td>
</tr>
</tbody>
</table>
</div>
The first arg to the sort method is the name of the column to
use. I see from your data refs that your column names actually
begin with @ characters, so you have to make sure you pass the same
thing to the sort method:
<th
onClick="javascript:reportData.sort('@Rank','toggle');">Rank</th>
<th
onClick="javascript:reportData.sort('@Player','toggle');">Player</th>
<th
onClick="javascript:reportData.sort('@Team','toggle');">Team</th>
<th
onClick="javascript:reportData.sort('@Bye','toggle');">Bye</th>
<th
onClick="javascript:reportData.sort('@Games','toggle');">Games</th>
<th
onClick="javascript:reportData.sort('@Average','toggle');">Average</th>
--== Kin ==--
Similar Messages
-
Hi everyone. I've got a problem with ABAP charts. I need to place a simple chart in screen's container.
REPORT ZWOP_TEST4 .
Contain the constants for the graph type
TYPE-POOLS: GFW.
DATA: VALUES TYPE TABLE OF GPRVAL WITH HEADER LINE.
DATA: COLUMN_TEXTS TYPE TABLE OF GPRTXT WITH HEADER LINE.
DATA: ok_code LIKE sy-ucomm.
DATA: my_container TYPE REF TO cl_gui_custom_container.
REFRESH VALUES.
REFRESH COLUMN_TEXTS.
VALUES-ROWTXT = 'Salary'.
VALUES-VAL1 = 50000.
VALUES-VAL2 = 51000.
APPEND VALUES.
VALUES-ROWTXT = 'Life cost'.
VALUES-VAL1 = 49000.
VALUES-VAL2 = 51200.
APPEND VALUES.
COLUMN_TEXTS-COLTXT = '2003'.
APPEND COLUMN_TEXTS.
COLUMN_TEXTS-COLTXT = '2004'.
APPEND COLUMN_TEXTS.
Call a chart into a standard container, this function could be used
for many different graphic types depending on the presentation_type
field :
gfw_prestype_lines
gfw_prestype_area
gfw_prestype_horizontal_bars
gfw_prestype_pie_chart
gfw_prestype_vertical_bars
gfw_prestype_time_axis
CALL SCREEN '1000'.
CALL FUNCTION 'GFW_PRES_SHOW'
EXPORTING
CONTAINER = 'CONTAINER' "A screen with an empty
container must be defined
PRESENTATION_TYPE = GFW_PRESTYPE_LINES
TABLES
VALUES = VALUES
COLUMN_TEXTS = COLUMN_TEXTS
EXCEPTIONS
ERROR_OCCURRED = 1
OTHERS = 2.
*& Module STATUS_1000 OUTPUT
text
MODULE STATUS_1000 OUTPUT.
SET PF-STATUS 'GUI_1000'.
SET TITLEBAR 'xxx'.
IF my_container IS INITIAL.
CREATE OBJECT my_container
EXPORTING container_name = 'CONTAINER'.
ENDIF.
ENDMODULE. " STATUS_1000 OUTPUT
*& Module USER_COMMAND_1000 INPUT
text
MODULE USER_COMMAND_1000 INPUT.
ok_code = sy-ucomm.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_1000 INPUT
I created a screen 1000 in SCREENPAINTER, named it 'CONTAINER'. Then I try to launch code above and nothing appears on the screen. Could You give me some tip?Hi,
delete this lines:
IF my_container IS INITIAL.
CREATE OBJECT my_container
EXPORTING container_name = 'CONTAINER'.
ENDIF.
then it should work.
R -
Problems with spry dataset in IE
I am having problems with IE and dataset.
It all seem to work ok with Chrome and Firefox but IE throws errors.
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB6.6; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)
Timestamp: Fri, 14 Jan 2011 21:55:00 UTC
Message: Object expected
Line: 101
Char: 1
Code: 0
URI: http://www.dylizans.com/Spry_1_6_1_022408/includes/SpryPagedView.js
Message: Object expected
Line: 27
Char: 1
Code: 0
URI: http://www.dylizans.com/strony_autostop/autostop_ogloszenia.php
Message: 'Spry.Debug' is null or not an object
Line: 961
Char: 41
Code: 0
URI: http://www.dylizans.com/SpryAssets/SpryData.js
And url if anyone can help: http://www.dylizans.com/strony_autostop/autostop_ogloszenia.php
Any help would be great.
ThanksAlso I was wondering could the XML file have any impact on that errors? I know its very wild guess but I just dont know whre to find problem....copy just in case you can see anything there...:
header('Content-type: text/xml');
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');
?>
<?php echo('<?xml version="1.0" encoding="utf-8"?>'); ?>
<root>
<?php if ($totalRows_autostop_ogloszenia > 0) { // Show if recordset not empty ?>
<?php do { ?>
<row>
<?php foreach ($row_autostop_ogloszenia as $column=>$value) { ?>
<?php echo "<".$column.">"; ?>
<![CDATA[<?php echo $row_autostop_ogloszenia[$column]; ?>]]>
</<?php echo $column; ?>>
<?php } ?>
</row>
<?php } while ($row_autostop_ogloszenia = mysql_fetch_assoc($autostop_ogloszenia)); ?>
<?php } // Show if recordset not empty ?>
<?php
mysql_free_result($autostop_ogloszenia);
?>
</root>
Its a conversion from database result. -
Problems with simple picture gallery
I've got a website project where the client wanted a picture
gallery. I don't really do much with Flash so I went on the web and
found a tutorial on how to get what I want. Problem is that the
instructions I followed are fairly old so I couldn't export my
movie any higher than AS2 and Flash 6 and have it work. That would
be fine except that I wanted to use a feature that requires Flash 8
or higher, namely a gradient mask. I was hoping that I could post
my code and have the board gurus help me out with what i need to do
to get everything working together.
First you'll want to create a movie using AS2 and Flash 8 to
see what I'm trying to accomplish, then export it again with Flash
6 to see it actually working. You can grab a copy of what I'm
working with here:
http://www.technospider.com/~david/rusty.zip
All help greatly appreciated.
Thanks,
Davidbased on experience. i didn't check your file.
you're not likely to get anyone in this forum to check your
file.
if there's not code problem, and you can't publish for flash
8, there will be an error message. if you can publish for flash 8,
you see no error message but your application fails to work
correctly, you must have a problem with code. -
I have a problem with Oracle 10.2.0.5.0 and 11.2.0.1.0. Query result is wrong.
SELECT t.id
FROM (SELECT t.ID, MAX(t.nom) AS nom
FROM (SELECT 2 AS ID, 200 AS nom
FROM dual
UNION ALL
SELECT 3 AS ID, 0 AS nom FROM dual) t
LEFT JOIN (SELECT 0 AS ID_1, 0 AS nom_1 FROM dual) s
ON s.id_1 = t.ID
WHERE t.ID IN (2, 3)
GROUP BY t.ID
HAVING MAX(t.nom) != 0) t;Return nothing.
But on Oracle 10.2.0.4.0 result is correct:
ID NOM
2 200Looks like a bug related to ANSI joins.
Check Oracle Support, maybe it's fixed in 11.2.0.2.
It works with Oracle join syntax :
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Connected as dev
SQL>
SQL> SELECT t.id
2 FROM (SELECT t.ID, MAX(t.nom) AS nom
3 FROM (SELECT 2 AS ID, 200 AS nom
4 FROM dual
5 UNION ALL
6 SELECT 3 AS ID, 0 AS nom FROM dual) t
7 ,(SELECT 0 AS ID_1, 0 AS nom_1 FROM dual) s
8 WHERE t.ID IN (2, 3)
9 AND s.id_1(+) = t.ID
10 GROUP BY t.ID
11 HAVING MAX(t.nom) != 0) t;
ID
2 -
Problem with READ DATASET when reading file from app server
Hi,
wondering if anyone can help, I'm using the following code to read from a file on app server, the file is of type .rtf
OPEN DATASET file_rtf FOR INPUT IN TEXT MODE
ENCODING DEFAULT
WITH SMART LINEFEED.
DO.
READ DATASET file_rtf INTO string.
IF SY-SUBRC = 0.
EXIT.
ENDIF.
ENDDO.
the open dataset part works sy-subrc = 0, but the read returns sy-subrc = 8 and no data is passed to string.
Any ideas as to what is causing this problem appreciated, <removed>
Thanks
Edited by: Thomas Zloch on Mar 17, 2010 3:57 PM - please don't offer p...Hi Adam,
The source code in the below link has details about how to read/write to application server.
[Application server file operartions|http://www.divulgesap.com/blog.php?p=NDk=]
Please let us know if you have any issues.
Regards,
Ravi -
BOE XI 3.1: Problem with Simple Report Filter.
Hi everyone!.
One requirement that i have in one customer is about the use of simple reports filters, the customer doesn't want to use the input controls.
If i add one simple report filter and save the report, the final user can add other simple report filters, but the problem is that the name "Others" appears with all the variables than i have created to be used in the report.
Is it possible to hide the group "Others"?
Thanks!
Edited by: Jaime Pestaña on Mar 12, 2010 10:26 AMIf I understood you clearly, I think you have few variables created and one set of variable is called Others and you dont want users to see it.
There are couple of things you can do.
First one is to Use Othere filters as constant and it will not appear.
Second you can use others filter at Report level and it will not prompt to users.
Bashir Awan -
Sorting problem with baseball averages
Please help. I am new to iworks and am learning as I go. Overall I really just love it. Here is the proect that I am working on: I am doing a spreadsheet with the statistics for my son's baseball team. The spreadsheet looks really great. What I have is the following: individual averages for each player, and at the bottow of the row of averages, the overall team average.
The problem is that when I try to sort the row decending averages, the row does show the highest to the lowest average, but instead of leaving the team average at the very bottom, it is placing it within the individual team averages. So if the team average is .263, then the team average may end up between an average for a child of .300 and another with .250. How do I correct this so that the team average remains at the very bottom?
Also, the Averages display as 0.333. How do I get rid of the 0 in front of the .3?
thanks!!Hi Docal,
Place the AVERAGE formula into a Footer Row. Header and Footer Rows are not included in sorts.
The leading zero on the averages, although not in line with baseball practices, is mathematically correct notation.
You can eliminate it by setting a custom format for cells in that column.
Drag the Decimals element to the format box, select it, and press the up arrow key to add a third decimal place.
Then, click the Integers Element placed in the box by default and press delete to delete it.
These steps have been completed in the illustration.
Regards,
Barry -
Problem with simple error checking
Scratch the error checking bit. The original code involved error checking, but I've dwindled the problem down to the following code:
int input;
cout << endl << "Enter number: ";
cin >> input;
if (isnumber(input) == 0)
cout << "Not a number";
else
cout << "Is a number";
How is it that, when I enter the number 2 as input for this program, I get the response "Not a number." I get the same response when I enter something that actually is not a number, like the character 'a', as input. No matter what, it displays "Not a number."
This seems really basic to me. Am I missing something obvious here?As far as isnumber() goes, I made a mistake. Apparently isnumber() is also a function because it didn't raise an error, but it was a typo -- the function I meant to use was isdigit(), not isnumber(). So, I changed the function isnumber() to isdigit(), but still got the exact same result.
I've since figured out what the problem is, though. The function isdigit() was given in the notes my professor provided, along with isalpha(), ispunct(), isspace(), isupper(), and islower(). It occurred to me that these functions are intended to be used with single characters, and in my code I had defined the variable input as an int. So, I changed input to data type char and it worked fine.
So, that solves that issue, but raises another. Consider the following code, if you will:
int numHands;
while (numHands < 1 || numHands > 7)
cout << endl << "How many hands do you want to play: ";
cin >> numHands;
if (numHands < 1)
cout << endl << "You must play at least one hand...";
wait();
else if (numHands > 7)
cout << endl << "You can not play more than seven hands...";
wait();
This is a simple bit of error checking to make sure that the number that the user enters is between 1 and 7, and in that regard, it works fine. It does not, however, ensure that what the user enters is a number in the first place. My original solution to this was the following code:
while (numHands < 1 || numHands > 7 || isdigit(numHands) == 0)
cout << endl << "How many hands do you want to play: ";
cin >> numHands;
if (numHands < 1)
cout << endl << "You must play at least one hand...";
else if (numHands > 7)
cout << endl << "You can not play more than seven hands...";
else if (isdigit(numHands) == 0)
cout << endl << "You did not enter a number...";
When this didn't work, it prompted me to post this thread, but as I mentioned at the beginning of this post, I realized that the reason it didn't work was because isdigit() works with char and not int data types, and I obviously can't declare numHands as a char because the user could enter more than one character as input.
How, then, can I error check to ensure that the user's input is, in fact, a number? -
Problem with simple label program
I'm getting a problem to a most basic program. I'm using the Java2 Fast And Easy Web Start book. This simple label program gives me an error when I compile. This is the program
//Label Program
//Danon Knox
//Another basic program
import java.awt.*;
import java.applet.*;
public class Label extends Applet{
public void init(){
Label firstlabel = new Label();
Label secondlabel = new Label("This is the second label");
//put the labels on the applet
add(firstlabel);
add(secondlabel);
}// end init
}// end appleterror when I compile is as follows:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\>cd java
C:\java>javac Label.java
Label.java:12: cannot resolve symbol
symbol : constructor Label (java.lang.String)
location: class Label
Label secondlabel = new Label("This is the second label");
^
1 error
C:\java>
Can anyone help me?public class Label extends Applet{The name of your class is "Label". This choice of name hides the class named "Label" in java.awt.
Label firstlabel = new Label();This creation of a Label is successful because the class has a default, no-argument constructor.
Label secondlabel = new Label("This is the second label");And this one fails because there is no constructor for Label that takes a String argument.
You probably want firstlabel and secondlabel to be java.awt.Label objects and not instances of your own Label class. Try this:
public class Label extends java.applet.Applet{
public void init(){
java.awt.Label firstlabel = new java.awt.Label();
java.awt.Label secondlabel =
new java.awt.Label("This is the second label");
add(firstlabel);
add(secondlabel);
}As a general remark, I advise programmers to stay away from
import a.b.*;statements which import entire packages into your program namespace.
When starting out, I believe it is better to write out the fully qualified names ot the classes and methods you are working with. This helps you learn the class hierarchy, and makes your code clearer.
Others will disagree, but that's my opinion... -
Problem with Simple Transformation
Hi to all
I am working with ST, and have the following issue:
I have a highly nested xml structure, and, when I execute a abap program with a myself ST, only the last one data is passed to internal tables.
I want to know: how can I do to get that all the information from xml file to store to internal tables but not only the latest information structure?
For example I have the following xml file, and only the last occurence of <PSMService> is update in internal tables.
Thank you very much for your help.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<InvoicingInformation>
<Services>
<PSMServices>
<PSMService ContractCode="STF0996" InvoicePeriod="2011-01-31T00:00:00-06:00" ReceiptPointCode="347">
<Transactions>
<Transaction ReceiptPointCode="347" DeliveryPointCode="167" ExitTramoCode="15" SectorCode="SECTP_GNV">
</Transaction>
</Transactions>
<DailyCharges>
<DailyCharge ChargeCode="CHRGS_FIJO" Date="2011-01-01T00:00:00-06:00" Quantity="93" QuantityUnit="KPC">
</DailyCharge>
<DailyCharge ChargeCode="CHRGS_FIJO_COP" Date="2011-01-01T00:00:00-06:00" Quantity="93" QuantityUnit="KPC">
</DailyCharge>
</DailyCharges>
<AggregateCharges>
<AggregateCharge ChargeCode="CHRGS_DESVIO" IsTiered="false" Quantity="0" QuantityUnit="KPC" CurrencyCode="COP">
</AggregateCharge>
<AggregateCharge ChargeCode="CHRGS_DESVIO_US$" IsTiered="false" Quantity="0" QuantityUnit="KPC" CurrencyCode="USD">
</AggregateCharge>
</AggregateCharges>
</PSMService>
<PSMService ContractCode="STF0996" InvoicePeriod="2011-01-31T00:00:00-06:00" ReceiptPointCode="347">
<Transactions>
<Transaction ReceiptPointCode="347" DeliveryPointCode="192A" ExitTramoCode="16" SectorCode="SECTP_GNV">
</Transaction>
</Transactions>
<DailyCharges>
<DailyCharge ChargeCode="CHRGS_FIJO" Date="2011-01-01T00:00:00-06:00" Quantity="112" QuantityUnit="KPC">
</DailyCharge>
<DailyCharge ChargeCode="CHRGS_FIJO_COP" Date="2011-01-01T00:00:00-06:00" Quantity="112" QuantityUnit="KPC">
</DailyCharge>
</DailyCharges>
<AggregateCharges>
<AggregateCharge ChargeCode="CHRGS_FIJO" IsTiered="false" Quantity="560" QuantityUnit="KPC" CurrencyCode="USD">
</AggregateCharge>
<AggregateCharge ChargeCode="CHRGS_FIJO_COP" IsTiered="false" Quantity="560" QuantityUnit="KPC" CurrencyCode="COP">
</AggregateCharge>
</AggregateCharges>
</PSMService>
<PSMService ContractCode="STF0996" InvoicePeriod="2011-01-31T00:00:00-06:00" ReceiptPointCode="360">
<Transactions>
<Transaction ReceiptPointCode="260A" DeliveryPointCode="167" ExitTramoCode="15" SectorCode="SECTP_GNV">
</Transaction>
<Transaction ReceiptPointCode="260B" DeliveryPointCode="168" ExitTramoCode="15" SectorCode="SECTP_GNV">
</Transaction>
</Transactions>
<DailyCharges>
<DailyCharge ChargeCode="CHRGS_DESVIO" Date="2011-01-01T00:00:00-06:00" Quantity="0" QuantityUnit="KPC">
</DailyCharge>
<DailyCharge ChargeCode="CHRGS_DESVIO_US$" Date="2011-01-01T00:00:00-06:00" Quantity="0" QuantityUnit="KPC">
</DailyCharge>
</DailyCharges>
<AggregateCharges>
<AggregateCharge ChargeCode="CHRGS_DESVIO" IsTiered="false" Quantity="0" QuantityUnit="KPC" CurrencyCode="COP">
</AggregateCharge>
<AggregateCharge ChargeCode="CHRGS_DESVIO_US$" IsTiered="false" Quantity="0" QuantityUnit="KPC" CurrencyCode="USD">
</AggregateCharge>
</AggregateCharges>
</PSMService>
</PSMServices>
</Services>
</InvoicingInformation>
Edited by: Thomas Zloch on May 10, 2011 12:46 PM - code tags addedHi Charles.
Thank you.
This is a piece of the simple transformation:
<Services>
<!-- PSM Services -->
<PSMServices tt:extensible="deep-dynamic">
<tt:loop name="PSMService" ref="TABLA_PSM_SERVICES">
<PSMService tt:extensible="deep-dynamic">
<tt:attribute name="ContractCode" value-ref="$PSMService.ContractCode"/>
<tt:attribute name="InvoicePeriod" value-ref="$PSMService.InvoicePeriod"/>
<tt:attribute name="ReceiptPointCode" value-ref="$PSMService.ReceiptPointCode"/>
<tt:attribute name="DeliveryPointCode" value-ref="$PSMService.DeliveryPointCode"/>
<tt:attribute name="ExitTramoCode" value-ref="$PSMService.ExitTramoCode"/>
<tt:attribute name="SectorCode" value-ref="$PSMService.SectorCode"/>
<tt:attribute name="MarketCode" value-ref="$PSMService.MarketCode"/>
<tt:attribute name="TransportMarketCode" value-ref="$PSMService.TransportMarketCode"/>
<tt:attribute name="InvoiceBy" value-ref="$PSMService.InvoiceBy"/>
<tt:attribute name="MarketCapacity" value-ref="$PSMService.MarketCapacity"/>
<tt:attribute name="MarketCapacityUnitCode" value-ref="$PSMService.MarketCapacityUnitCode"/>
<tt:attribute name="SAPMaterialCode" value-ref="$PSMService.SAPMaterialCode"/>
<Transactions tt:extensible="deep-dynamic">
<tt:loop name="Transaction" ref=".TABLA_PSM_TRANSACTIONS">
<Transaction tt:extensible="deep-dynamic">
<tt:attribute name="ReceiptPointCode" value-ref="$Transaction.ReceiptPointCode"/>
<tt:attribute name="DeliveryPointCode" value-ref="$Transaction.DeliveryPointCode"/>
<tt:attribute name="ExitTramoCode" value-ref="$Transaction.ExitTramoCode"/>
<tt:attribute name="SectorCode" value-ref="$Transaction.SectorCode"/>
<tt:attribute name="MarketCode" value-ref="$Transaction.MarketCode"/>
<tt:attribute name="MarketCapacity" value-ref="$Transaction.MarketCapacity"/>
<tt:attribute name="Firm" value-ref="$Transaction.Firm"/>
<tt:attribute name="Overrun " value-ref="$Transaction.Overrun "/>
<tt:attribute name="UnitCode" value-ref="$Transaction.UnitCode"/>
<tt:attribute name="SAPMaterialCode" value-ref="$Transaction.SAPMaterialCode"/>
</Transaction>
</tt:loop>
</Transactions>
<DailyCharges tt:extensible="deep-dynamic">
<tt:loop name="DailyCharge" ref=".TABLA_PSM_DAILYCHARGES">
<DailyCharge tt:extensible="deep-dynamic">
<tt:attribute name="ChargeCode" value-ref="$DailyCharge.ChargeCode"/>
<tt:attribute name="Date" value-ref="$DailyCharge.Date"/>
<tt:attribute name="Quantity" value-ref="$DailyCharge.Quantity"/>
<tt:attribute name="QuantityUnit" value-ref="$DailyCharge.QuantityUnit"/>
</DailyCharge>
</tt:loop>
</DailyCharges>
<AggregateCharges tt:extensible="deep-dynamic">
<tt:loop name="AggregateCharge" ref=".TABLA_PSM_AGGREGATECHARGES">
<AggregateCharge tt:extensible="deep-dynamic">
<tt:attribute name="ChargeCode" value-ref="$AggregateCharge.ChargeCode"/>
<tt:attribute name="IsTiered" value-ref="$AggregateCharge.IsTiered"/>
<tt:attribute name="Quantity" value-ref="$AggregateCharge.Quantity"/>
<tt:attribute name="QuantityUnit" value-ref="$AggregateCharge.QuantityUnit"/>
<tt:attribute name="CurrencyCode" value-ref="$AggregateCharge.CurrencyCode"/>
<tt:attribute name="TariffRate" value-ref="$AggregateCharge.TariffRate"/>
<tt:attribute name="TariffRateUnit" value-ref="$AggregateCharge.TariffRateUnit"/>
</AggregateCharge>
</tt:loop>
</AggregateCharges>
</PSMService>
</tt:loop>
</PSMServices>
</Services>
Edited by: Thomas Zloch on May 10, 2011 12:47 PM - code tags added -
Problem with simple drawing program - please help!
Hi,
I've only just started using Java and would appreciate some help with a drawing tool application I'm currently trying to write.
The problem is that when the user clicks on a button at the bottom of the frame, they are then supposed to be able to produce a square or circle by simply clicking on the canvas.
Unfortunately, this is not currently happening.
Please help!
The code for both classes is as follows:
1. DrawToolFrame Class:
import java.awt.*;
import java.awt.event.*;
public class DrawToolFrame extends Frame
implements WindowListener
DrawToolCanvas myCanvas;
public DrawToolFrame()
setTitle("Draw Tool Frame");
addWindowListener(this);
Button square, circle;
Panel myPanel = new Panel();
square = new Button("square"); square.setActionCommand("square");
circle = new Button("circle"); circle.setActionCommand("circle");
myPanel.add(square); myPanel.add(circle);
add("South", myPanel);
DrawToolCanvas myCanvas = new DrawToolCanvas();
add("Center", myCanvas);
square.addMouseListener(myCanvas);
circle.addMouseListener(myCanvas);
public void windowClosing(WindowEvent event) { System.exit(0); }
public void windowOpened(WindowEvent event) {}
public void windowIconified(WindowEvent event) {}
public void windowDeiconified(WindowEvent event) {}
public void windowClosed(WindowEvent event) {}
public void windowActivated(WindowEvent event) {}
public void windowDeactivated(WindowEvent event) {}
2. DrawToolCanvas Class:
import java.awt.*;
import java.awt.event.*;
public class DrawToolCanvas
extends Canvas
implements MouseListener, ActionListener {
String drawType="square";
Point lastClickPoint=null;
public void drawComponent(Graphics g) {
if (lastClickPoint==null) {
g.drawString("Click canvas first",20,20);
} else {
if (drawType.equals("square")) {
square(g);
else if (drawType.equals("circle")) {
circle(g);
public void actionPerformed(ActionEvent event) {
if (event.getActionCommand().equals("square"))
drawType="square";
else if (event.getActionCommand().equals("circle"))
drawType="circle";
repaint();
public void mouseReleased(MouseEvent e) {
lastClickPoint=e.getPoint();
public void square(Graphics g) {
g.setColor(Color.red);
g.fillRect(lastClickPoint.x, lastClickPoint.y, 40, 40);
g.setColor(Color.black);
public void circle(Graphics g) {
g.setColor(Color.blue);
g.fillOval(lastClickPoint.x, lastClickPoint.y, 40, 40);
g.setColor(Color.black);
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}
public void mousePressed(MouseEvent e) {}
public void mouseClicked(MouseEvent e) {}
Any help would be appreciated!Some of the problems:
1) nothing calls drawComponent(Graphics g)
2) Paint(Graphics g) has not been overriden
3) myCanvas is declared twice: once as an instance variable to DrawToolFrame, and once local its constructor. Harmless but distracting. -
Problem with SImple Select Query
Hi
I am trying to write a simple Select SQL to a table and find out whether certain data exist or not. I have done this before but now for some reason this one is not working.
I started like this
select single * from ANLH where ANLN1 = rec-Asset
and BUKRS = Comp_Cd.
* Error Handler for non-existent empno in the database
if sy-subrc = 0 or rec-asset = ''.
rec_failed = 'T'.
concatenate 'Asset does not exist' rec-asset into asst_err.
endif.
when i debugged the code i found out that sy-subrc is returning 4 all the time. (i have passes some numbers in rec-Asset which i know doesn't exist in that table.
So i have modified the code to see if its pulling anything.
like this
select single ANLN1 into v_Asset from ANLH where ANLN1 = rec-Asset
and BUKRS = Comp_Cd.
* Error Handler for non-existent empno in the database
if sy-subrc = 0 or rec-asset = ''.
rec_failed = 'T'.
concatenate 'Asset does not exist' rec-asset into asst_err.
endif.
in debug v_asset is always empty (for real number and for the madeup number)
Please help.
Thanks
Edited by: Anwarul Kabir on Apr 3, 2008 9:27 PM
Edited by: Anwarul Kabir on Apr 3, 2008 9:29 PM
Edited by: Anwarul Kabir on Apr 3, 2008 9:30 PMThanks for the answer. But i thought i was doing the same. Anyway I replaced my code with yours but result is the same. I also did this
select single
ANLN1 into v_Asset
from ANLH where
ANLN1 = '20000544'
and BUKRS = '3000'.
I did SE11 and entered the table name and i can see that data.
but on my code i get sy-subrc=4 and v_Asset is blank
again i tried with this madeup number which i know its not in the table
select single
ANLN1 into v_Asset
from ANLH where
ANLN1 = '2056555433544'
and BUKRS = '3000'.
Get sy-subrc=4 and v_Asset is blank...
Is there anything special about the Table? -
Hi I'm making a simple menu bar but i have a little problem
here. When i click the Productions button for the third time, it
starts atthe top, in stead of the bottom. Can anyone figure out
what's wrong?
Thanks in Advace,
Jordyyour code is probably not what you want: your 2nd onPress
handler will be invoked on the next button press after a button
press (in which your first executes) AND your if-condition is
satisfied. from then on, that's the only onPress handler that will
execute (unless you have code elsewhere). -
Audio problem with simple iDVD '08 slideshow project - cutout/hiccup/drop
Hi - I just completed my first iDVD project which is just comprised of a photo slideshow (event from iPhoto) set to an iTunes playlist (AIFF and AAC files) using an iDVD theme (7.0 theme)
Everything seemed to work well, with one glaring exception:
Every six minutes and 22 seconds (6:22) upon DVD playback, the DVD stops for a brief second and then restarts - this causes an audio "blip." I would like to correct this.
Other info to help diagnose this problem: there are no markers that I know of in the project. I used six "drop zones" in the theme, though I don't know how/why those would affect the playback.
During preview, it plays fine. I have already tried "Save as Disk Image" and then burning to a high quality DVD at 4X speed - none of that corrected the problem. One other note: at each 6:22 of the approximately 37 minute slideshow, the "title" field changes from "1," to "2," to "3," etc. - what does this mean - this is apparently the cause of the problem, though I do not see how to adjust/correct this - thank you in advance!! [the other affect this has is that the running time resets every 6:22 - I would prefer this not to happen).
A couple of other notes, not as important, though still would like to figure out:
1. Edits I make to the songs in iTunes (namely, adjusting the volume and length of some songs) don't seem to take in the final product - why is this? The edits work when the songs play in iTunes.
2. I have seven songs that accompany the slideshow - is it possible to put markers at the start of each of those songs so I could select through to different sections? I have read that in a slideshow, each slide is a marker, so perhaps this isn't easily doable.
I've read about some other somewhat similar cases and some have suggested producing the slideshow in iMovie and then bringing it back into iDVD - would this help? Would this also allow me to mix the music better, as well? Or is there some better method? Garageband? Final Cut?
Thank you so much for your help - first thing I want to solve is the audio blip problem - next priority would be to get the song volumes matched/lengths slightly edited, and next would be the markers.
jsfitz22Yes, it is the 99 slide limit. Each slide is a chapter and at slide 99 the next slide is numbered back to 1 (chapter 1). Some DVD players get by that pause with just that, a brief pause, where others may balk entirely. Burning the project at the slowest possible speed, 1X if burning directly to disk from iDVD and 2X if burning a disk Image with Disk Utility, will help make that transition/pause less noticeable. It reminds me of the pause I get in playing commercial movies. There's often a pause at the point where the movies changes to the second layer (I think).
OT
Maybe you are looking for
-
Sick of password nag every time I install an app on OSX ver 10.5.6
Hi can some kind individual pls tell me how I can get rid of the stupid nag screen that asks for the password every time I install or change a setting in my mac? Its like that stupid UAC thing in vista. No one else other than my self uses this machin
-
How to deliver a Briefing Book in PDF format using iBOT
Hi, I would like to save a Briefing Book in PDF format (not in .SBB format) using iBOT. Any suggestion? Thanks, A.
-
Hello, I'm in the process of deploying a WLC2504 in an eviroment which requires a private VLAN for access to file servers and other network resources, as well as a guest network for internet access. As far as performance is concerned, will I get ac
-
XCode: how to add bison (yacc) "-p foo" for a SINGLE .ym file?
I have two pairs of tokenizers (.lm) and parsers (.ym) I want to use in pairs. How do i add the -p "foo" option for a single file? And "-P foo" for (f)lex? (I can add options at the target level, that much I know...)
-
my ipod is a 16gb 1st gen model.. if so how much is the discount?