Help me Using JButton....
Is there a method in java that will press a button with out clicking it?
for instance... I have to forms..... form a and form b......
for instance i'm in the form b, after I click the button in form b, it will go to form a.... I just want to know how to click the button in form a before that form will be visible.....
any help will do....
tenks....
Your problem sounds odd. I'm curious why you would ever need to do this in the scenario you have specified, it sounds like some refactoring is in order. Regardless, JButton inherits doClick() from AbstractButton and is probably what you want. The API says:
"doClick
public void doClick()
Programmatically perform a "click". This does the same thing as if the user had pressed and released the button."
Similar Messages
-
How to use JButton as a JTable column header?
I'd like to use JButtons as my JTable's column headers.
I built a JButton subclass which implemented TableCellRenderer and passed it to one of my table column's setHeaderRender method. The resulting header is a component that looks like a JButton but when clicked, it does not visually depress or fire any ActionEvents.You might want to check this example and use it accordingly for your requirements.
http://www2.gol.com/users/tame/swing/examples/JTableExamples5.html
Reason: The reason you're unable to perform actions on JButton is JTableHeader doesn't relay the mouse events to your JButtons.
I hope this helps.
have fun, ganesh. -
How do i use jbutton for mutiple frames(2frames)???
im an creating a movie database program and i have a problem with the jButtons on my second frame i dont know how to make them work when clicked on. i managed to make the jButtons work on my first frame but not on the second....
here is that code so far----
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
* real2.java
* Created on December 7, 2007, 9:00 AM
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
* @author J
public class real2 extends JPanel implements ActionListener{
private JButton addnew;
private JButton help;
private JButton exit;
private JFrame frame1;
private JButton save;
private JButton cancel;
private JButton save2;
private JLabel moviename;
private JTextField moviename2;
private JLabel director;
private JTextField director2;
private JLabel year;
private JTextField year2;
private JLabel genre;
private JTextField genre2;
private JLabel plot;
private JTextField plot2;
private JLabel rating;
private JTextField rating2;
/** Creates a new instance of real2 */
public real2() {
super(new GridBagLayout());
//Create the Buttons.
addnew = new JButton("Add New");
addnew.addActionListener(this);
addnew.setMnemonic(KeyEvent.VK_E);
addnew.setActionCommand("Add New");
help = new JButton("Help");
help.addActionListener(this);
help.setActionCommand("Help");
exit = new JButton("Exit");
exit.addActionListener(this);
exit.setActionCommand("Exit");
String[] columnNames = {"First Name",
"Last Name",
"Sport",
"# of Years",
"Vegetarian"};
Object[][] data = {
{"Mary", "Campione",
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour",
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne",
"Pool", new Integer(10), new Boolean(false)}
final JTable table = new JTable(data, columnNames);
table.setPreferredScrollableViewportSize(new Dimension(600, 100));
table.setFillsViewportHeight(true);
//Create the scroll pane and add the table to it.
JScrollPane scrollPane = new JScrollPane(table);
//Add the scroll pane to this panel.
add(scrollPane);
GridBagConstraints c = new GridBagConstraints();
c.weightx = 1;
c.gridx = 0;
c.gridy = 1;
add(addnew, c);
c.gridx = 0;
c.gridy = 2;
add(help, c);
c.gridx = 0;
c.gridy = 3;
add(exit, c);
public static void addComponentsToPane(Container pane){
pane.setLayout(null);
//creating the components for the new frame
JButton save = new JButton("Save");
JButton save2 = new JButton("Save and add another");
JButton cancel = new JButton("Cancel");
JLabel moviename= new JLabel("Movie Name");
JTextField moviename2 = new JTextField(8);
JLabel director = new JLabel("Director");
JTextField director2 = new JTextField(8);
JLabel genre = new JLabel("Genre");
JTextField genre2 = new JTextField(8);
JLabel year = new JLabel("year");
JTextField year2 = new JTextField(8);
JLabel plot = new JLabel("Plot");
JTextField plot2 = new JTextField(8);
JLabel rating = new JLabel("Rating(of 10)");
JTextField rating2 = new JTextField(8);
//adding components to new frame
pane.add(save);
pane.add(save2);
pane.add(cancel);
pane.add(moviename);
pane.add(moviename2);
pane.add(director);
pane.add(director2);
pane.add(genre);
pane.add(genre2);
pane.add(year);
pane.add(year2);
pane.add(plot);
pane.add(plot2);
pane.add(rating);
pane.add(rating2);
//setting positions of components for new frame
Insets insets = pane.getInsets();
Dimension size = save.getPreferredSize();
save.setBounds(100 , 50 ,
size.width, size.height);
size = save2.getPreferredSize();
save2.setBounds(200 , 50 ,
size.width, size.height);
size = cancel.getPreferredSize();
cancel.setBounds(400 , 50 ,
size.width, size.height);
size = moviename.getPreferredSize();
moviename.setBounds(100 , 100 ,
size.width, size.height);
size = moviename2.getPreferredSize();
moviename2.setBounds(200 , 100 ,
size.width, size.height);
size = director.getPreferredSize();
director.setBounds(100, 150 ,
size.width, size.height);
size = director2.getPreferredSize();
director2.setBounds(200 , 150 ,
size.width, size.height);
size = genre.getPreferredSize();
genre.setBounds(100 , 200 ,
size.width, size.height);
size = genre2.getPreferredSize();
genre2.setBounds(200 , 200 ,
size.width, size.height);
size = year.getPreferredSize();
year.setBounds(100 , 250 ,
size.width, size.height);
size = year2.getPreferredSize();
year2.setBounds(200 , 250 ,
size.width, size.height);
size = plot.getPreferredSize();
plot.setBounds(100 , 300 ,
size.width, size.height);
size = plot2.getPreferredSize();
plot2.setBounds(200 , 300 ,
size.width, size.height);
size = rating.getPreferredSize();
rating.setBounds(100 , 350 ,
size.width, size.height);
size = rating2.getPreferredSize();
rating2.setBounds(200 , 350 ,
size.width, size.height);
private static void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
frame.add(new real2());
//Display the window.
frame.setSize(600, 360);
frame.setVisible(true);
frame.pack();
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
public void actionPerformed(ActionEvent e) {
if ("Add New".equals(e.getActionCommand())){
frame1 = new JFrame("add");
frame1.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
addComponentsToPane(frame1.getContentPane());
frame1.setSize(600, 500);
frame1.setVisible(true);
//disableing first frame etc:-
if (frame1.isShowing()){
addnew.setEnabled(false);
help.setEnabled(false);
exit.setEnabled(true);
frame1.setVisible(true);
}else{
addnew.setEnabled(true);
help.setEnabled(true);
exit.setEnabled(true);
if ("Exit".equals(e.getActionCommand())){
System.exit(0);
if ("Save".equals(e.getActionCommand())){
// whatever i ask it to do it wont for example---
help.setEnabled(true);
if ("Save" == e.getSource()) {
//i tried this way too but it dint work here either
help.setEnabled(true);
}so if someone could help me by either telling me what to type or by replacing what iv done wrong that would be great thanks...(1)Java class name should begin with a capital letter. See: http://java.sun.com/docs/codeconv/
JButton save = new JButton("Save");
JButton save2 = new JButton("Save and add another");
// ... etc. ...(2)Don't redeclare class members in a method as its local variable. Your class members become eternally null, a hellish null.
how to make them work when clicked on(3)Add action listener to them. -
Need help in using FM BAPI_MATERIAL_SAVEDATA
Gurus,
I need help in using the FM BAPI_MATERIAL_SAVEDATA. The FM is returning a message that says "The field MARA-MEINS/BAPI_MARA-BASE_UOM(_ISO) is defined as a required field; it does not contain an entry".
I have supplied the necessary details and yet the FM won't push through.
If possible, please post sample codes.
Below is my sample code:
===============================================
REPORT zmm_materialupload.
eject
$$******************************************************************************
$$ TYPES
$$******************************************************************************
eject
$$******************************************************************************
$$ INTERNAL TABLES (custom structure
$$******************************************************************************
eject
$$******************************************************************************
$$ RANGES
$$******************************************************************************
eject
$$******************************************************************************
$$ FIELD-SYMBOLS
$$******************************************************************************
eject
$$******************************************************************************
$$ PARAMETERS & SELECT-OPTIONS
$$******************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE text-001.
*SELECT-OPTIONS: s_matnr FOR mara-matnr.
SELECT-OPTIONS: s_mtart FOR mara-mtart.
SELECT-OPTIONS: s_mbrsh FOR mara-mbrsh DEFAULT 'P'.
SELECT-OPTIONS: s_werks FOR marc-werks DEFAULT '1000' OBLIGATORY.
SELECT-OPTIONS: s_lgort FOR marc-lgpro DEFAULT 'OPSL' OBLIGATORY.
PARAMETERS: p_path LIKE rlgrap-filename DEFAULT 'C:\Documents and Settings\training_11\Desktop\Book4 (2ITEMS).txt' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK 1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FNAME'
IMPORTING
file_name = p_path.
eject
$$******************************************************************************
$$ START-OF-SELECTION
$$******************************************************************************
START-OF-SELECTION.
PERFORM check_input.
PERFORM get_file.
PERFORM filter_input.
PERFORM populate_tabs.
PERFORM bapi_mat.
eject
$$******************************************************************************
$$ FORMS
$$******************************************************************************
FORM bapi_mat.
LOOP AT it_tab INTO wa_tab.
CALL FUNCTION 'BAPI_MATERIAL_GETINTNUMBER'
EXPORTING
material_type = wa_tab-mtart
industry_sector = wa_tab-mbrsh
required_numbers = 1
TABLES
material_number = it_matnr.
ENDLOOP.
LOOP AT it_matnr INTO wa_matnr.
READ TABLE it_tab INTO wa_tab INDEX sy-tabix.
wa_tab-matnr = wa_matnr-material.
MODIFY it_tab FROM wa_tab INDEX sy-tabix.
ENDLOOP.
PERFORM populate_tabs.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = it_headdata
clientdata = it_clientdata
clientdatax = it_clientdatax
plantdata = it_plantdata
plantdatax = it_plantdatax
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA =
STORAGELOCATIONDATAX =
valuationdata = it_valuationdata
valuationdatax = it_valuationdatax
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA =
SALESDATAX =
STORAGETYPEDATA =
STORAGETYPEDATAX =
flag_online = ' '
flag_cad_call = ' '
NO_DEQUEUE = ' '
NO_ROLLBACK_WORK = ' '
IMPORTING
return = it_return
TABLES
materialdescription = it_materialdescription
unitsofmeasure = it_unitsofmeasure
unitsofmeasurex = it_unitsofmeasurex
internationalartnos = it_internationalartnos
materiallongtext = it_materiallongtext
taxclassifications = it_taxclassifications
returnmessages = it_returnmessages
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
IF sy-subrc = 0.
ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = it_return.
ENDFORM. "bapi_mat
*& Form GET_FILE
text
FORM get_file.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = 'Getting data from file...'.
MOVE: p_path TO gv_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gv_file
filetype = 'ASC'
has_field_separator = 'X'
read_by_line = 'X'
TABLES
data_tab = it_tab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
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. "GET_FILE
*& Form check_input
text
FORM check_input.
Material Type
IF s_mtart-low IS INITIAL AND s_mtart-high IS INITIAL.
s_mtart = 'IEQ'.
s_mtart-low = 'ABF'. "Waste
s_mtart-high = 'ZTRD'. "Stock Items
APPEND s_mtart.
ENDIF.
IF s_mtart-low IS NOT INITIAL AND s_mtart-high IS INITIAL.
MOVE: s_mtart-low TO s_mtart-high.
ENDIF.
Industry Sector
IF s_mbrsh-low IS INITIAL AND s_mbrsh-high IS INITIAL.
s_mbrsh = 'IEQ'.
SELECT mbrsh
FROM mara
INTO TABLE it_mbrsh.
s_mbrsh-low = wa_mbrsh-mbrsh.
LOOP AT it_mbrsh INTO wa_mbrsh.
s_mbrsh-high = wa_mbrsh-mbrsh.
ENDLOOP.
APPEND s_mbrsh.
ENDIF.
IF s_mbrsh-low IS NOT INITIAL AND s_mbrsh-high IS INITIAL.
MOVE: s_mbrsh-low TO s_mbrsh-high.
ENDIF.
Plant
IF s_werks-low IS INITIAL AND s_werks-high IS INITIAL.
s_werks = 'IEQ'.
s_werks-low = '1000'.
s_werks-high = '2000'.
ENDIF.
IF s_werks-low IS NOT INITIAL AND s_werks-high IS INITIAL.
MOVE: s_werks-low TO s_werks-high.
ENDIF.
Storage Location
IF s_lgort-low IS NOT INITIAL AND s_lgort-high IS INITIAL.
MOVE: s_lgort-low TO s_lgort-high.
ENDIF.
ENDFORM. "check_input
*& Form Filter_input
text
FORM filter_input.
SORT it_tab BY matnr mtart mbrsh werks lgort.
LOOP AT it_tab INTO wa_tab.
IF wa_tab-mtart NOT IN s_mtart.
DELETE it_tab WHERE mtart NOT IN s_mtart.
ENDIF.
IF wa_tab-mbrsh NOT IN s_mbrsh.
DELETE it_tab WHERE mbrsh NOT IN s_mbrsh.
ENDIF.
IF wa_tab-werks NOT IN s_werks.
DELETE it_tab WHERE werks NOT IN s_werks.
ENDIF.
IF wa_tab-lgort NOT IN s_lgort.
DELETE it_tab WHERE lgort NOT IN s_lgort.
ENDIF.
ENDLOOP.
ENDFORM. "Filter_input
*& Form populate_tabs
text
FORM populate_tabs.
LOOP AT it_tab INTO wa_tab.
MOVE: wa_tab-matnr TO wa_headdata-material,
wa_tab-mbrsh TO wa_headdata-ind_sector,
wa_tab-mtart TO wa_headdata-matl_type,
'X' TO wa_headdata-basic_view,
'X' TO wa_headdata-sales_view,
'X' TO wa_headdata-purchase_view,
'X' TO wa_headdata-mrp_view,
'X' TO wa_headdata-account_view.
wa_tab-matkl TO wa_clientdata-matl_group,
wa_tab-meins TO wa_clientdata-base_uom,
wa_tab-groes TO wa_clientdata-size_dim,
wa_tab-gewei TO wa_clientdata-unit_of_wt,
wa_tab-ntgew TO wa_clientdata-net_weight,
'X' TO wa_clientdatax-matl_group,
'X' TO wa_clientdatax-base_uom,
'X' TO wa_clientdata-size_dim,
'X' TO wa_clientdatax-unit_of_wt,
'X' TO wa_clientdatax-net_weight,
wa_tab-werks TO wa_plantdata-plant,
wa_tab-ekgrp TO wa_plantdata-pur_group,
wa_tab-prctr TO wa_plantdata-profit_ctr,
wa_tab-werks TO wa_plantdatax-plant,
'X' TO wa_plantdatax-pur_group,
'X' TO wa_plantdatax-profit_ctr,
wa_tab-werks TO wa_valuationdata-val_area,
wa_tab-bklas TO wa_valuationdata-val_class,
wa_tab-peinh TO wa_valuationdata-price_unit,
wa_tab-verpr TO wa_valuationdata-moving_pr,
wa_tab-stprs TO wa_valuationdata-std_price,
wa_tab-xlifo TO wa_valuationdata-lifo_fifo,
wa_tab-werks TO wa_valuationdatax-val_area,
'X' TO wa_valuationdatax-val_class,
'X' TO wa_valuationdatax-price_unit,
'X' TO wa_valuationdatax-moving_pr,
'X' TO wa_valuationdatax-std_price,
'X' TO wa_valuationdatax-lifo_fifo.
APPEND wa_headdata TO it_headdata.
APPEND wa_clientdata TO it_clientdata.
APPEND wa_plantdata TO it_plantdata.
APPEND wa_valuationdata TO it_valuationdata.
MODIFY it_tab FROM wa_tab TRANSPORTING matnr.
ENDLOOP.
ENDFORM. "populate_tabs
$$******************************************************************************Hai.
check the below example.
REPORT z34332_bdc_create_material .
data: la_headdata type BAPIMATHEAD,
la_clientdata type BAPI_MARA,
la_CLIENTDATAX type BAPI_MARAX,
la_return type BAPIRET2.
data: i_materialdescription type table of BAPI_MAKT,
wa_materialdescription like line of i_materialdescription.
la_headdata-MATERIAL = '000000000000000004'.
la_headdata-IND_SECTOR = 'M'.
la_headdata-MATL_TYPE = 'FERT'.
la_clientdata-BASE_UOM = 'FT3'.
la_CLIENTDATAX-BASE_UOM = 'X'.
la_clientdata-MATL_GROUP = '01'.
la_CLIENTDATAX-MATL_GROUP = 'X'.
wa_materialdescription = 'TEST'.
append wa_materialdescription to i_materialdescription.
clear: wa_materialdescription.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = la_headdata
CLIENTDATA = la_clientdata
CLIENTDATAX = la_CLIENTDATAX
PLANTDATA =
PLANTDATAX =
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA =
STORAGELOCATIONDATAX =
VALUATIONDATA =
VALUATIONDATAX =
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA =
SALESDATAX =
STORAGETYPEDATA =
STORAGETYPEDATAX =
FLAG_ONLINE = ' '
FLAG_CAD_CALL = ' '
IMPORTING
RETURN = la_return
TABLES
MATERIALDESCRIPTION = i_materialdescription
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
write: la_return-TYPE, ',', la_return-MESSAGE.
clear: la_headdata, la_return, la_clientdata, la_clientdatax.
regards.
sowjanya.b. -
Need help in using ActiveX to retrieve a VARIANT
Need help in using ActiveX to retrieve a VARIANT.
Variant is shown as var{VT_Ul1,1} in debug
Using the following
hr = CA_VariantGetShort (&var, &value);
I get 0 for my answer instead of 1.
Solved!
Go to Solution.Answered my own question.
VT_Ul1 is an unsigned char and not a short. -
I just updated my IOS to 7.1 and now I can't open Microsoft attachments - I used to always do it. Help - I use my iPad for work and now can't see any attachments. I've tried opening straight into other apps and just get error messages, and I the mail preview there is just a grey screen telling me the file name and size. It worked fine until I did the IOS upgrade
Troubleshooting apps purchased from the App Store
http://support.apple.com/kb/TS1702
Delete the app and redownload.
Downloading Past Purchases from the iTunes Store, App Store and iBooks Store
http://support.apple.com/kb/ht2519
Cheers, Tom -
I have updated my iPhone 4s to iOS7 but when i connect it to itunes on my PC it give me a msg to restore your iPhone in summary tab, Please help m using win 7 and updated itunes.
What is showing on the screen of the iPhone?
Does iTunes say the iPhone is in recovery mode? -
i have to upload video from my hewlett packard t200 camcorder to my mac. but mac won't recognize the camcorder files. i even bought flip4mac by tele stream which so far is useless. please help me use my camcorder with my iMac os mountain lion 10.8.2
i tried to get the installation disc for the camcorder but mac wont' recognize it becaue it is windows based i guess.
i just bought the camcorder a few months ago and when my computer crashed thought i'm finally getting a mac...it's been a costly venture which has resulted in more frustration than before my pc.
now the things i want to use with my mac that i thought would be even simpler...are not even useable...
helpThat camera shoots H.264 in an .avi wrapper.
You will have to transfer the files via the Finder.
Get a free copy of MPEG Streamclip and convert them to QuickTime .mov using the H.264 codec if you are presumably editing in iMovie.
Note that your list of video codecs won't look like mine as I have Final Cut Pro, but H.264 is definitely an option for you. -
Attachments help - C# using Obect API
I'm in my first attempt at integrating GW functionality into a C# application. I am not an expert C# programmer either. Thus far I've been successful at getting logged into GW, creating a new mail message and sending it successfully. However adding code to attach a file to my message returns an exception from the GroupwareTypeLibrary with the unhelpful error message "Unknown Error". Below is my code. If I comment out the line:
objMessage.Attachments.Add("c:\reg.log",1,"reg.log ");
the program runs successfully, happily sending my mail to the recipent mailbox. I know the c:\reg.log file exists and I have permissions to it.
Any advice as to what I'm doing wrong would be of tremendous help, as I've already search and cruised all the forums on GW API I can find to no avail. Running GW 7.03 I think on client and server side.
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using GroupwareTypeLibrary;
namespace GWEmailTest
class Program
public static void Main()
GroupwareTypeLibrary.Application objApplication = new GroupwareTypeLibrary.Application();
GroupwareTypeLibrary.Account objAccount;
GroupwareTypeLibrary.Messages objMessages;
GroupwareTypeLibrary.Message objMessage;
GroupwareTypeLibrary.Folder objMailBox;
GroupwareTypeLibrary.Recipients objRecipients;
GroupwareTypeLibrary.Recipient objRecipient;
objAccount = objApplication.Login("dpuls", "", "password", "", "");
objMailBox = objAccount.MailBox;
objMessages = objMailBox.Messages;
objMessage = objMessages.Add("GroupwareTypeLibrary.Message",4," ");
objRecipients = objMessage.Recipients;
objRecipient = objRecipients.Add("dpuls","","");
objMessage.Subject.PlainText = "Here's the message from C#!.";
objMessage.BodyText.PlainText = "Here's the report you wanted.";
objMessage.Attachments.Add("c:\reg.log",1,"reg.log ");
objMessage.Send();Markus,
Thanks so much for your quick reply. I appreciate your willingness to help me overcome my ignorance. Here's what I found:
objMessage = objMessages.Add("GW.MESSAGE.MAIL", 4);
results in a C# compiler error "no overload method for 'add' requires '2' arguments". This tells me the third paramater is required for the GroupwareTypeLibary COM object, so I added the third null parameter back in, eliminating the compiler error. Then I still got the same "unknown error" exception back from the COM library as before.
So I went back to my shotgun approach of trying variations on parameter passing (instance variables instead of literals, etc). I noticed at one point when I tried another test file that I got a compiler error on a string literal of the path\filename "c:\csharptest.txt". Aha, says I ......
To make a long story short, by happenstance, my "c:\reg.log" parameter gets read in C# as containing an escape sequence reference, i.e. "\r" and when I changed to another test file it read "c:\csharptest.txt" as an INVALID escape sequence "\c". The fix then was to correct the problem of the reading of escape sequences in my string literal by changing my line of code to :
objMessage.Attachments.Add(@"c:\reg.log","1","");
Problem solved! Thanks again for your help.
dennis puls
Originally Posted by Markus Colorado
I suppose the way you're adding a draft message to the collection is false.
>> objMessages = objMailBox.Messages;
>> objMessage = objMessages.Add("GroupwareTypeLibrary.Message",4," ");
The function "Add()" takes only 2 parameters, 'ClassName' + 'ObjType'.
'ClassName' stands for the sort/subtype of message you'd like to create.
'ObjType' stands for 'draft' or 'personal'
Try the following:
objMessages = objMailBox.Messages;
objMessage = objMessages.Add("GW.MESSAGE.MAIL", 4);
The rest should be fine; the code for adding the attachment seems OK.
Markus
"dpuls" <[email protected]> schrieb im Newsbeitrag
news:[email protected]...
>
> I'm in my first attempt at integrating GW functionality into a C#
> application. I am not an expert C# programmer either. Thus far I've
> been successful at getting logged into GW, creating a new mail message
> and sending it successfully. However adding code to attach a file to my
> message returns an exception from the GroupwareTypeLibrary with the
> unhelpful error message "Unknown Error". Below is my code. If I
> comment out the line:
> objMessage.Attachments.Add("c:\reg.log",1,"reg.log ");
>
> the program runs successfully, happily sending my mail to the recipent
> mailbox. I know the c:\reg.log file exists and I have permissions to
> it.
>
> Any advice as to what I'm doing wrong would be of tremendous help, as
> I've already search and cruised all the forums on GW API I can find to
> no avail. Running GW 7.03 I think on client and server side.
>
> ****************************
> using System;
> using System.Collections.Generic;
> using System.Text;
> using System.IO;
> using GroupwareTypeLibrary;
>
> namespace GWEmailTest
> {
> class Program
> {
> public static void Main()
> {
> GroupwareTypeLibrary.Application objApplication = new
> GroupwareTypeLibrary.Application();
> GroupwareTypeLibrary.Account objAccount;
> GroupwareTypeLibrary.Messages objMessages;
> GroupwareTypeLibrary.Message objMessage;
> GroupwareTypeLibrary.Folder objMailBox;
> GroupwareTypeLibrary.Recipients objRecipients;
> GroupwareTypeLibrary.Recipient objRecipient;
>
> objAccount = objApplication.Login("dpuls", "", "password", "",
> "");
> objMailBox = objAccount.MailBox;
> objMessages = objMailBox.Messages;
> objMessage = objMessages.Add("GroupwareTypeLibrary.Message",4," ");
> objRecipients = objMessage.Recipients;
> objRecipient = objRecipients.Add("dpuls","","");
> objMessage.Subject.PlainText = "Here's the message from C#!.";
> objMessage.BodyText.PlainText = "Here's the report you wanted.";
> objMessage.Attachments.Add("c:\reg.log",1,"reg.log ");
> objMessage.Send();
> }
> }
> }
> ****************************
>
>
> --
> dpuls
> ------------------------------------------------------------------------
> dpuls's Profile: NOVELL FORUMS - View Profile: dpuls
> View this thread: Attachments help - C# using Obect API - NOVELL FORUMS
> -
How can I print stuff from the 'Help' file using my MacBook Air?
How can I print stuff from the 'Help' file using my MacBook Air?
Open the Help viewer, select a category then from the menu bar top of your screen, click File > Print
-
I have been able to access a site regularly but in the last few days get a message: "cookies required to access this site." please help, I use this site for work daily:)
Goto > Settings > Safari... Enable Cookies > Always
Good luck! -
Help in using listagg function for more than 8000 char.
Hi Friends,
Need you urgent help in using listagg function for more than 8000 char.
I did the below sample SQL and in "e_orig" and "d_orig" for upto 4000 char it is working fine but I have to use it for more than 8000 char. and it is giving error,
I checked the listagg function is having limitation of 4000 char.
I tried but I am unable to achive this. Can someone provide me a sample example to achive this
select d.dname,d.loc,e.hiredate
,listagg(e.ename,',' ) within group (order by e.deptno) over (partition by e.deptno) as e_orig
,listagg(e.ename, ',') within group (order by e.sal) over (partition by e.deptno) as d_orig
from emp e, dept d
where e.deptno=d.deptno;[ This is my first post, I gone through the guideline for posting a post , and try to go according to that ( I have not pasted here create table and insert as I have used basic table emp, dept for example), please let me know if still I should give this, I will take care from my next post ]
Thanks in advanceInteresting, I didn't know you could do that, but...
BluShadow wrote:
You could write some PL/SQL code that does it all for you, but that would involve loops and would be slow.Well, objects are written in PL/SQL aren't they? And presumably there'll be implicit looping too? So it's not at all obvious that this method will be faster than doing the joining in PL/SQL in memory. The only way to find out is to benchmark them - so I have done that.
I noticed that OP's ref cursor actually only ever retrieves a single record for a bound department number, so I decided the best thing would be to test using a procedure that passes an output string back. I selected all (109) employees and put spaces in to ensure above 4000 characters. I also noticed that as he is using PL/SQL he probably can use a VARCHAR2 type, but just not ListAgg in the query, so I wrote short procedures as follows:
SimpleAggChr - bulk collect and array processing, VARCHAR2 output
ClobAggPrc - the custom aggregation method, CLOB output
SimpleAggClob - bulk collect and array processing, CLOB output
I then wrote a driving script that calls them in the order above and times each call (I like benchmarking so I have my own timing object to make it easy). I then print the lengths for checking, and my object writes the timings to my output table. Running a few times I got varying results, but generally it looks like there isn't a lot to choose between them for performance.
Here's the procedure code:
CREATE OR REPLACE TYPE char100_list_type AS TABLE OF VARCHAR2(100)
CREATE OR REPLACE PROCEDURE SimpleAggChr (x_out OUT VARCHAR2) IS
l_enames char100_list_type;
BEGIN
SELECT first_name || ' ' || last_name
BULK COLLECT INTO l_enames
FROM employees
ORDER BY salary;
FOR i IN 1..l_enames.COUNT LOOP
x_out := x_out || l_enames(i) || ',';
END LOOP;
END SimpleAggChr;
CREATE OR REPLACE PROCEDURE SimpleAggClob (x_out OUT CLOB) IS
l_enames char100_list_type;
BEGIN
SELECT first_name || ' ' || last_name
BULK COLLECT INTO l_enames
FROM employees
ORDER BY salary;
FOR i IN 1..l_enames.COUNT LOOP
x_out := x_out || l_enames(i) || ',';
END LOOP;
END SimpleAggClob;
SHO ERR
PROMPT ClobAggPrc
CREATE OR REPLACE PROCEDURE ClobAggPrc (x_out OUT CLOB) IS
BEGIN
SELECT clobagg(first_name || ' ' || last_name || ',')
INTO x_out
FROM employees
ORDER BY salary;
END ClobAggPrc;
SHO ERRand the driving script:
SET SERVEROUTPUT ON
SET TIMING ON
DECLARE
l_enames_c1 CLOB;
l_enames_c2 CLOB;
l_enames_v VARCHAR2(32767);
l_timer timer_set_type := timer_set_type ('Aggregation');
BEGIN
Utils.g_id := 'Aggregation';
SimpleAggChr (l_enames_v);
l_timer.Increment_Time ('SimpleAggChr');
ClobAggPrc (l_enames_c1);
l_timer.Increment_Time ('ClobAggPrc');
SimpleAggClob (l_enames_c2);
l_timer.Increment_Time ('SimpleAggClob');
DBMS_Output.Put_Line ('SimpleAggChr returned string of length ' || Length (l_enames_v));
DBMS_Output.Put_Line ('ClobAggPrc returned string of length ' || Length (l_enames_c1));
DBMS_Output.Put_Line ('SimpleAggClob returned string of length ' || Length (l_enames_c2));
l_timer.Write_Times;
END;
SET TIMING OFF
SET LINES 150
SET PAGES 1000
COLUMN id FORMAT A30
COLUMN line_text FORMAT A120
SELECT line_text
FROM output_log
WHERE id = 'Aggregation'
ORDER BY line_ind
/and the results:
SimpleAggChr returned string of length 5779
ClobAggPrc returned string of length 5779
SimpleAggClob returned string of length 5779
PL/SQL procedure successfully completed.
Elapsed: 00:00:27.05
LINE_TEXT
Timer Set: Aggregation, constructed at 03 Nov 2011 16:27:07, written at 16:27:35
================================================================================
[Timer timed: Elapsed (per call): 0.02 (0.000016), CPU (per call): 0.01 (0.000010), calls: 1000, '***' denotes corrected
line below]
Timer Elapsed CPU Calls Ela/Call CPU/Call
SimpleAggChr 9.84 0.36 1 9.84400 0.36000
ClobAggPrc 9.37 0.32 1 9.37400 0.32000
SimpleAggClob 8.25 0.22 1 8.25000 0.22000
(Other) 0.00 0.00 1 0.00000 0.00000
Total 27.47 0.90 4 6.86700 0.22500
13 rows selected. -
Help needed using adobe exportpdf
The first time I used adobe export pdf it worked well. However the next time and every other time I try to convert a pdf doc to word docx I get the error message at the end of the uploading session. "pdf doc failed to export to m,icrosoft word. There was an unexpected problem.
Anyone overcome this problem?Hi Stacy
Thanks for that info. I was aware of the 100MB limit but
your response made me think again and go back to the problem and this is
what I found. The first pdf document I uploaded into Adobe export pdf was 43
MB and it went through fine. when I looked at the conversion to Word docx I
found it had been transformed into 83MB.
So the conversion (which was a children's book with lots of images in it)
resulted in an increase of MBs by a factor of 1.7.
The second pdf document I uploaded was 64MB and this failed. If I apply the
1.7 factor then the Word docx I wanted was going to be 109MB and therefore
over the 100MB limit.
I didn't know that converting pdf to word would increase the MB like that.
Why, I don't know so thanks for your help I've learnt something new.
Cheers
Garth
In a message dated 07/10/2013 04:42:36 GMT Daylight Time,
[email protected] writes:
Re: Help needed using adobe exportpdf
created by StacySison (http://forums.adobe.com/people/StacySison) in
Adobe ExportPDF - View the full discussion
(http://forums.adobe.com/message/5740689#5740689) -
Alv field with f4 help without using class
Hi,
Can any one give me a program of "Alv field with f4 help without using class".
Thanking you in advance.hi
<b>Linking F4 Help to Fields</b>
For the last section, we will deal with linking F4 help to fields. It is easy. As usual, define, implement and register the event onf4 at proper places in your code. For F4 help, you must register the fields whose F4 request will trigger the onf4 event. For this you must prepare a table of type LVC_T_F4 and register this table using the method register_f4_for_fields. While preparing table you must include a line for each field which will trigger F4 event. For each field in the structure;
􀂾 Pass the fieldname to FIELDNAME
􀂾 Set REGISTER to make the field registered,
􀂾 Set GETBEFORE to provide field content transport before F4 in editable mode
􀂾 Set CHNGEAFTER to make the data changed after F4 in editable mode.
DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE .
lt_f4-fieldname = 'PRICE'.
lt_f4-register = 'X' .
lt_f4-getbefore = 'X' .
APPEND lt_f4 .
CALL METHOD gr_alvgrid->register_f4_for_fields
EXPORTING
it_f4 = lt_f4[] .
Preparing table for the fields to be registered to trigger F4 event
METHOD handle_on_f4 .
PERFORM f4_help USING e_fieldname es_row_no .
er_event_data->m_event_handled = 'X' .
ENDMETHOD .
A sample onf4 method implementation
Again, we set the attribute er_event_data->m_event_handled to prevent further processing of standard F4 help.
regards
Ravish
<b>
reward if useful</b> -
I'm in syria and they blocked me from using any VPN service please help without VPN i can't open the store help please ( using iphone 5 version 9.1.4 )
There is nothing that anyone here on a user forum can do to help you. If it is a local issue in Syria, then you need to take it up with your phone company or authorities there who have prevented you from using VPN.
Nobody here can help you.
Maybe you are looking for
-
Issue with Enterprise Library's Data Access Application
I do not know if I have the correct forum for this post. I hve put it in what I believe is the most likely best forum, but please move this if there is a more germane forum for it. I have inherited a solution (C#) which uses the reference Microsoft.P
-
Collections "in the cloud" and CSV export/import
I really want to love App Studio. Love the new look, but still... 1. I've created a table in Excel for Mac to manage an offline list (name, translation, photo, notes) of data for a collection. Same four columns by name as in my collection. 2. I've le
-
1099 COPY B - Bursting by Vendor_ID
Hi Friends! Does anyone knows if is possible to split the 1099 COPY B report by Vendor ID using "bursting" ? I've tried but appears that is not working because even after I set the bursting option by Vendor_ID, the process continues generating only o
-
Adobe: Why Not Update The Photoshop Download Package to 13.0.1?
Just for grins I downloaded the Adobe CS6 software again (all 1.17 GB of it) and compared it to what I downloaded before. It's the same - 13.0.0. Why the heck doesn't Adobe update their download package to the latest revision? Who in their right min
-
Hey there, All I want to do is uninstall this terribly designed update. Can some please tell me how to do this and possibly give me an email to someone who actually works at the company. My phone doesn't work as a phone anymore so I can't call the