Hacker News new | past | comments | ask | show | jobs | submit login

> It is really hard to describe just how much better Tk was than anything else in the time frame.

This[0] vs (from memory w/o a computer atm…):

  #!/bin/env wish
  button .b
  .b configure -text “push me” -action {puts “don’t push me!”}
  pack .b

[0] https://users.cs.cf.ac.uk/Dave.Marshall/X_lecture/node5.html...

======

  #include <Xm/Xm.h> 
  #include <Xm/PushB.h>

  /* Prototype Callback function */

  void pushed_fn(Widget, XtPointer, XmPushButtonCallbackStruct *);


  main(int argc, char **argv) 

  {   Widget top_wid, button;
    XtAppContext  app;
   
    top_wid = XtVaAppInitialize(&app, "Push", NULL, 0, &argc, argv, NULL, NULL);

    button = XmCreatePushButton(top_wid, "Push_me", NULL, 0);
     /* tell Xt to manage button */
   XtManageChild(button);
         
  /* attach fn to widget */
    XtAddCallback(button, XmNactivateCallback, pushed_fn, NULL);

    XtRealizeWidget(top_wid);    /* display widget hierarchy */
    XtAppMainLoop(app); /* enter processing loop */ 

  }

  void pushed_fn(Widget w, XtPointer client_data, XmPushButtonCallbackStruct *cbs) 
  {   
     printf("Don't Push Me!!\n");
  }





-command instead of -action, but otherwise perfect! :)

I also used the wrong path for /usr/bin/env ;)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: