Markup Dynamic |
Post Reply |
Author | |
Jose5
Groupie Joined: 07 June 2005 Location: United States Status: Offline Points: 17 |
Post Options
Thanks(0)
Posted: 23 January 2009 at 1:39pm |
Question to CodeJock Techs
what i Call Dynamic is a way to create a template example <Grid... <StackPanel .... <Dynamic.1></Dynamic.1> </StackPanel from the CXTPMarkupBuilder::Parse { switch(t)... case CXTPMarkupParser::tokenTagEnd: ... if(wcsncmp(lpszTagName), L"Dynamic ",7) == 0) Call Owner via a SendMessage with StackPanel object as WPARAM and Builder as LPARAM ... } Owner::OnDynamicAdd(WPARAM wParam, LPARAM lParam) { CXTPMarkupStackPanel* pObject = (CXTPMarkupStackPanel*)wParam; CXTPMarkupBuilder * Builder = (CXTPMarkupBuilder *)lParam; CXTPMarkupTextBlock* pTextBlock1 = MARKUP_CREATE(CXTPMarkupTextBlock,this); pTextBlock1->SetTextWrapping(1); pTextBlock1->SetText(L"You can increment or decrement the value of this" L"textbox by simply clicking the mouse, hold and drag" L"up or down, right or left. Release when happy,with the value."); pTextBlock1->SetMargin(5, 0, 5, 0); pTextBlock1->SetBackground(new CXTPMarkupSolidColorBrush(RGB(0xFF, 0, 0))); pTextBlock1->SetForeground(new CXTPMarkupSolidColorBrush(RGB(0xFF, 0xFF, 0xFF))); pObject->GetChildren()->Add(pTextBlock1); } hope is not to confusing just a better wat to fill in the markup dynamically thanks guys |
|
IT WASENT ME!!!
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
You almost find solution :)
Here how it should work.
1. We add new class and register its Tag:
class CMyDynamicMarkup : public CXTPMarkupGrid
{ DECLARE_MARKUPCLASS(CMyDynamicMarkup) void SetContentObject(CXTPMarkupBuilder* pBuilder, CXTPMarkupObject* pContent);
}; IMPLEMENT_MARKUPCLASS(L"Dynamic", CMyDynamicMarkup, CXTPMarkupGrid);
void CMyDynamicMarkup::RegisterMarkupClass()
{ } 2 Add your dynamic code in SetContentObject
void CMyDynamicMarkup::SetContentObject(CXTPMarkupBuilder* pBuilder, CXTPMarkupObject* pContent)
{ if (IsStringObject(pContent)) { // Here we can use content as parameter; CXTPMarkupTextBlock* pTextBlock1 = MARKUP_CREATE(CXTPMarkupTextBlock,pBuilder->GetMarkupContext()); pTextBlock1->SetTextWrapping(1); pTextBlock1->SetText(L"You can increment or decrement the value of this" L"textbox by simply clicking the mouse, hold and drag" L"up or down, right or left. Release when happy,with the value."); pTextBlock1->SetMargin(5, 0, 5, 0); pTextBlock1->SetBackground(new CXTPMarkupSolidColorBrush(RGB(0xFF, 0, 0))); pTextBlock1->SetForeground(new CXTPMarkupSolidColorBrush(RGB(0xFF, 0xFF, 0xFF))); GetChildren()->Add(pTextBlock1); }
} 3. And Markup is
<Page>
<Dynamic>parameter</Dynamic> </Page> |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Jose5
Groupie Joined: 07 June 2005 Location: United States Status: Offline Points: 17 |
Post Options
Thanks(0)
|
what if you want to replace with a row of may be elements
like so void CMyDynamicMarkup::SetContentObject(CXTPMarkupBuilder* pBuilder, CXTPMarkupObject* pContent) { if (IsStringObject(pContent)) { // Here we can use content as parameter; for(int x=0;x<10;x++) { CXTPMarkupTextBlock* pTextBlock1 = MARKUP_CREATE(CXTPMarkupTextBlock,pBuilder->GetMarkupContext()); pTextBlock1->SetTextWrapping(1); pTextBlock1->SetText(L"1You can increment or decrement the value of this" L"textbox by simply clicking the mouse, hold and drag" L"up or down, right or left. Release when happy,with the value."); pTextBlock1->SetMargin(5, 0, 5, 0); pTextBlock1->SetBackground(new CXTPMarkupSolidColorBrush(RGB(0xFF, 0, 0))); pTextBlock1->SetForeground(new CXTPMarkupSolidColorBrush(RGB(0xFF, 0xFF, 0xFF))); if(pTextBlock1) GetChildren()->Add(pTextBlock1); } } } |
|
IT WASENT ME!!!
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Sorry, I don't get question.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Jose5
Groupie Joined: 07 June 2005 Location: United States Status: Offline Points: 17 |
Post Options
Thanks(0)
|
well
let say in my template i have something like <Dynamic id=1></Dynamic> witch is already declare name space i want to display many item from within the CMyDynamicMarkup::SetContentObject(CXTPMarkupBuilder* pBuilder, CXTPMarkupObject* pContent) { CXTPMarkupObject* parentContent = CXTPMarkupStackPanel (?); add 10 row return the question how to get the parent CXTPMarkupStackPanel class } |
|
IT WASENT ME!!!
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |