build a customgui for LONG
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/09/2004 at 07:20, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.207
Platform: Windows ;
Language(s) : C++ ;---------
I want to make a customgui for LONG values, kind of progress bar I can just set by the LONG value. I sucessfully designed a customgui together with a custom data type before, but here I have problems.
First of all: Is it possible to make a customgui without custom data type? The data would only be a LONG value, so it would be nice to use LONG.
Take a look at this code ( just displaying a number for testing, only the cpp part ). My problem: iCustomGui::SetData is never called.
class grProgressBarGui : public iCustomGui
grProgressBarGui::grProgressBarGui( const BaseContainer &settings, CUSTOMGUIPLUGIN *plugin ) :
iCustomGui( settings, plugin ) {
}
LONG grProgressBarGui::GetCustomGuiWidth( ){
return 100;
}
LONG grProgressBarGui::GetCustomGuiHeight( ) {
return 100;
}
void grProgressBarGui::CustomGuiRedraw( ) {}
Bool grProgressBarGui::SetDefaultForResEdit( ) {
return TRUE;
}
Bool grProgressBarGui::SetData( const TriState<GeData>& tristate ) {
m_progress = tristate.GetValue().GetLong();
return InitValues();
}
void grProgressBarGui::LayoutModeChanged( ) {
}
Bool grProgressBarGui::SupportLayoutSwitch( ) {
return TRUE;
}
Bool grProgressBarGui::CreateLayout( )
{
AddEditNumber( 25000, 0 );
return TRUE;
}
Bool grProgressBarGui::Command( LONG id, const BaseContainer &msg )
{
return TRUE;
}
Bool grProgressBarGui::InitValues( void ) {SetLong( 25000, m_progress );
return TRUE;
}
TriState<GeData> grProgressBarGui::GetData( ) {
return GeData( m_progress );
}
class grProgressBarDialog : public CustomGuiData
#include "grProgressBarDialog.h"
#include "grProgressBarGui.h"
#define D_symbol "PROGRESSBAR"
static LONG restypetable[] = { DA_LONG };
grProgressBarDialog::grProgressBarDialog( ) {
m_properties.type = CUSTOMTYPE_END;
m_properties.id = 0;
m_properties.ident = NULL;
}
grProgressBarDialog::~grProgressBarDialog( ) {}
LONG grProgressBarDialog::GetId( ) {
return 1000009;
}
CDialog* grProgressBarDialog::Alloc( const BaseContainer& settings ) {grProgressBarGui* dlg = gNew grProgressBarGui( settings, GetPlugin() );
if ( !dlg ) return NULL;
CDialog *cdlg = dlg->Get();
if ( !cdlg ) return NULL;
return cdlg;
}
void grProgressBarDialog::Free( CDialog* dlg, void* userdata ) {
if ( !dlg || !userdata ) return;
grProgressBarGui* sub = static_cast<grProgressBarGui*>( userdata );
gDelete( sub );
}
CHAR* grProgressBarDialog::GetResourceSym() {
return D_symbol;
}
CustomProperty* grProgressBarDialog::GetProperties( ) {
return &m_properties;
}
LONG grProgressBarDialog::GetResourceDataType( LONG*& table ) {
table = restypetable;
return sizeof( restypetable ) / sizeof( LONG );
} -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/09/2004 at 07:22, xxxxxxxx wrote:
ah, and I include it in my dialog by
PROGRESSBAR IDC_PROGRESS_WIZARD { }
and call
SetLong( IDC_PROGRESS_WIZARD, 50 );
to set the value...but this call never reaches SetData -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/09/2004 at 12:41, xxxxxxxx wrote:
Most of your code looks right. I think the problem is that the dialog cannot use SetLong() with custom gui elements, only with built-in edit boxes and sliders. In a description you would be able to use your gui with a long. A workaround is to use FindCustomGui() and BaseCustomGui::SetData().