Project

General

Profile

Actions

Support #1328

closed
PG WD

dynamic links

Support #1328: dynamic links

Added by Paweł Grzybowski over 14 years ago. Updated about 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
-
Start date:
06/19/2012
Due date:
% Done:

0%

Estimated time:

Description

Hi,
I would like to know how to make dynamic links and dynamic for example WPushButton.

WD Updated by Wim Dumon over 14 years ago Actions #1

Not sure what you want. Can you give an example?

PG Updated by Paweł Grzybowski over 14 years ago Actions #2

I don't know how to make it in wt so I give you an example in PHP

for($i;$i<10;$i) {echo'Next'};

and the second example in PHP

for($i;$i<10;$i) {echo '';}

PG Updated by Paweł Grzybowski over 14 years ago Actions #3

I don't know how to make it in wt so I give you an example in PHP

for($i;$i<10;$i) {echo'Next'};

and the second example in PHP

for($i;$i<10;$i) {echo '';}

PG Updated by Paweł Grzybowski over 14 years ago Actions #4

I don't know how to make it in wt so I give you an example in PHP

for($i;$i<10;$i) {echo'Next'};

and the second example in PHP

for($i;$i<10;$i) {echo '';}

WD Updated by Wim Dumon over 14 years ago Actions #5

The equivalent would be:

for(int i = 0; i < 100; ++i)
  new WAnchor("next.php?w=" + std::lexical_cast<std::string>(i), "Next", this);

That's for the case that you want your anchor to point to whatever URL's (in this case: some php that could be anywhere).

Using buttons, allow me to demonstrate Wt's style of responding to events, such as mouse clicks:

MyWidgt::MyWidget(/* parameters come here */)
{
  for(int i = 0; i < 100; ++i) {
    WPushButton *b = new WPushButton("Button " + boost::lexical_cast<std::string>(i), this);
    // When button is clicked, call buttonClicked with parameter i identifying the clicked button
    b->clicked().connect(boost::bind(&MyWidget::buttonClicked, this, i));
  }
}

void MyClass::buttonClicked(int i)
{
  // Write anything that you want to happen when someone clicks the button here
  // In this case: add extra text to the DOM
  new WText("You clicked button " + boost::lexical_cast<std::string>(i), this);
}

KD Updated by Koen Deforche over 14 years ago Actions #6

  • Status changed from New to InProgress
  • Assignee set to Wim Dumon

WD Updated by Wim Dumon about 14 years ago Actions #7

  • Status changed from InProgress to Closed
Actions

Also available in: PDF Atom