| | | Notices | To access MotorolaFans with a lighter theme and feature for you mobile phone, you may use the following URL:
wap.motorolafans.com
which brings you directly to the mobile version of the forums with no graphics to load, therefore increasing page loading speed, reducing your data costs and giving you the Best of both worlds!
Thank you for your continued support and ENJOY!! | | Development Hacking, development, scripts etc |  | | Moderator
Join Date: Jul 2005 Posts: 833
Thanks: 25
Thanked 219 Times in 80 Posts
Location: Thailand | |
03-14-2008
| [ZMultiLineEdit] EZX Programming for dummy by dummy A1200, E6 after test with ZPushButton in http://www.motorolafans.com/forums/showthread.php?p=132847#post132847
Now I try another widget. here is a memCheck application. main widget is ZMultiLineEdit. application doing an easy job by execute command cat /proc/meminfo and dispaly result in ZMultiLineEdit.
ZMultiLineEdit is a text box that can have 1 or more lines. and it can expandable in both size.
you can create ZMultiLineEdit by Quote: |
memStatus = new ZMultiLineEdit( this, false, 12 );
| this = parent widget. can be content widget, QVBox, QBox. but can not create ZMultiLineEdit on ZScrollView it cause a segmentation fault.
false = ezx style. I found no different between true and false. report me If you found it.
12 = number of lines.
After create it ZMultiLineEdit need to config many properties such as
setWordWrap for define wraping text.
setSizePolicy for define expanding in horizontal and vertical when text length is out of it's area.
setReadOnly to make it read only but can copy text inside it.
setMaxLength for define number of characters for user input.
and we can define filter for input by Quote:
QRegExp mFilter = QRegExp("[^0-9]");
mPhoneNumberEdit->setFilter(mFilter);
| see QRegExp for more detail.
Here is a full source code of memCheck demo. Code: //-------------------------------------------------------------------------------------------------
//
// Header Name: MemCheck.cpp
//
// General Description: MemCheck class implement file.
//
//-------------------------------------------------------------------------------------------------
//
// Eakrin Confidential Proprietary
// Template ID and version: 20080308 Version 0.1
// (c) Copyright eakrin 2008, All Rights Reserved
//
//-------------------------------------------------------------------------------------------------
#include <ZApplication.h>
#include <ZMainWidget.h>
#include <ZPushButton.h>
#include <ZMessageBox.h>
#include <ZScrollView.h>
#include <ezxutilcst.h>
#include <ZMultiLineEdit.h>
// UTIL_MemInfo always return undefine type. can not convert to QString.
//#include <UTIL_MemInfo.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qfile.h>
#include <qtextstream.h>
#include <stdlib.h>
#include "MemCheck.h"
MemCheck::MemCheck( void )
: ZMainWidget( FALSE, NULL, NULL, 0 )
{
// Create Title bar.
title = new QLabel( tr( "Memory Status" ), this );
title->setScaledContents( TRUE );
setTitleBarWidget( title );
title->show();
// Create CST Widget.
cst = new UTIL_CST( this, tr( "Refresh" ) );
setCSTWidget( cst );
cst->show();
// Create CST Right Button.
ZPushButton *btn = cst->getRightBtn();
connect( btn, SIGNAL( clicked() ), qApp, SLOT( slotQuickQuit() ) );
// Create CST Mid Button.
btn = cst->getMidBtn();
connect( btn, SIGNAL( clicked() ), this, SLOT( refresh() ) );
// Create CST Left Button with popup menu.
cstMenu = new QPopupMenu( cst, NULL );
cstMenu->insertItem( tr( "About.." ) );
connect( cstMenu, SIGNAL( activated( int ) ), this, SLOT( selectCSTMenu( int ) ) );
btn =cst->getLeftBtn();
btn->setPopup( cstMenu );
// Create content widget.
//QWidget *contentWidget = this->getContentWidget( TRUE );
/*
ZScrollView *contentWidget = new ZScrollView( this );
setContentWidget( contentWidget );
contentWidget->show();
*/
//QVBoxLayout *contentLayout = new QVBoxLayout( contentWidget );
memStatus = new ZMultiLineEdit( this, false, 12 );
memStatus->setWordWrap( ZMultiLineEdit::WidgetWidth );
memStatus->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding));
memStatus->setReadOnly( TRUE );
setContentWidget( memStatus );
// refresh memory status.
this->refresh();
}
MemCheck::~MemCheck( void )
{
}
void MemCheck::refresh( void )
{
system( "cat /proc/meminfo > /tmp/MemInfo.txt" );
QFile ft( "/tmp/MemInfo.txt" );
if ( ft.open( IO_ReadOnly ) )
{
QTextStream ts ( &ft );
ts.readLine();
ts.readLine();
ts.readLine();
QString mem;
for (int row = 0; row < 15; row++)
{
mem = ts.readLine();
memStatus->insertLine( mem );
}
ft.close();
}
system( "rm /tmp/MemInfo.txt" );
}
void MemCheck::selectCSTMenu( int menuId )
{
showAboutDialog();
}
void MemCheck::showAboutDialog( void )
{
ZMessageBox::information(this, NULL,
QString::fromUtf8("<qt><p><b>MemCheck %1</b></p>eakrin @ MotorolaFans.com</qt>").arg(VERSION),
QString::fromUtf8("Ok"));
}
Code: //-------------------------------------------------------------------------------------------------
//
// Header Name: MemCheck.h
//
// General Description: MemCheck header file.
//
//-------------------------------------------------------------------------------------------------
//
// Eakrin Confidential Proprietary
// Template ID and version: 20080308 Version 0.1
// (c) Copyright eakrin 2008, All Rights Reserved
//
//-------------------------------------------------------------------------------------------------
#ifndef __MEM_CHECK_H__
#define __MEM_CHECK_H__
#ifndef __cplusplus
#error "This is a C++ header file;it requires C++ to compile."
#endif
#include <ZMainWidget.h>
#define VERSION "0.1"
#define RELEASE "Mar 9, 2008"
class QLabel;
class ZMultiLineEdit;
class UTIL_CST;
class QPopupMenu;
//class UTIL_MemInfo;
class MemCheck : public ZMainWidget
{
Q_OBJECT
public:
MemCheck( void );
~MemCheck( void );
public slots:
void refresh( void );
void selectCSTMenu( int menuId );
void showAboutDialog( void );
private:
QLabel *title;
UTIL_CST *cst;
QPopupMenu *cstMenu;
//UTIL_MemInfo *mi;
ZMultiLineEdit *memStatus;
};
#endif // #ifndef __MEM_CHECK_H__
Code: //-------------------------------------------------------------------------------------------------
//
// Header Name: main.cpp
//
// General Description: main file for Ezx Mem Check
//
//-------------------------------------------------------------------------------------------------
//
// Eakrin Confidential Proprietary
// Template ID and version: 20080308 Version 0.1
// (c) Copyright eakrin 2008, All Rights Reserved
//
//-------------------------------------------------------------------------------------------------
#include <ZApplication.h>
#include "MemCheck.h"
int main( int argc, char** argv )
{
ZApplication app( argc, argv );
MemCheck *mw = new MemCheck();
app.showMainWidget(mw);
return app.exec();
}
and you can set startup keyboard by setInputMethods. Quote: |
setInputMethods( mPhoneNumberEdit, IMID_NUMBER_KB, 0, 0 );
| IMID_NUMBER_KB is a keyboard constant id defined in ZIMethod.h. IMID_NUMBER_KB is Quuid not a string. I tested only number keyboard. didn't test with symbol, thai, china board. And There have no another language keyboard id in ZIMethod.h may be we can use them from *.kdb in EMEA_LP.
And need to replace ZMainWidget.h with my update from this post for setInputMethod. http://www.motorolafans.com/forums/s...2&postcount=63
thanks for blackhawk about setInputMethods.
cheer!
eakrin User Information Current Phone: E6
A1200
A780 Firmware: Lamborghini 09P Location: Thailand | | | | | The Following User Says Thank You to eakrin For This Useful Post: | | Moto Fans SENR Join Date: Sep 2005 Posts: 1,091
Thanks: 0
Thanked 132 Times in 67 Posts
Location: Jakarta, Indonesia | |
03-14-2008
| To prevent ZScrollView raising seg. fault, you have to set the child widget minimum size. Code: ZScrollView *sv = new ZScrollView(this);
setContentWidget(sv);
ZMultiLineEdit *le = new ZMultiLineEdit(sv->viewport(), TRUE, 10);
le->setMinimumWidth(ZGloball::getSubContentR().width());
sv->addChild(0, 0, TRUE);
Using above code, you will have a ZMultiLineEdit with EZX style  You have to set the ZMainWidget's edit mode argument to TRUE, to make the ZScrollView have auto resizing ability (when the virtual keyboard invoke). ZScrollView also can to manage the child widget size and layout but not do the job for now, maybe because we have incomplete header for it. User Information Current Phone: Motorola E680i and A1200 Location: Jakarta, Indonesia | | | | | The Following User Says Thank You to blackhawk For This Useful Post: | | Moto Fans SENR Join Date: Sep 2005 Posts: 1,091
Thanks: 0
Thanked 132 Times in 67 Posts
Location: Jakarta, Indonesia | |
03-14-2008
| @eakrin
Now I can compile EditorE source code without any modification (except the environment set and a bunch of soft link to foxe6's EZX headers. Yes, I keep blackhawk's SDK standard). The file browser not working as expected but this application now running on A1200  I have to use different libezxappbase  Must I have to flash my Ming to different firmware? User Information Current Phone: Motorola E680i and A1200 Location: Jakarta, Indonesia | | | | Moderator
Join Date: Jul 2005 Posts: 833
Thanks: 25
Thanked 219 Times in 80 Posts
Location: Thailand | |
03-15-2008
| @blackhawk.
what is your f/w. ? Look like you use a Monsterpack or Hybrid f/w. I 'll test A1200i, A1200r, A1200e library later. But I think It should be the same library in A1200, i, r ,e, and E6. I use only E6's libraries and make a symbolic link to a1200. all my apps worked in both A1200 and e6. I think you have the same problem as ustrucx. he flash his phone to standard f/w and everything work fine with foxe6's sdk. and be careful for A1200 f/w track.
because I think now I found the source of segmentation fault error from *.h file. Need to test it a little to be sure. Then after that we should have many header files as we need. LOL.
cheer! User Information Current Phone: E6
A1200
A780 Firmware: Lamborghini 09P Location: Thailand | | | | | The Following User Says Thank You to eakrin For This Useful Post: | | MotoFans NWBE
Join Date: Jan 2008 Posts: 11
Thanks: 4
Thanked 4 Times in 2 Posts
| |
03-17-2008
| I've tried yan0 or foxe6's SDK for many times on my A1200E, but always fail when setup a ZMultiLineEdit. Now, I find the way from xptools and MFiles:
First, replace the libezxappbase.so.* with libezxappbase.so.1 from these packages. Compile the application with foxe6's header files. Coy libezxappbase.so.1 to your SD (eg: /mmc/mmca1/lib/ ). When launch the executable, set the env like this: Quote:
#!/bin/sh
. /home/native/.profile # apply QT exec env
export LD_LIBRARY_PATH=/mmc/mmca1/lib:$LD_LIBRARY_PATH
exec /where/your/app/is
| This my first time to make a simple application with ZMultiLineEdit to run on my A1200E from source!
__________________ Embedded linux lover
Last edited by redice; 03-17-2008 at 02:25 PM.
User Information Current Phone: A1200 | | | | Moto Fans SENR Join Date: Sep 2005 Posts: 1,091
Thanks: 0
Thanked 132 Times in 67 Posts
Location: Jakarta, Indonesia | |
03-17-2008
| @redice
Congratulations! I have talking about this problem above. This is the reason why MFile author can use EditorE source to build Edit (text editor binary inside MFile package) but we still have a problem: ZScrollView can not manage the child widget properly. That's why Edit file browser not work as expected. I have an updated EditorE source, the file browser now look more native (using UTIL_ListBox) but far away from my computer for now and have no the source copy to upload it here  User Information Current Phone: Motorola E680i and A1200 Location: Jakarta, Indonesia | | | | | The Following User Says Thank You to blackhawk For This Useful Post: | | Moto Fans SENR Join Date: Sep 2005 Posts: 1,091
Thanks: 0
Thanked 132 Times in 67 Posts
Location: Jakarta, Indonesia | |
03-17-2008
| @redice
Since we have a same problem, is your firmware R532_G_11.00.59P like my mine? User Information Current Phone: Motorola E680i and A1200 Location: Jakarta, Indonesia | | | | MotoFans NWBE Join Date: Mar 2008 Posts: 10
Thanks: 4
Thanked 24 Times in 4 Posts
Location: Moscow | |
03-17-2008
| I've also tried using ZMultiLineEdit on my a1200e, with foxe6's SDK I got seg. faults, but eug from motofan.ru told me how to correct the SDK:
compare these chunks of code Code: public:
ZMultiLineEdit( QWidget *parent=0, const char *name=0);
/**
* Constructor of ZMultiLineEdit
*
* @param EZXStyle if false, the class is almost the samewith qmultilineedit.
* if true ezx-special functions will be suported.
*
* @param lines the default lines the ZMultiLineEdit has
*/
ZMultiLineEdit( QWidget *parent,bool EZXStyle,int lines = 1,const char *name=0 );
virtual ~ZMultiLineEdit();
This one is in foxe6's SDK Code: public:
char buf[2048];
ZMultiLineEdit( QWidget *parent=0, const char *name=0, bool unk=true );
/**
* Constructor of ZMultiLineEdit
*
* @param EZXStyle if false, the class is almost the samewith qmultilineedit.
* if true ezx-special functions will be suported.
*
* @param lines the default lines the ZMultiLineEdit has
*/
ZMultiLineEdit( QWidget *parent,bool EZXStyle,int lines = 1,const char *name=0, bool unk=true );
virtual ~ZMultiLineEdit();
And this one is correct and works with libezxappbase from a1200e
so there's no need for library from e6 User Information Current Phone: A1200e Firmware: R541_G_11.52.14R_U3 Location: Moscow | | | | | The Following User Says Thank You to borman For This Useful Post: | | MotoFans NWBE
Join Date: Jan 2008 Posts: 11
Thanks: 4
Thanked 4 Times in 2 Posts
| |
03-17-2008
| Quote:
Originally Posted by blackhawk @redice
Since we have a same problem, is your firmware R532_G_11.00.59P like my mine? | My firmware is R541_G_11.50.34P.
__________________ Embedded linux lover User Information Current Phone: A1200 | | | | Moto Fans SENR Join Date: Sep 2005 Posts: 1,091
Thanks: 0
Thanked 132 Times in 67 Posts
Location: Jakarta, Indonesia | |
03-17-2008
| @borman
To compile an application that using ZMultiLineEdit (EditorE for an example), my R532_G_11.00.59P A1200's libezxappbase library need boolean argument in ZMultiLineEdit costructor but it raise segmentation fault at runtime. My English not good enough to explain, but we are not talking about that E6's libezxappbase is the correct library for this problem.
@redice
Different firmware but have a same problem  User Information Current Phone: Motorola E680i and A1200 Location: Jakarta, Indonesia | | | |  | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT. The time now is 11:39 PM.
Search Engine Friendly URLs by vBSEO 3.2.0
Powered by vBulletin® Version 3.7.2 Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
VBulletin Skin by ForumMonkeys.
| |