Can Moi Buttons in HTM files execute code in the assoicated JS file

Next
 From:  fcwilt
11713.1 
Hi Michael,

In one of your example files you have this:

<moi:PushButton id="doit" onclick="message.style.display = 'block';">Click Me!</moi:PushButton>

but all it appeared to do was to modify the displayed HTML.

Is there a way to have buttons execute code in the associated script file?

My current HTM file contains a drop-down combo to select what happens when the Done button is clicked.

But it would be slightly more efficient if there were just three buttons, one for each action, rather than picking the action and then clicking the Done button.

Thanks

Frederick
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11713.2 In reply to 11713.1 
Hi Frederick, yes when a UI control is clicked it will generate a UI event with the control's id value.

That will cause the script's event loop to wake up and it can do something in response.

Here's an example.

- Michael
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  fcwilt
11713.3 In reply to 11713.2 
Hi Michael,

Thanks once again.

I looked through my notes and examples but could not find the answer on my own.

I had this code from an example:

if ( commandDialog.event == 'done' ) {

but I didn't make the connection that the 'done' was the ID of the Done button.

So, using your example I replaced the drop-down combo with buttons and like it much better.

Question: Is there a way to control the size/position of the buttons to tidy them up ?

Frederick

EDITED: 16 Apr by FCWILT

Image Attachments:
Size: 23.3 KB, Downloaded: 2 times, Dimensions: 219x274px
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11713.4 In reply to 11713.3 
Hi Frederick,

re:
> Question: Is there a way to control the size/position of the buttons to tidy them up ?

Yes, there are various different ways you can do that. Could you describe how you want them arranged and post your current .htm ?

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  fcwilt
11713.5 In reply to 11713.4 
Hi Michael,

I would be happy if all three of my buttons (Save, Restore, Clear) could be the same size and on the same "row".

And if there could be some space between them and the text field/check box above, and the Done/Cancel buttons below.

I tried using standard HTML attributes but they didn't seem to have any effect.

Frederick
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11713.6 In reply to 11713.5 
Hi Frederick,

re:
> I tried using standard HTML attributes but they didn't seem to have any effect.

What standard HTML attributes did you try?

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11713.7 In reply to 11713.5 
Hi Frederick,

re:
> I would be happy if all three of my buttons (Save, Restore, Clear) could
> be the same size and on the same "row".

This isn't really feasible because if they all grow to the same width as the widest ("Restore") that would take up more than the available horizontal width.

There is room for them to fit in one row if you allow the "Save" and "Clear" buttons to be smaller than "Restore", I've attached a setup like that.


> And if there could be some space between them and the text field/check box above, and the Done/Cancel buttons below.

In the attached example I put the buttons in a container and set a margin on the container to do that.

- Michael
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  fcwilt
11713.8 In reply to 11713.7 
Hi Michael,

Thank you.

I am learning and enjoying it.

I'm a little unclear of why standard HTML attributes (like width) work on some things but not others.

I'm guessing that the MoI specific things, like moi.PushButton, don't support such attributes?

I tested your version and it's really a big improvement.

Now I have to study it to try and understand what is going on.

Thanks.

Frederick
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  fcwilt
11713.9 In reply to 11713.7 
Hi Michael,

Here are both the JS and the HTM files for my "Visible Sets" feature.

I haven't tried to optimize the JS file, so I imagine there are more efficient ways to do things, but it works and does what I wanted.

Thanks again for all you help.

I am now going to apply what I have learned and create my "Selection Sets" and "Export Sets" features.

When I'm done with those I am going to celebrate a bit.

Then I am going to dig into the "Bolts" files and see if I can figure out how they work.

Frederick
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11713.10 In reply to 11713.8 
Hi Frederick,

re:
> I'm a little unclear of why standard HTML attributes (like width) work on some things but not others.

Width as a direct attribute on an element is basically antique and isn't standard
anymore. It only works on a few element types.

The standard way to set a width is by the CSS width property:

<div style="width: 200px"><div>

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  fcwilt
11713.11 In reply to 11713.10 
Hi Michael,

Well, it has been over 20 years since I did any programming for which I got paid.

The last HTML work I did was before JSON was an acronym and anything I once knew about CSS is long gone other than remembering what is stands for.

I just dumped the last of my manuals from my working days but they were likely too old to be any help.

Time to re-educate myself.

Thanks.

Frederick
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All