From: Schollnick, B. <Ben...@us...> - 2004-06-21 14:05:38
|
> > I'm probably missing something simple here.... > > > You could use a custom dialog, and use an HTMLWindow inside > it. If you even > need it to be a dialog - might be just as easy to display the > file within > the primary window ? Maybe a silly question... But I do not see a easy way to make a custom dialog? I guess I could power up resourceditor, make a "second" application that looks like a custom dialog... But I would think there has to be a simple way to do that? The goal here is: * Switch to a monospaced font. The Scrolled Window font is completely ruining any "table" design that I setup due to the non-monospaced font... I just looked again and there is no wxpython nor pythoncard documentation that talks about setting up the font for those dialogs... * Maybe some other font "goodies"... HTML would be nice, but is not necessary.... - Benjamin |
From: Schollnick, B. <Ben...@us...> - 2004-06-22 13:26:41
|
Something is not kosher here... I can create the dialog properly in the Resource Editor, but when I go to save it... It does not appear to save... If I close the window, it asks me if I wish to save the changes.. No matter how many times I tell it to save, if I revert to the disk file, it's the standard template file... (Without my changes) I am still running the prototype version.... I am under the impression that the newer version would require changes in my code, due to changes since the prototype? What version are you running? - Benjamin > -----Original Message----- > From: Alex Tweedly [mailto:al...@tw...] > Sent: Monday, June 21, 2004 4:04 PM > To: Schollnick, Benjamin; 'Alex Tweedly'; > pyt...@li... > Subject: RE: [Pythoncard-users] ScrolledMessageDialog Window Font > question s? > > > At 10:02 21/06/2004 -0400, Schollnick, Benjamin wrote: > >Maybe a silly question... But I do not see a easy way to make a > >custom dialog? > > > >I guess I could power up resourceditor, make a "second" application > >that looks like a custom dialog... > > > >But I would think there has to be a simple way to do that? > > Yes, it's pretty easy .... > > Fire up the resourceEditor > Click on File/New... Dialog Template > Move the "OK" and "Cancel" buttons down to make space > Add a new Component/TextArea - call it something imaginative > (TextArea1 in > my case) > Make it a suitable size, and set its font to Courier > File/Save As ... mydialog.rsrc.py > (see below) > > This also saves a file mydialog.py - edit this, to take an > extra parameter > "txt" and put it into self.components.TextArea1.text before > displaying the > dialog > (see below) > > And then in your program simply call it as > result = mydialog.myDialog(self, thetextstring) > > >The goal here is: > > > > * Switch to a monospaced font. The Scrolled Window font is > > completely ruining any "table" design that > I setup due > > to the non-monospaced font... > > > > I just looked again and there is no > wxpython nor pythoncard > > documentation that talks about setting up > the font for those > > dialogs... > > Courier font - see example > > > * Maybe some other font "goodies"... > > Don't see any easy way ... > > > HTML would be nice, but is not necessary.... > > Make it a HTMLWindow instead of a TextArea > > > example.rsrc.py by doing more or less what I described above > {'type':'CustomDialog', > 'name':'Template', > 'title':'Dialog Template', > 'position':(519, 120), > 'size':(342, 301), > 'components': [ > > {'type':'TextArea', > 'name':'TextArea1', > 'position':(10, 10), > 'size':(309, 177), > 'alignment':'left', > 'font':{'faceName': 'Courier', 'family': 'sansSerif', 'size': 8}, > 'text':'this is sample\ntext to show\nit is constant > width\nmmmmmmmmmmmmmm\niiiiiiiiiiiiiiiii\n', > }, > > {'type':'Button', > 'id':5100, > 'name':'btnOK', > 'position':(75, 204), > 'label':'OK', > }, > > {'type':'Button', > 'id':5101, > 'name':'btnCancel', > 'position':(177, 203), > 'label':'Cancel', > }, > > ] # end components > } # end CustomDialog > > corresponding mydialog.py (note - slight editing needed to > get this - > basically just fixup the parameters and add the setting of > self.components.TextArea1.text) > > from PythonCardPrototype import model > > class MyDialog(model.CustomDialog): > def __init__(self, parent, txt=''): > model.CustomDialog.__init__(self, parent) > self.components.TextArea1.text = txt > # if some special setup is necessary, do it here > # example from samples/dialogs/minimalDialog.py > # self.components.field1.text = txt > > #def myDialog(parent, txt): > def myDialog(parent, txt): > dlg = MyDialog(parent, txt) > dlg.showModal() > result = {'accepted':dlg.accepted()} > # stick your results into the result dictionary here > # example from samples/dialogs/minimalDialog.py > # result['text'] = dlg.components.field1.text > dlg.destroy() > return result > > and finally the code snippet from the program itself (I added > a button > "showdialog" to trigger it) > def on_showdialog_mouseClick(self, event): > result = mydialog.myDialog(self, self.thestring) > print result > > and sure enough it comes up, and is in Courier font. > > Hope this helps > -- Alex. > |
From: Alex T. <al...@tw...> - 2004-06-22 13:51:34
|
At 09:25 22/06/2004 -0400, Schollnick, Benjamin wrote: >Something is not kosher here... > >I can create the dialog properly in the Resource Editor, >but when I go to save it... It does not appear to save... > >If I close the window, it asks me if I wish to save the changes.. >No matter how many times I tell it to save, if I revert to the >disk file, it's the standard template file... (Without my changes) > >I am still running the prototype version.... I am under the impression >that the newer version would require changes in my code, due to changes >since the prototype? > >What version are you running? Prototype. 0.7.3.1 (on Windows 2000) Resource editor help says : Last updated: 2002-04-13 One unlikely suggestion .... Does the resource editor properly save for you when editing normal resource files ? Try going into res-editor, creating the dialog and saving it to your named file (without doing any editing). Then quit and restart res-editor and File/Open your file - make changes and see if they will save (i.e. just in case it's a problem specific to creating via File/New/Dialog Template). -- Alex. |
From: Steve H. <sh...@ho...> - 2004-06-22 14:04:17
|
Schollnick, Benjamin wrote: >Something is not kosher here... > >I can create the dialog properly in the Resource Editor, >but when I go to save it... It does not appear to save... > >If I close the window, it asks me if I wish to save the changes.. >No matter how many times I tell it to save, if I revert to the >disk file, it's the standard template file... (Without my changes) > >I am still running the prototype version.... I am under the impression >that the newer version would require changes in my code, due to changes >since the prototype? > >What version are you running? > > - Benjamin > > This sounds like a very old bug. I seem to remember that Kevin fixed it a long time ago - are you fully up to date on the prototype? Sadly I don't seem to have a record of the fix. regards Steve |
From: Phil E. <ph...@li...> - 2004-06-22 14:42:12
|
On Tuesday 22 Jun 2004 3:04 pm, Steve Holden wrote: > This sounds like a very old bug. I seem to remember that Kevin fixed it > a long time ago - are you fully up to date on the prototype? Sadly I Ditto - I remember this bug too, but like Steve, I can't remember what the fix was. :-( If it's any help, I use an HTML-based custom dialog in my PIMP app to display license details, credits etc. I've ripped the code and resource file out and put it up on my website at: http://www.linux2000.com/downloads/HelpAbout.tar.gz Feel free to use/ignore as required. There's a screenshot of it in action here: http://www.linux2000.com/images/snapshot14.png Hope this helps -- Regards Phil Edwards Brighton, UK |
From: Schollnick, B. <Ben...@us...> - 2004-06-22 16:21:42
|
Folks, > Ditto - I remember this bug too, but like Steve, I can't > remember what the fix was. :-( 7.3.1 Has seemed to clear up the problem.... But I have noticed a few things.... * There seems to be no way for the user to resize the dialog/HTML window * Scroll Bars, I do not see a way to force the scroll bars to be active...? Do I have to explicitly add scroll bars? Also... * HTMLWindow requires a .html file to be passed to it? When I attempted to use a string, it pops up a dialog window reporting that's a invalid file... - Ben |
From: Alex T. <al...@tw...> - 2004-06-22 17:05:25
|
At 11:40 22/06/2004 -0400, Schollnick, Benjamin wrote: >Folks, > > > Ditto - I remember this bug too, but like Steve, I can't > > remember what the fix was. :-( > >7.3.1 Has seemed to clear up the problem.... Cool ! >But I have noticed a few things.... > >* There seems to be no way for the user to resize the dialog/HTML window Sorry - can't answer this one (yet) >* Scroll Bars, I do not see a way to force the scroll bars to be active...? > Do I have to explicitly add scroll bars? No - they'll appear if needed. >Also... > >* HTMLWindow requires a .html file to be passed to it? When I attempted to > use a string, it pops up a dialog window reporting that's a invalid > file... If you want to use a string passed in, you MUST have the very first character be a "<" Pythoncard's HTMLWindow class checks the first char, and if it's not a "<" it assumes it's a file name and uses that instead. [ Hmmm - I think this will maybe change some day :-] I changed my example to use an HTMLwindow, and the code in mydialog.py to be > def __init__(self, parent, txt=''): > model.CustomDialog.__init__(self, parent) > self.components.HtmlWindow1.text = "<html><body>some <b>text</b> > here" > and that worked OK. Otherwise, it treats the string as a file - I changed my code in mydialog.py to > def __init__(self, parent, txt=''): > model.CustomDialog.__init__(self, parent) > self.components.HtmlWindow1.text = "calendar.html" calendar.html was an existing HTML file. You could use this, writing the string to a tmp file to use HTMLWindow -- Alex. |
From: Schollnick, B. <Ben...@us...> - 2004-06-22 17:34:30
|
> >* HTMLWindow requires a .html file to be passed to it? When > I attempted to > > use a string, it pops up a dialog window reporting > that's a invalid > > file... > > If you want to use a string passed in, you MUST have the very first > character be a "<" > > Pythoncard's HTMLWindow class checks the first char, and if > it's not a "<" > it assumes it's a file name and uses that instead. [ Hmmm - I > think this > will maybe change some day :-] I didn't see that in the Docs... I'll have to double check, maybe I missed this... But.... I just fixed it, and it is indeed working.... - Benjamin |
From: Alex T. <al...@tw...> - 2004-06-22 18:17:09
|
At 13:29 22/06/2004 -0400, Schollnick, Benjamin wrote: >I didn't see that in the Docs... I'll have to double check, maybe >I missed this... But.... Me neither - I doubt it's in the docs. I was taking a look at the source code, to see if there was a different parameter (attribute) to use to pass in a string, and found this. That's why I like Pythoncard - the source is there if I want to look at it. Not that I can understand it all yet, but I'll get there eventually (probably a few days before there's a new release and it all changes :-) >I just fixed it, and it is indeed working.... Cool - let us know how it goes .... -- Alex. |
From: Alex T. <al...@tw...> - 2004-06-21 20:52:28
|
At 10:02 21/06/2004 -0400, Schollnick, Benjamin wrote: >Maybe a silly question... But I do not see a easy way to make a >custom dialog? > >I guess I could power up resourceditor, make a "second" application >that looks like a custom dialog... > >But I would think there has to be a simple way to do that? Yes, it's pretty easy .... Fire up the resourceEditor Click on File/New... Dialog Template Move the "OK" and "Cancel" buttons down to make space Add a new Component/TextArea - call it something imaginative (TextArea1 in my case) Make it a suitable size, and set its font to Courier File/Save As ... mydialog.rsrc.py (see below) This also saves a file mydialog.py - edit this, to take an extra parameter "txt" and put it into self.components.TextArea1.text before displaying the dialog (see below) And then in your program simply call it as result = mydialog.myDialog(self, thetextstring) >The goal here is: > > * Switch to a monospaced font. The Scrolled Window font is > completely ruining any "table" design that I setup due > to the non-monospaced font... > > I just looked again and there is no wxpython nor pythoncard > documentation that talks about setting up the font for those > dialogs... Courier font - see example > * Maybe some other font "goodies"... Don't see any easy way ... > HTML would be nice, but is not necessary.... Make it a HTMLWindow instead of a TextArea example.rsrc.py by doing more or less what I described above {'type':'CustomDialog', 'name':'Template', 'title':'Dialog Template', 'position':(519, 120), 'size':(342, 301), 'components': [ {'type':'TextArea', 'name':'TextArea1', 'position':(10, 10), 'size':(309, 177), 'alignment':'left', 'font':{'faceName': 'Courier', 'family': 'sansSerif', 'size': 8}, 'text':'this is sample\ntext to show\nit is constant width\nmmmmmmmmmmmmmm\niiiiiiiiiiiiiiiii\n', }, {'type':'Button', 'id':5100, 'name':'btnOK', 'position':(75, 204), 'label':'OK', }, {'type':'Button', 'id':5101, 'name':'btnCancel', 'position':(177, 203), 'label':'Cancel', }, ] # end components } # end CustomDialog corresponding mydialog.py (note - slight editing needed to get this - basically just fixup the parameters and add the setting of self.components.TextArea1.text) from PythonCardPrototype import model class MyDialog(model.CustomDialog): def __init__(self, parent, txt=''): model.CustomDialog.__init__(self, parent) self.components.TextArea1.text = txt # if some special setup is necessary, do it here # example from samples/dialogs/minimalDialog.py # self.components.field1.text = txt #def myDialog(parent, txt): def myDialog(parent, txt): dlg = MyDialog(parent, txt) dlg.showModal() result = {'accepted':dlg.accepted()} # stick your results into the result dictionary here # example from samples/dialogs/minimalDialog.py # result['text'] = dlg.components.field1.text dlg.destroy() return result and finally the code snippet from the program itself (I added a button "showdialog" to trigger it) def on_showdialog_mouseClick(self, event): result = mydialog.myDialog(self, self.thestring) print result and sure enough it comes up, and is in Courier font. Hope this helps -- Alex. |