Ok, asume wath is of type *char then
CDBListView *listView = dynamic_cast<CDBListView *>(w);
if (!listView) return;
if (!dataDialog) return;
char* IDPersona;
int ixData;
ixData = (int)listView->data();
IDPersona = (char *)ixData ;
printf("id: %s\n",IDPersona); // COMPILE BUT THIS LINE NOT WORK
why?
From: "Alexey Parshin" <alexeyp@gmail.com> Reply-To: SPTK discussion <sptk@total-knowledge.com> To: "SPTK discussion" <sptk@total-knowledge.com> Subject: Re: Question About CDialog class Date: Fri, 2 Jun 2006 11:33:44 +1000 In your code, you are reading and setting the data from the controls(widgets) using value(). In SPTK, you should use the method data() instead. So, this code: ////AND THIS LINE txt_ID-> ???????? txt_Nombre->value(ps[0]); txt_Depto->value(ps[2]); txt_Cargo->value(ps[3]); becomes: txt_ID->data( listView2.data() ); txt_Nombre->data(ps[0]); txt_Depto->data(ps[2]); txt_Cargo->data(ps[3]); If your compiler complains in: txt_ID->data( listView2.data() ); the use: txt_ID->data( (int) listView2.data() ); 2006/6/2, HERNAN LAGRAVA <hernanjls@hotmail.com>:Thanks one consult more view the code CDBListView listView2("List View:",10,SP_ALIGN_CLIENT); listView2.database(&db); listView2.sql("SELECT * FROM tbl_Persons order by Name"); ///THIS listView2.keyField("IdPerson"); try { listView2.refreshData(); } catch (CException& e) { printf("Exception: %s\n",e.text().c_str()); } ........ ....... .MORE CODE listView2.callback(cb_show_data); ....................... ...................... MORE CODE static void cb_show_data(Fl_Widget *w,void *user_data) { CDBListView *listView = dynamic_cast<CDBListView *>(w); if (!listView) return; CPackedStrings& ps = listView->selectedRow(); if (listView->eventType() == CE_DATA_CHANGED) { ////AND THIS LINE txt_ID-> ???????? txt_Nombre->value(ps[0]); txt_Depto->value(ps[2]); txt_Cargo->value(ps[3]); } } In txt_ID-> ???????? I desire view "IdPerson" value (Key defined in listView2.keyField("IdPerson")) How i view? Thanks Alexey Exist one book about the library? forums? >From: "Alexey Parshin" <alexeyp@gmail.com> >Reply-To: SPTK discussion <sptk@total-knowledge.com> >To: "SPTK discussion" <sptk@total-knowledge.com> >Subject: Re: Question About CDialog class >Date: Fri, 2 Jun 2006 07:53:06 +1000 > >Hernan, > >CDialog class allows you to overwrite its virtual method save(). In this >method, you may read the data from the controls using their field names, >and >execute SQL queries of your choice. > >2006/6/2, HERNAN LAGRAVA <hernanjls@hotmail.com>: >> >> >> >>Hello >> >> >>I am proving library SPTK and it seems to me excelent, also the >>examples are very useful, but I have a question: >> >>the CDialog class has examples to edit records but i am not find >>examples to insert or to delete records whit this class, additionally to >>know how >>to me if elaborated examples exist to analyze code >> >>thanks . >> >> >> > > >-- >Alexey Parshin, >http://www.sptk.net-- Alexey Parshin, http://www.sptk.net
List hosted by Total Knowledge