Hi tyrel,
deineListbox->moveSelection(eListBoxBase::<Dein Parameter>);
mögliche Parameter für eListBoxBase::
dirPageDown, dirPageUp, dirDown, dirUp, dirFirst, dirLast
(getestet)
siehe auch listbox.h
jetzt kommst Du an jeden Eintrag.
Gruß Emu
Hi tyrel,
deineListbox->moveSelection(eListBoxBase::<Dein Parameter>);
mögliche Parameter für eListBoxBase::
dirPageDown, dirPageUp, dirDown, dirUp, dirFirst, dirLast
(getestet)
siehe auch listbox.h
jetzt kommst Du an jeden Eintrag.
Gruß Emu
Hi noch mal,
Ghost, der war SUPER!! theList->moveSelection(eListBoxBase::dirFirst);
jetzt ist viel Mist raus.
aber, aber ...
die "eTextPara::eTextPara(eRect, ePoint)" und font.h machen mich jetzt schon
seit Tagen fertig.
Ich make'e in der plugin Ebene, cvs ist neu(update von gestern),
Ich habe den src in ein "läufiges" plugin kopiert,
Ich habe Header aus der listbox.h, usw. ausprobiert.
Erst dachte ich, das im Pc/cdk was fehlt, aber enigma.cpp, eButton.cpp, listbox.cpp...
die haben auch den font.h und bei make dreamboximage_root...
läuft es ja auch.
Also denk ich sitzt der Fehler wie so oft vor meinem PC!
Brauche ich ein anderes env als für Standart-plugins?
Ich hoffe mal auf euch.
****************************************************************************
Ghost: bitte,bitte kannst Du ein kleines "läufiges" Pixlistboxplugin
schreiben - Ich schaffe es nicht.
****************************************************************************
Gruß Emanuel
geht noch gar nicht,
ich wollt nur mal im src ebrowser (post oben) das Objekt mitkompilieren:
emanuel@falcon:~/dreambox-cvs/cdk> make .plugins
make -C /home/emanuel/dreambox-cvs/apps/tuxbox/plugins all install
make[1]: Entering directory `/home/emanuel/dreambox-cvs/apps/tuxbox/plugins'
make all-recursive
make[2]: Entering directory `/home/emanuel/dreambox-cvs/apps/tuxbox/plugins'
Making all in emanuel
make[3]: Entering directory `/home/emanuel/dreambox-cvs/apps/tuxbox/plugins/emanuel'
if /bin/sh ../libtool --tag=CXX --mode=compile powerpc-tuxbox-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I. -I.. -I./../lib -I../include -I../../enigma/include -I/home/emanuel/dreambox-cvs/driver/include -I/home/emanuel/dreambox-cvs/driver/include -I/home/emanuel/dreambox-cvs/root/cdkroot/include -I/home/emanuel/dreambox-cvs/driver/include -fno-rtti -fno-exceptions -I/home/emanuel/dreambox-cvs/root/cdkroot/lib/sigc++-1.2/include -I/home/emanuel/dreambox-cvs/root/cdkroot/include/sigc++-1.2 -I/home/emanuel/dreambox-cvs/root/cdkroot/include/tuxbox/xmltree -Wall -mcpu=405 -msoft-float -mmultiple -mstring -meabi -pipe -Os -ggdb3 -DHAVE_DREAMBOX_HARDWARE -MT myplugin_la-myplugin.lo -MD -MP -MF ".deps/myplugin_la-myplugin.Tpo" -c -o myplugin_la-myplugin.lo `test -f 'myplugin.cpp' || echo './'`myplugin.cpp; \
then mv -f ".deps/myplugin_la-myplugin.Tpo" ".deps/myplugin_la-myplugin.Plo"; else rm -f ".deps/myplugin_la-myplugin.Tpo"; exit 1; fi
powerpc-tuxbox-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I. -I.. -I./../lib -I../include -I../../enigma/include -I/home/emanuel/dreambox-cvs/driver/include -I/home/emanuel/dreambox-cvs/driver/include -I/home/emanuel/dreambox-cvs/root/cdkroot/include -I/home/emanuel/dreambox-cvs/driver/include -fno-rtti -fno-exceptions -I/home/emanuel/dreambox-cvs/root/cdkroot/lib/sigc++-1.2/include -I/home/emanuel/dreambox-cvs/root/cdkroot/include/sigc++-1.2 -I/home/emanuel/dreambox-cvs/root/cdkroot/include/tuxbox/xmltree -Wall -mcpu=405 -msoft-float -mmultiple -mstring -meabi -pipe -Os -ggdb3 -DHAVE_DREAMBOX_HARDWARE -MT myplugin_la-myplugin.lo -MD -MP -MF .deps/myplugin_la-myplugin.Tpo -c myplugin.cpp -fPIC -DPIC -o .libs/myplugin_la-myplugin.o
In file included from ../../enigma/include/lib/gdi/font.h:4,
from myplugin.cpp:34:
/home/emanuel/dreambox-cvs/root/cdk/lib/gcc/powerpc-tuxbox-linux-gnu/3.4.4/../../../../powerpc-tuxbox-linux-gnu/include/ft2build.h:55:38: freetype/config/ftheader.h: No such file or directory
In file included from myplugin.cpp:34:
../../enigma/include/lib/gdi/font.h:5:10: #include expects "FILENAME" or <FILENAME>
../../enigma/include/lib/gdi/font.h:6:10: #include expects "FILENAME" or <FILENAME>
../../enigma/include/lib/gdi/font.h:7:10: #include expects "FILENAME" or <FILENAME>
../../enigma/include/lib/gdi/font.h:8:10: #include expects "FILENAME" or <FILENAME>
In file included from myplugin.cpp:34:
../../enigma/include/lib/gdi/font.h:37: error: `FT_Library' does not name a type
../../enigma/include/lib/gdi/font.h:38: error: `FTC_Manager' does not name a type
../../enigma/include/lib/gdi/font.h:39: error: `FTC_Image_Cache' does not name a type
../../enigma/include/lib/gdi/font.h:40: error: `FTC_SBit_Cache' does not name a type
../../enigma/include/lib/gdi/font.h:42: error: `FTC_FaceID' does not name a type
../../enigma/include/lib/gdi/font.h:43: error: `FT_Error' does not name a type
../../enigma/include/lib/gdi/font.h:49: error: `FT_Error' does not name a type
../../enigma/include/lib/gdi/font.h:69: error: `FT_ULong' does not name a type
../../enigma/include/lib/gdi/font.h:82: error: `FT_Face' does not name a type
../../enigma/include/lib/gdi/font.h:96: error: `FT_Face' has not been declared
../../enigma/include/lib/gdi/font.h:96: error: `FT_UInt' has not been declared
../../enigma/include/lib/gdi/font.h:96: error: ISO C++ forbids declaration of `current_face' with no type
../../enigma/include/lib/gdi/font.h:96: error: ISO C++ forbids declaration of `glyphIndex' with no type
../../enigma/include/lib/gdi/font.h: In constructor `eTextPara::eTextPara(eRect, ePoint)':
../../enigma/include/lib/gdi/font.h:103: error: class `eTextPara' does not have any field named `current_face'
../../enigma/include/lib/gdi/font.h:103: error: class `eTextPara' does not have any field named `replacement_face'
../../enigma/include/lib/gdi/font.h: At global scope:
../../enigma/include/lib/gdi/font.h:142: error: `FTC_Image_Desc' does not name a type
../../enigma/include/lib/gdi/font.h:145: error: `FT_Error' does not name a type
../../enigma/include/lib/gdi/font.h:146: error: `FT_Face' does not name a type
../../enigma/include/lib/gdi/font.h:147: error: `FT_Size' does not name a type
../../enigma/include/lib/gdi/font.h:151: error: `FTC_FaceID' has not been declared
../../enigma/include/lib/gdi/font.h:151: error: ISO C++ forbids declaration of `faceid' with no type
myplugin.cpp:44: error: constructors may not be `const'
myplugin.cpp:44: error: expected `;' before "eString"
myplugin.cpp:48: error: prototype for `eListBoxEntryTextPixmap::eListBoxEntryTextPixmap(eListBox<eListBoxEntryMenu>*, const char*, void*, bool, int, const eString&, int)' does not match any in class `eListBoxEntryTextPixmap'
myplugin.cpp:39: error: candidate is: eListBoxEntryTextPixmap::eListBoxEntryTextPixmap(const eListBoxEntryTextPixmap&)
myplugin.cpp: In constructor `eListBoxEntryTextPixmap::eListBoxEntryTextPixmap(eListBox<eListBoxEntryMenu>*, const char*, void*, bool, int, const eString&, int)':
myplugin.cpp:49: error: `gPixmap*eListBoxEntryTextPixmap::pm' is a static data member; it can only be initialized at its definition
myplugin.cpp:51: error: no matching function for call to `eListBoxEntryText::eListBoxEntryText(const void**, eListBox<eListBoxEntryMenu>*&, const char*&, void*&, int&, const eString&, int&)'
../../enigma/include/lib/gui/listbox.h:262: note: candidates are: eListBoxEntryText::eListBoxEntryText(const eListBoxEntryText&)
../../enigma/include/lib/gui/listbox.h:283: note: eListBoxEntryText::eListBoxEntryText(eListBox<eListBoxEntryText>*, const eString&, void*, int, const eString&, int)
../../enigma/include/lib/gui/listbox.h:277: note: eListBoxEntryText::eListBoxEntryText(eListBox<eListBoxEntryText>*, const char*, void*, int, const eString&, int)
myplugin.cpp: At global scope:
myplugin.cpp:61: error: no `const eString& eListBoxEntryTextPixmap::redraw(gPainter*, const eRect&, gColor, gColor, gColor, gColor, int)' member function declared in class `eListBoxEntryTextPixmap'
myplugin.cpp: In member function `const eString& eListBoxEntryTextPixmap::redraw(gPainter*, const eRect&, gColor, gColor, gColor, gColor, int)':
myplugin.cpp:67: error: `coNormalF' undeclared (first use this function)
myplugin.cpp:67: error: (Each undeclared identifier is reported only once for each function it appears in.)
make[3]: *** [myplugin_la-myplugin.lo] Fehler 1
make[3]: Leaving directory `/home/emanuel/dreambox-cvs/apps/tuxbox/plugins/emanuel'
make[2]: *** [all-recursive] Fehler 1
make[2]: Leaving directory `/home/emanuel/dreambox-cvs/apps/tuxbox/plugins'
make[1]: *** [all] Fehler 2
make[1]: Leaving directory `/home/emanuel/dreambox-cvs/apps/tuxbox/plugins'
make: *** [.plugins] Fehler 2
emanuel@falcon:~/dreambox-cvs/cdk>
Alles anzeigen
Header reinpacken (viele kenn ich gar nicht)
hat es auch noch nicht gebracht.
ich hatte mit font.h und ohne Probleme.
egal in welches Plugin ich die font.h schreib habe ich diese Fehlermeldungen.
forward declaration von Typ etext...
CVS is uptodate
mit der Bitte um Hilfe
Gruß
Emanuel
Hi Ghost,
Danke!
Ich test gleich mal.
Listenauswahl:
Es geht mir darum, das ich beim Verzeichniswechsel in das root-Verzeichnis
[eine Ebene nach oben]
den ersten Eintrag der Liste(nach dem erneuten Start von makelist())
abfragen kann um ihn in der Statuszeile anzuzeigen zu können,
bis jetzt mach ich das halt noch "zu Fuß".
Bericht folgt.
Gruß Emanuel =) =)
Hi tyrel,
Nein leider nicht. setFocus ist nicht das gleiche wie:
CONNECT(theList->selchanged, eBrowserMainWindow::selectionChanged);
Das Funktioniert erst nach auf und ab-zappen in der Listbox
desswegen auch kein:
status->setText(entry->d_name);
Es gibt aber was zum "anpingen":
...GetCurrent().selchanged oder so in etwar
Das suche ich (den richtigen Syntax inc. Aufruf des Listbox Textes)
Emanuel
Hi tyrel,
Das werde ich mal testen,
Im moment beschäftigt mich immer noch der Browser.
Ich möchte da Ordner Icons rein machen.
aber ich weiß noch nicht wie.
außerdem suche ich noch wie ich beim erzeugen der Liste
den ersten Eintrag selected schalten kann. damit ich diese kreuz und quer
Abfrage des Pfades raus hab.
Ich poste es noch mal, es läuft und hat einen Selectbutten:
/*
+--------------------------------------------------------------------------
|
| eBrowser
|
| Enigma 1 API GUI
| Juni 2007 (c) by Emanuel
|
+---------------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <plugin.h>
#include <lib/gui/ewindow.h>
#include <lib/gui/elabel.h>
#include <lib/gui/statusbar.h>
#include <lib/gui/ebutton.h>
#include <lib/gui/emessage.h>
#include <lib/gui/listbox.h>
#include <lib/gui/eskin.h>
#include <lib/gdi/gfbdc.h>
#include <lib/gdi/epng.h>
using namespace std;
class eBrowserMainWindow: public eWindow
{
char PATH[256];
eString folder;
eListBox<eListBoxEntryText> *theList;
eButton *select, *status;
void makelist();
void selectdir(eListBoxEntryText *item);
void selectfolder();
void selectionChanged(eListBoxEntryText *item);
public:
eBrowserMainWindow();
~eBrowserMainWindow();
};
extern "C" int plugin_exec( PluginParam *par )
{
eBrowserMainWindow dlg;
dlg.show();
int result=dlg.exec();
dlg.hide();
return result;
}
eBrowserMainWindow::eBrowserMainWindow(): eWindow(1)
{
strcpy(PATH,"/var/");
cmove(ePoint(100, 100));
cresize(eSize(520, 376));
setText("/var");
theList = new eListBox<eListBoxEntryText>(this);
theList->move(ePoint(5, 5));
theList->resize(eSize(clientrect.width() - 10, clientrect.height() - 55));
theList->loadDeco();
theList->setColumns(1);
select = new eButton(this);
select->move(ePoint(360, clientrect.height() - 45));
select->resize(eSize(155,40));
select->setText("OK");
select->setProperty("align", "center");
select->setShortcut("green");
select->setShortcutPixmap("green");
select->loadDeco();
CONNECT(select->selected, eBrowserMainWindow::selectfolder);
status = new eButton(this);
status->move(ePoint(5, clientrect.height() - 45));
status->resize(eSize(clientrect.width() - 165, 40));
status->setProperty("align", "left");
status->setText(PATH);
status->loadDeco();
makelist();
CONNECT(theList->selchanged, eBrowserMainWindow::selectionChanged);
CONNECT(theList->selected, eBrowserMainWindow::selectdir);
}
void eBrowserMainWindow::selectdir(eListBoxEntryText *item)
{
folder = item->getText();
if(strcmp("[eine Ebene nach oben]", eString().sprintf("%s",folder.c_str()).c_str()) == 0){
//strcut
int n = strlen(PATH);
while(PATH[n-2] != '/'){
n--;
}
PATH[n-1] = '\0';
makelist();
}
else{
strcat(PATH, eString().sprintf("%s/",folder.c_str()).c_str());
makelist();
}
}
void eBrowserMainWindow::selectionChanged(eListBoxEntryText *item)
{
if (item){
folder = item->getText();
if(strcmp("[eine Ebene nach oben]", eString().sprintf("%s",folder.c_str()).c_str()) == 0){
status->setText("cd ..");
select->hide();
}
else{
status->setText(item->getText());
select->show();
}
}
}
void eBrowserMainWindow::makelist()
{
int n=-1;
DIR *dir = opendir(PATH);
char PATHSHOW[256];
strcpy(PATHSHOW, PATH);
PATHSHOW[strlen(PATHSHOW)-1] = '\0';
if (dir == 0) {
eMessageBox msg(("I/O Fehler"), "Fehler", eMessageBox::iconError|eMessageBox::btOK);
msg.show();
msg.exec();
msg.hide();
eWidget::accept();
}
else{
if(NULL != dir){
setText(PATHSHOW);
theList->beginAtomic();
theList->clearList();
if(strcmp("/",PATH) != 0){
new eListBoxEntryText(theList, "[eine Ebene nach oben]", (void *) (n++));
select->hide();
status->setText("cd ..");
}
else{
setText(PATH);
select->show();
}
struct dirent *entry;
for(; NULL != (entry = readdir(dir)); ){
struct stat st;
// Skip dots
if( '.' == entry->d_name[0] && ( '\0' == entry->d_name[1] || ( '.' == entry->d_name[1] &&'\0' == entry->d_name[2]))){
// do nothing
}
else{
if(0 == stat((string(PATH) + entry->d_name).c_str(), &st)){
if(S_IFDIR == (st.st_mode & S_IFDIR)){
new eListBoxEntryText(theList, entry->d_name, (void *) (n++));
if(n == 0)status->setText(entry->d_name);
}
}
}
}
closedir(dir);
//eListBoxEntry *cur;
//cur = theList->getCurrent();
theList->endAtomic();
setFocus(theList);
}
}
}
void eBrowserMainWindow::selectfolder()
{
eMessageBox msg((strcat(PATH, eString().sprintf("%s",status->getText().c_str()).c_str())), "gewählt", eMessageBox::iconInfo|eMessageBox::btOK);
msg.show();
msg.exec();
msg.hide();
eWidget::accept();
}
eBrowserMainWindow::~eBrowserMainWindow()
{
}
Alles anzeigen
Bin dankbar für Hilfe.
Gruß Emanuel
Hi dcdead,
ja so was hab ich mir schon gedacht.
so wie in sselect.cpp da ist es halt so aufgehäuft,
dass ich den Überblick verliere mit meinen Kenntnissen
hast Du den Quelltext noch?
bzw. diesen speziellen Teil?
Gruß Emanuel
Gruß Emanuel
Hi alle,
Kann ich in eine Listbox Pixmaps laden.
Bin dankbar für Hilfe
Emanuel
Hi Danke,
Ist eString Enigma?
bzw. gibt es eine Syntaxbeschreibung?
oder nur die *.h files?
Emanuel
Nun ist der Wurm raus,
aber ob das mit den char und eString so gut ist?
Bin für gute Ratschläge dankbar.
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <plugin.h>
#include <lib/gui/ewindow.h>
#include <lib/gui/elabel.h>
#include <lib/gui/ebutton.h>
#include <lib/gui/emessage.h>
#include <lib/gui/listbox.h>
using namespace std;
class eBrowserMainWindow: public eWindow
{
char PATH[256];
eLabel *label;
eListBox<eListBoxEntryText> *theList;
void makelist();
void selectdir(eListBoxEntryText *item);
public:
eBrowserMainWindow();
~eBrowserMainWindow();
};
extern "C" int plugin_exec( PluginParam *par )
{
eBrowserMainWindow dlg;
dlg.show();
int result=dlg.exec();
dlg.hide();
return result;
}
eBrowserMainWindow::eBrowserMainWindow(): eWindow(1)
{ strcpy(PATH,"/var/");
cmove(ePoint(100, 100));
cresize(eSize(520, 376));
setText("Datei wählen");
label=new eLabel(this);
label->move(ePoint(5, 5));
label->resize(eSize(400, 60));
label->setText("Datei wählen:");
theList = new eListBox<eListBoxEntryText>(this);
theList->move(ePoint(5, 30));
theList->resize(eSize(clientrect.width() - 10, clientrect.height() - 50));
theList->loadDeco();
theList->setColumns(1);
makelist();
CONNECT(theList->selected, eBrowserMainWindow::selectdir);
}
void eBrowserMainWindow::selectdir(eListBoxEntryText *item)
{
eString message, folder;
folder = item->getText();
message = "Auswahl:\n " + folder;
eMessageBox msg((message), "Info", eMessageBox::iconInfo|eMessageBox::btOK);
msg.show();
msg.exec();
msg.hide();
if(strcmp("[eine Ebene nach oben]", eString().sprintf("%s",folder.c_str()).c_str()) == 0){
//strcut
int n = strlen(PATH);
while(PATH[n-2] != '/'){
n--;
}
PATH[n-1] = '\0';
makelist();
}
else{
strcat(PATH, eString().sprintf("%s/",folder.c_str()).c_str());
makelist();
}
}
void eBrowserMainWindow::makelist()
{
int n=1;
DIR *dir = opendir(PATH);
if (dir == 0) {
eMessageBox msg(("I/O Fehler"), "Fehler", eMessageBox::iconError|eMessageBox::btOK);
msg.show();
msg.exec();
msg.hide();
eWidget::accept();
}
else{
if(NULL != dir){
theList->beginAtomic();
theList->clearList();
if(strcmp("/",PATH) != 0)
new eListBoxEntryText(theList, "[eine Ebene nach oben]", (void *) (0));
struct dirent *entry;
for(; NULL != (entry = readdir(dir)); ){
struct stat st;
// Skip dots
if( '.' == entry->d_name[0] && ( '\0' == entry->d_name[1] || ( '.' == entry->d_name[1] &&'\0' == entry->d_name[2]))){
// do nothing
}
else{
if(0 == stat((string(PATH) + entry->d_name).c_str(), &st)){
if(S_IFDIR == (st.st_mode & S_IFDIR)){
new eListBoxEntryText(theList, entry->d_name, (void *) (n));
n++;
}
}
}
}
closedir(dir);
theList->endAtomic();
setFocus(theList);
}
}
}
eBrowserMainWindow::~eBrowserMainWindow()
{
}
Alles anzeigen
Gruß Emanuel
Das muss noch raus sonst habe ich einen Pfad der unendlich lang wird:
/var/ -> /var/../ -> /var/.../hdd/ usw.
statt: /hdd
wie es eigentlich sein sollte.
Emanuel
Hi an alle,
1. Wie kann ich den Namen eines Plugin abfragen?
int main(int argc , char *argv[]) <-- Ich kann das in C hier auslesen
aber die extern "C" int plugin_exec( PluginParam *par )
*par sind wohl nicht das gleiche.
2. kann ich ein Plugin durch ein sh Kommando starten?
Gruß Emanuel
Hi dre,
Danke, ja es läuft jetzt endlich, =) =)
aber noch immer nicht sauber.
schau Dir mal den Verzeichniswechsel an,
da kommt irgend wie Mist raus, das wechselt noch nicht sauber.
Vielleicht gib es ein Problem bei der char Verarbeitung:
strcat(PATH, eString().sprintf("%s/",message2.c_str()).c_str());
Ich kenne mich in C++ so gut wie gar nicht aus.
Gruß Emu
Hi tyrel,
Vielleicht weiß Du Rat:
Ich will mit eine Listbox einen Dateibrowser bauen.
Das Neuladen der Listboxeinträge bereitet mir Probleme: DB->crashdownreboot.
Ich weiß nicht was ich falsch mache?
#include <algorithm>
#include <string>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <plugin.h>
#include <lib/gui/ewindow.h>
#include <lib/gui/elabel.h>
#include <lib/gui/ebutton.h>
#include <lib/gui/emessage.h>
#include <lib/gui/listbox.h>
using std::copy;
using std::string;
class eBrowserMainWindow: public eWindow
{
char PATH[256];
eLabel *label;
eListBox<eListBoxEntryText> *theList;
void makelist();
void selectdir(eListBoxEntryText *item);
public:
eBrowserMainWindow();
~eBrowserMainWindow();
};
extern "C" int plugin_exec( PluginParam *par )
{
eBrowserMainWindow dlg;
dlg.show();
int result=dlg.exec();
dlg.hide();
return result;
}
eBrowserMainWindow::eBrowserMainWindow(): eWindow(1)
{ strcpy(PATH,"/var/");
cmove(ePoint(100, 100));
cresize(eSize(520, 376));
setText("Datei wählen");
label=new eLabel(this);
label->move(ePoint(5, 5));
label->resize(eSize(400, 60));
label->setText("Datei wählen:");
theList = new eListBox<eListBoxEntryText>(this);
theList->move(ePoint(5, 30));
theList->resize(eSize(clientrect.width() - 10, clientrect.height() - 50));
theList->loadDeco();
theList->setColumns(1);
makelist();
}
void eBrowserMainWindow::selectdir(eListBoxEntryText *item)
{
eString message, message2;
message2 = item->getText();
message = "Auswahl:\n " + message2;
eMessageBox msg((message), "Info", eMessageBox::iconInfo|eMessageBox::btOK);
msg.show();
msg.exec();
msg.hide();
strcat(PATH, eString().sprintf("%s/",message2.c_str()).c_str());
////////////////////////////////////////////////////////////////////////////////
///// zweiter Aufruf von makelist() endet mit CRASH!!
////////////////////////////////////////////////////////////////////////////////
makelist();
}
void eBrowserMainWindow::makelist()
{
DIR *dir = opendir(PATH);
eMessageBox msg((PATH), "Info", eMessageBox::iconInfo|eMessageBox::btOK);
msg.show();
msg.exec();
msg.hide();
int n=0;
if (dir == 0) {
eMessageBox msg(("I/O Fehler"), "Fehler", eMessageBox::iconError|eMessageBox::btOK);
msg.show();
msg.exec();
msg.hide();
eWidget::accept();
}
else{
if(NULL != dir){
theList->beginAtomic();
theList->clearList();
struct dirent *entry;
for(; NULL != (entry = readdir(dir)); ){
struct stat st;
// Skip dots
if(('.' == entry->d_name[0]) && ( '\0' == entry->d_name[1])){
// do nothing
}
else{
if(0 == stat((string(PATH) + entry->d_name).c_str(), &st)){
if(S_IFDIR == (st.st_mode & S_IFDIR)){
new eListBoxEntryText(theList, entry->d_name, (void *) (n));
n++;
}
}
}
}
closedir(dir);
theList->endAtomic();
CONNECT(theList->selected, eBrowserMainWindow::selectdir);
setFocus(theList);
}
}
}
eBrowserMainWindow::~eBrowserMainWindow()
{
}
Alles anzeigen
beim 2. Aufruf von makelist() ist es aus ich sehe noch das nächste Verzeichniss
Gruß Emanuel
Hi tyrel,
schau Dir mal die Zeile 112 an ...
*
+--------------------------------------------------------------------------
| The Bible Enigma1 Tutorial
| ========================================
| By: Bacicciosat aka Meo aka Luponero
|
| Enigma 1 API GUI tutorial whith Sources Code and Comments
| (c) august 2006 by Meo
|
+---------------------------------------------------------------------------
*/
#include <plugin.h>
#include <stdio.h>
#include <lib/gui/ewindow.h>
#include <lib/gui/elabel.h>
#include <lib/gui/ebutton.h>
#include <lib/gui/emessage.h>
#include <lib/gui/listbox.h>
#include <lib/gui/combobox.h>
// The Class declaration of our Main Window
class eBibleMainWindow: public eWindow
{
// the label to show the text
eLabel *label;
// the listbox
eListBox<eListBoxEntryText> *theList;
// the combobox
eComboBox *Lang;
// function to execute whwn button is pushed
void message1();
public:
// the constructor.
eBibleMainWindow();
// the destructor.
~eBibleMainWindow();
};
// The plugin entry point, Here start the code execution
extern "C" int plugin_exec( PluginParam *par )
{
// our demo dialog instance.
eBibleMainWindow dlg;
// show the dialog...
dlg.show();
// give control to dialog.. (the dialog is modal!)
int result=dlg.exec();
// and after it, hide it again.
dlg.hide();
eMessageBox msg("Apache Status speichern...", "Speichern", eMessageBox::iconWarning|eMessageBox::btOK);
msg.show(); msg.exec(); msg.hide();
return result;
}
eBibleMainWindow::eBibleMainWindow(): eWindow(1)
{
// move our dialog to 100.100...
cmove(ePoint(100, 100));
// ...and give x and y dimensions.
cresize(eSize(520, 376));
// set a title.
setText("Enigma Bible Lesson 7: Combobox");
// create a label to show a text.
label=new eLabel(this);
// give a position
label->move(ePoint(50, 50));
// set the label dimensions
label->resize(eSize(400, 60));
// set the label text
label->setText("Select your language");
// Create the Combobox
Lang=new eComboBox(this, 4);
// Populate the Combobox with a List of Items
new eListBoxEntryText(*Lang, "English", (void *) (0));
new eListBoxEntryText(*Lang, "French", (void *) (1));
new eListBoxEntryText(*Lang, "Italian", (void *) (2));
new eListBoxEntryText(*Lang, "Dutch", (void *) (3));
// set Combobox position
Lang->move(ePoint(50, 160));
// Combo dimensions
Lang->resize(eSize(clientrect.width()-120, 35));
// set the default entry of Combobox to the first element of the list
Lang->setCurrent(0);
// decore Combo with a frame
Lang->loadDeco();
// create button and set properties
eButton * ok = new eButton(this);
ok->setText("Show");
ok->move(ePoint((clientrect.width() - 90)/2, clientrect.height() - 60));
ok->resize(eSize(100, 40));
ok->setShortcut("green");
ok->setShortcutPixmap("green");
ok->loadDeco();
// function to call when button is pushed
CONNECT(ok->selected, eBibleMainWindow::message1);
// set focus to the Combobox
setFocus(Lang);
}
void eBibleMainWindow::message1()
{
// declare variable we will use in this function
eString message, message2;
// assign to message2 the selected item text
message2 = Lang->getCurrent()->getText();
// compose message concatenating strings
message = "Your Language is:\n " + message2;
// Create, show and execute the messagebox to display the message
eMessageBox msg((message), "Info", eMessageBox::iconInfo|eMessageBox::btOK);
msg.show();
msg.exec();
msg.hide();
}
eBibleMainWindow::~eBibleMainWindow()
{
// we have to do almost nothing here. all widgets are automatically removed
// since they are child of us. the eWidget-destructor will to this for us.
}
Alles anzeigen
***** with special thanks to the autor of this tutorial ...
Gruß emanuel
Hi Ghost,
Vielen Danke noch mal!!
Jetzt habe ich Zugriff auf den Button. Uiii
Gruß Emanuel
Danke Ghost,
Ich teste es heute Abend gleich!
Gruß Emanuel :]
Hi Ghost,
Ich stehe mit C++ eher auf Kriegsfuß,
könntest Du mir bitte weiterhelfen?
Gruß Emanuel
Hi dre,
im CVS ist eh fast alles selbstgestrickt aus eWidget.
Das ist dann so eine Headerjagt ( für mich als Nicht-C++er nicht gerade übersichtlich).
Das ist der zusammengeklebte Pixmapbutton läuft ohne eWidgetheader, ich kann in der Funktion sein Label ändert:
#include <plugin.h>
#include <stdio.h>
#include <lib/gui/ewindow.h>
#include <lib/gui/elabel.h>
#include <lib/gui/ebutton.h>
#include <lib/gui/emessage.h>
#include <lib/gui/eskin.h>
#include <lib/gdi/gfbdc.h>
#include <lib/gdi/epng.h>
// The Class declaration of our Main Window
class ePixMainWindow: public eWindow
{
// the label to show the text
eButton *btnfindpath;
void action();
public:
// the constructor.
ePixMainWindow();
// the destructor.
~ePixMainWindow();
};
// The plugin entry point, Here start the code execution
extern "C" int plugin_exec( PluginParam *par )
{
// our demo dialog instance.
ePixMainWindow dlg;
// show the dialog...
dlg.show();
// give control to dialog.. (the dialog is modal!)
int result=dlg.exec();
// and after it, hide it again.
dlg.hide();
return result;
}
ePixMainWindow::ePixMainWindow(): eWindow(1)
{
eString icon, folder;
icon = "/share/tuxbox/enigma/pictures/<HIER STEHT NORMAL: gem*** (Bordregeln)>_blueline/folder.png";
folder = "/var/tuxbox";
gPixmap *img = loadPNG(icon.c_str());
// move our dialog to 100.100...
cmove(ePoint(100, 100));
// ...and give x and y dimensions.
cresize(eSize(520, 376));
// set a title.
setText("Pixmapbutton");
btnfindpath = new eButton(this);
if(img)
{ gPixmap * mp = &gFBDC::getInstance()->getPixmap();
gPixmapDC mydc(img);
gPainter p(mydc);
p.mergePalette(*mp);
btnfindpath->move(ePoint(5, 50));
btnfindpath->resize(eSize(400, 40));
btnfindpath->setBlitFlags(BF_ALPHATEST);
btnfindpath->setProperty("align", "center");
btnfindpath->setPixmap(img);
btnfindpath->setPixmapPosition(ePoint(40, 6));
btnfindpath->loadDeco();
btnfindpath->setText(folder);
CONNECT(btnfindpath->selected, ePixMainWindow::action);
setFocus(btnfindpath);
}
else
{ eMessageBox msg(_("Error loading icon"), _("Error"), eMessageBox::iconWarning|eMessageBox::btOK);
msg.show(); msg.exec(); msg.hide();
}
}
void ePixMainWindow::action()
{
eString newfolder;
newfolder = "/var";
btnfindpath->setText(newfolder);
this->show();
}
ePixMainWindow::~ePixMainWindow()
{
// we have to do almost nothing here. all widgets are automatically removed
// since they are child of us. the eWidget-destructor will to this for us.
}
Alles anzeigen
zum hide() in Testdialog:
muss ich noch testen hide im Main. Nutzt mir aber nicht viel.
Ich muss den ja durch ein Buttonfunktion ausschalten.
Gruß Emanuel