SourceForge logo
SourceForge logo
Menu

wxlua-users — wxLua list for users and developers

You can subscribe to this list here.

2005 Jan
Feb
Mar
Apr
May
Jun
(60)
Jul
(35)
Aug
(32)
Sep
(5)
Oct
(5)
Nov
(58)
Dec
(34)
2006 Jan
(114)
Feb
(184)
Mar
(153)
Apr
(90)
May
(153)
Jun
(59)
Jul
(24)
Aug
(43)
Sep
(17)
Oct
(34)
Nov
(11)
Dec
(204)
2007 Jan
(84)
Feb
(119)
Mar
(38)
Apr
(28)
May
(52)
Jun
(105)
Jul
(64)
Aug
(67)
Sep
(14)
Oct
(3)
Nov
(28)
Dec
(55)
2008 Jan
(228)
Feb
(55)
Mar
(30)
Apr
(30)
May
(15)
Jun
(20)
Jul
(12)
Aug
(3)
Sep
(13)
Oct
(54)
Nov
(35)
Dec
(35)
2009 Jan
(19)
Feb
(20)
Mar
(34)
Apr
(4)
May
(60)
Jun
(25)
Jul
(16)
Aug
(51)
Sep
(19)
Oct
(62)
Nov
(21)
Dec
(12)
2010 Jan
(1)
Feb
Mar
(4)
Apr
(12)
May
(23)
Jun
(13)
Jul
(1)
Aug
(40)
Sep
(18)
Oct
(21)
Nov
(26)
Dec
(34)
2011 Jan
(17)
Feb
(23)
Mar
(1)
Apr
(10)
May
(1)
Jun
(5)
Jul
(1)
Aug
Sep
Oct
(2)
Nov
Dec
(43)
2012 Jan
(5)
Feb
(19)
Mar
(6)
Apr
(24)
May
(39)
Jun
(83)
Jul
(29)
Aug
(36)
Sep
(64)
Oct
(55)
Nov
(12)
Dec
(7)
2013 Jan
(17)
Feb
(10)
Mar
(37)
Apr
(27)
May
(13)
Jun
(9)
Jul
(7)
Aug
(61)
Sep
(23)
Oct
(23)
Nov
(30)
Dec
(16)
2014 Jan
(23)
Feb
(13)
Mar
(9)
Apr
(17)
May
(2)
Jun
(11)
Jul
(2)
Aug
Sep
(9)
Oct
(24)
Nov
(2)
Dec
(14)
2015 Jan
(6)
Feb
(4)
Mar
(17)
Apr
May
(7)
Jun
(3)
Jul
Aug
Sep
(2)
Oct
(21)
Nov
(6)
Dec
(2)
2016 Jan
(4)
Feb
(2)
Mar
(7)
Apr
(3)
May
(11)
Jun
(6)
Jul
Aug
(1)
Sep
Oct
Nov
Dec
2017 Jan
Feb
Mar
Apr
(1)
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2018 Jan
(2)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2019 Jan
Feb
Mar
(6)
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
(1)
Oct
Nov
Dec
2022 Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
(2)
Nov
(4)
Dec
2023 Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
(8)
Nov
Dec
2024 Jan
Feb
Mar
Apr
May
Jun
Jul
(2)
Aug
Sep
Oct
Nov
Dec
S M T W T F S
1
(2)
2
3
(1)
4
5
6
7
8
9
10
11
12
13
(2)
14
15
16
17
18
19
(4)
20
(2)
21
(1)
22
(3)
23
(1)
24
(1)
25
(1)
26
27
28
(2)

Showing 20 results of 20

From: lostgallifreyan <los...@gm...> - 2009年02月28日 21:00:12
I've been playing around with this because it's something I'll want too.
(And I found this thread in the mail-archive.com web site so I don't know if this reply will put this in the thread where I want it to go because I have no header, only a subject line.)
function Main()
 FRAME=wx.wxFrame(wx.NULL,-1,"Drag And Drop",wx.wxDefaultPosition,wx.wxSize(200,100),wx.wxDEFAULT_FRAME_STYLE)
 FRAME:DragAcceptFiles(true)
 FRAME:Centre() FRAME:Show(true)
 FRAME:Connect(wx.wxEVT_DROP_FILES,DragDrop)
end
function DragDrop(E)
 local P,F,L=E:GetPosition(),E:GetFiles()
 L="Files dropped at "..P.x..","..P.y..":\n\n"
 for _,f in ipairs(F) do
 L=L..f.."\n"
 end
 print(L)
end
Main()
That's a complete working example, unlike the one I saw, and it also adds a get position example for the drop.
There's definitely something wrong though, if you run this and drag a lot of files, some bizarrely large co-ordinates are reported, and sometimes it will even crash wxLua (Shell32.dll in W98 SE running W95 shell, (W98-Lite)). I can repeat the errors but I have no idea what it is about the file names or file counts, or positions on screen, or anything else that might be causing the trouble. It seems to work fine for up to ten files or so.
From: lostgallifreyan <los...@gm...> - 2009年02月28日 14:35:00
Hello. I'm trying to make a GUI for GPS chart and track display. I worked this code up from bits taken from samples, and reference to the wxWidgets descriptions of functions and such, and some reductions of my own devising in the part that loads and displays the chart image. I can't find any indication that this mailing lists accepts attachments so I've risked wordwrap mangling with the script at the end of this message.
I don't have the grounding to understand the details behind wxLua, I can only learn from example (and lots of trial and error), and although I made this work very well for dragging the content like a page in a PDF reader, it's obviously not constructed right, and I've driven myself alternately crazy and stupified for weeks and failed to improve it no matter what snippets I find and try. Playing with scroll events and refreshes and updates all fail, they'd just add weight even if they did work, this is too broken for that to help... That it works at all gives a good idea what I want, but I'd like to see how it should be done.
To make it show a 'chart', edit the IMAGE:LoadFile line to point to some large image. The diagonal red line, top left, has to display on the chart at all times unless asked not to. I worked out the whole track draw code, but I left only the simplest content to save you time looking at the code.
BLANK is an unseen panel of smallest possible size, which is shown and hidden each time the window content is dragged around. It was a tortuous discovery, but it makes the redraw of the chart and track work as I want them. They also redraw as I want if the frame is obscured and uncovered, but not when scrolling with any method. The scroll window itself won't work without the status bar! No idea why, but it makes the scroll window about 2 pixels wide if absent! If anything proves just how broken this is, it's that status bar weirdness.
After several tens of loads during a session, the chart image fails to draw, suggesting that some resource is being created and not destroyed when it should be, and I can't tell which, if any.
Ultimately I want to zoom the view in and out as well as pan it, so if you have clues on how to do that, please let me know.
SCRIPT:
function main()
 FRAME=wx.wxFrame(wx.NULL,-1,"GPS Plot",wx.wxDefaultPosition,wx.wxSize(1024,768),wx.wxDEFAULT_FRAME_STYLE)
 FRAME:Centre() FRAME:Show(true)
 FRAME:CreateStatusBar()
 IMAGE=wx.wxBitmap():ConvertToImage()
 IMAGE:LoadFile("Chart.jpg")
 local X,Y=IMAGE:GetWidth(),IMAGE:GetHeight()
 SCROLL=wx.wxScrolledWindow(FRAME,-1) SCROLL:SetScrollbars(1,1,X,Y)
 CHART=wx.wxStaticBitmap(SCROLL,-1,wx.wxBitmap(IMAGE),wx.wxPoint(0,0),wx.wxSize(X,Y)) IMAGE:Destroy()
 LAYER=wx.wxPanel(SCROLL,-1,wx.wxPoint(0,0),wx.wxSize(X,Y))
 BLANK=wx.wxPanel(SCROLL,-1,wx.wxPoint(0,0),wx.wxSize(0,0))
 CHART:Connect(wx.wxEVT_LEFT_DOWN,OnLeftDown)
 CHART:Connect(wx.wxEVT_MOTION,OnMotion)
 LAYER:Connect(wx.wxEVT_PAINT,OnPaint)
end
--==================== Mouse Handling ====================--
MX,MY,VX,VY=0,0,0,0
function OnLeftDown(event)
 MX,MY,VX,VY=wx.wxGetMousePosition():GetX(),wx.wxGetMousePosition():GetY(),SCROLL:GetViewStart()
end
function OnMotion(event)
 if event:LeftIsDown() then
 SCROLL:Scroll(VX+MX-wx.wxGetMousePosition():GetX(),VY+MY-wx.wxGetMousePosition():GetY())
 BLANK:Show(nil) BLANK:Show(1)
 end
end
--==================== Track Drawing =====================--
function OnPaint(event)
 local DC=wx.wxPaintDC(LAYER)
 DC:SetPen(wx.wxPen(wx.wxColour(255,0,0),1,wx.wxSOLID))
 DC:DrawLine(0,0,600,600)
 DC:delete()
end
--====================================================================================================================--
main()
From: Andre A. <ar...@ki...> - 2009年02月25日 20:51:57
> 
> int mask = (int)wxlua_getnumbertype(L, 3);
> 
sorry
 int mask = (int)wxlua_getnumbertype(L, 3);
does not work
 int mask = (unsigned)wxlua_getnumbertype(L, 3);
does
Andre
From: Andre A. <ar...@ki...> - 2009年02月24日 20:06:38
John Labenski <jlabenski@...> writes:
> 
> I actually don't have any problems with
> 
> int mask = (int)wxlua_getnumbertype(L, 3);
> 
> but, I do see it with
> 
> double d = 0xfe000000; int i = (int)d;
> 
> Strange that it differs from your experiences, but Ok, I agree that it's 
broken.
Yes you are right this is really strange...
> 
> int i = (int)wxlua_getintegertype();
> 
or maybe
int i = (unsigned int)wxlua_getintegertype();
unsigned int is what we wish for 
int is what we have to use.
Whatever you like.
Thank you for your help.
Andre
From: John L. <jla...@gm...> - 2009年02月23日 05:37:00
On Sun, Feb 22, 2009 at 7:44 AM, Andre Arpin <ar...@ki...> wrote:
> Andre Arpin <arpin@...> writes:
>
> Tried it again with gcc and I get 8000000 as an output
> both gcc and vc will give the proper result when the double is cast to unsigned
>
> int mask = (unsigned)wxlua_getnumbertype(L, 3);
>
> seems to be all that is necessary
Thanks for all your work. I finally installed and got wxLua compiled
with Visual Studio 2008.
For posterity I used:
Visual Studio 2008 w/ SP1 ISO
http://www.microsoft.com/downloads/details.aspx?FamilyID=27673c47-b3b5-4c67-bd99-84e525b5ce61&displaylang=en
Microsoft Platform SDK 2003 (apparently 2003 is the last one that runs
on MSWin 2000)
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm
=====================
I actually don't have any problems with
 int mask = (int)wxlua_getnumbertype(L, 3);
but, I do see it with
 double d = 0xfe000000; int i = (int)d;
Strange that it differs from your experiences, but Ok, I agree that it's broken.
I think the best thing to do is to add wxlua_getenumtype() which will
error if the number is not an integer (same code as the current
wxlua_getintegertype()).
Then change wxlua_getintegertype() to do
unsigned long wxlua_getintegertype() {
...
 double d_value = lua_tonumber(L, stack_idx);
 unsigned long ul_value = (unsigned long)d_value;
 return ul_value;
and then the binding the code will be
 int i = (int)wxlua_getintegertype();
and the same for char, short, long. This way we allow the compiler to
decide how to convert a ulong that overflows an int/short/char and we
cross our fingers that they all do it the same way.
Unfortunately we can't just add wxlua_getchartype(),
wxlua_getshorttype(), etc since in this particular example the
wxStyledTextCtrl uses an int when it should really be using an
unsigned int so we'd always fail, but this is actually an issue with
Scintilla and we're not going to get that changed.
Any thoughts on this?
 -John
From: Andre A. <ar...@ki...> - 2009年02月22日 12:45:06
Andre Arpin <arpin@...> writes:
> 
> John Labenski <jlabenski@...> writes:
> 
> > 
> > On Fri, Feb 20, 2009 at 9:26 AM, Andre Arpin <arpin@...> wrote:
> > > John Labenski <jlabenski@...> writes:
> 
> I have tried the following 
> 
 
Tried it again with gcc and I get 8000000 as an output
both gcc and vc will give the proper result when the double is cast to unsigned
so
	int mask = (unsigned)wxlua_getnumbertype(L, 3);
seems to be all that is necessary
Andre
From: Andre A. <ar...@ki...> - 2009年02月22日 09:26:51
Andre Arpin <arpin@...> writes:
> 
> John Labenski <jlabenski@...> writes:
> 
> > 
> > On Fri, Feb 20, 2009 at 9:26 AM, Andre Arpin <arpin@...> wrote:
> > > John Labenski <jlabenski@...> writes:
> 
Using the same code 
 
#define v 0xfe000000
	double d = v;
	int i = d;
	printf("%x", i);
	return 0;
using vs 2003 or Visual C++ 6.0 on my portable I get 0xfe000000 how exciting!
Looking at the dissassembly I can see that the conversion is done by a 
subroutine so I expect this is where the change really occurred.
Andre
From: Andre A. <ar...@ki...> - 2009年02月22日 08:55:25
John Labenski <jlabenski@...> writes:
> 
> On Fri, Feb 20, 2009 at 9:26 AM, Andre Arpin <arpin@...> wrote:
> > John Labenski <jlabenski@...> writes:
I have tried the following 
#define v 0xfe000000
	double d = v;
	int i = d;
	printf("%x", i);
	return 0;
on vs 2008, 2005, on both my computers.
My portable uses a P4
and the result is consistently
80000000
Andre
From: Andre A. <ar...@ki...> - 2009年02月21日 14:29:17
John Labenski <jlabenski@...> writes:
> 
> This is very strange to me. Lets try to figure this out.
> 
> What processor?
Intel Q6600 
> What OS?
XP
> What compiler are you using?
visual studio 2008
> 
> stick these lines into wxLua_wxStyledTextCtrl_SetMarginMask(). It
> might just be that your sizeof(double) is not 8 bytes? My sizes in
> VC6, Intel core 2 duo, Win XP, are the comments to the right.
> 
> int int_size = sizeof(int); // 4
> int long_size = sizeof(long); // 4
> int float_size = sizeof(float); // 4
> int double_size = sizeof(double); // 8
This is right
all of the following works
 unsigned int mask = wxlua_getnumbertype(L, 3);
	int mask = (unsigned long)wxlua_getnumbertype(L, 3);
	int mask = (unsigned int)wxlua_getnumbertype(L, 3);
works
I think the last one is preferable.
This is strange I though that I tried some of these before resorting to bit 
manipulation. 
I wonder why this very small change in casting.
Andre
From: John L. <jla...@gm...> - 2009年02月20日 23:19:25
On Fri, Feb 20, 2009 at 9:26 AM, Andre Arpin <ar...@ki...> wrote:
> John Labenski <jlabenski@...> writes:
>
>> The C++ function has this signature:
>> wxStyledTextCtrl::SetMarginMask(int margin, int mask)
>>
>> Even if wxLua handed it with an unsigned int it would be turned right
>> back into -33554432 inside the wxStyledTextCtrl function. I see that
>> editor.wx.lua makes a call to SetMarginMask(2,
>> wxstc.wxSTC_MASK_FOLDERS) and it works fine since if you type "do \n
>> end" into wxlua.exe, Scintilla draws the code folding icons.
>>
>> So just to be sure, what is the problem? Do you not see the code folding
> icons?
>
> Not it does not, it sets it to 0x80000000 which is the folder icon ONLY.
> It should be set 0xfe000000 so the other icons will also be set.
I compiled wxLua with VisualC 6 in debug mode, (32 bit compiler on
32bit WinXP, but on Intel core 2 duo), put a break in
wxLua_wxStyledTextCtrl_SetMarginMask so I could display "int mask".
The debugger shows mask = -33554432 for this code
int mask = (int)wxlua_getnumbertype(L, 3);
and the debugger shows mask = 4261412864 for this code
unsigned int mask = (unsigned int)wxlua_getnumbertype(L, 3);
TRY THIS! (it, of course, works for me)
unsigned long mask = (unsigned long)wxlua_getnumbertype(L, 3);
I never get mask = 2147483648 (0x80000000).
> The icon folder will display because it is controlled by the top bit the other
> icon will not be displayed.
>
> try
> editor:MarkerDefine(wxstc.wxSTC_MARKNUM_FOLDEROPENMID,
> wxstc.wxSTC_MARK_CIRCLEMINUSCONNECTED, wx.wxBLUE, wx.wxRED)
>
> This should give you a Blue Circle with a Red + for sub folder but it will not
> display.
I put the above code after "grey:delete()" and the
editor:MarkerDefine(...) code in editor.wx.lua and I get the blue
circle with no changes to wxLua.
This is very strange to me. Lets try to figure this out.
What processor?
What OS?
What compiler are you using?
stick these lines into wxLua_wxStyledTextCtrl_SetMarginMask(). It
might just be that your sizeof(double) is not 8 bytes? My sizes in
VC6, Intel core 2 duo, Win XP, are the comments to the right.
int int_size = sizeof(int); // 4
int long_size = sizeof(long); // 4
int float_size = sizeof(float); // 4
int double_size = sizeof(double); // 8
Hopefully this will clear it up.
> ---------------------------------
> The following code will also work and is somewhat simpler
>
> static int LUACALL wxLua_wxStyledTextCtrl_SetMarginMask(lua_State *L)
> {
> double doubleMask = wxlua_getnumbertype(L, 3);
> int mask = (doubleMask > INT_MAX) ? (int)(doubleMask + INT_MIN)|
> INT_MIN : (int)doubleMask;
>
> ---------------
>
> I expected that (int)((unsigned int)doubleMask) would work but it does not
> ((unsigned int)doubleMask) is 0x8000000 I whould have expected 0xfe000000
> since
> unsigned int xxx = 0xfe000000; sets xxx to 0xfe000000
> all rather mysterious.
This code is fishy, you subtract off INT_MIN, the topmost bit, from
the double and then OR it back on.
This page below talks about double <--> int conversion. The executive
summary is that doubles can hold 2^52 bits and ints are only 2^32.
http://lua-users.org/wiki/FloatingPoint
Your compiler is mangling 0xFE000000 into 0x80000000 which means that
it is keeping only the topmost bit of 0xFE to get 0x80.
Lemme know about your processor, compiler, etc above.
-John
From: Andre A. <ar...@ki...> - 2009年02月20日 14:27:15
John Labenski <jlabenski@...> writes:
> 
> On Thu, Feb 19, 2009 at 10:15 AM, Andre Arpin <arpin@...> wrote:
> > John Labenski <jlabenski@...> writes:
> >
> 
> The C++ function has this signature:
> wxStyledTextCtrl::SetMarginMask(int margin, int mask)
> 
> Even if wxLua handed it with an unsigned int it would be turned right
> back into -33554432 inside the wxStyledTextCtrl function. I see that
> editor.wx.lua makes a call to SetMarginMask(2,
> wxstc.wxSTC_MASK_FOLDERS) and it works fine since if you type "do \n
> end" into wxlua.exe, Scintilla draws the code folding icons.
> 
> So just to be sure, what is the problem? Do you not see the code folding 
icons?
> 
Not it does not, it sets it to 0x80000000 which is the folder icon ONLY.
It should be set 0xfe000000 so the other icons will also be set.
The icon folder will display because it is controlled by the top bit the other 
icon will not be displayed.
try
 editor:MarkerDefine(wxstc.wxSTC_MARKNUM_FOLDEROPENMID, 
wxstc.wxSTC_MARK_CIRCLEMINUSCONNECTED, wx.wxBLUE, wx.wxRED)
This should give you a Blue Circle with a Red + for sub folder but it will not 
display.
Use editor:SetMarginMask(2, -1)
You will see that it should work.
---------------------------------
The following code will also work and is somewhat simpler
static int LUACALL wxLua_wxStyledTextCtrl_SetMarginMask(lua_State *L)
{
 double doubleMask = wxlua_getnumbertype(L, 3);
	int mask = (doubleMask > INT_MAX) ? (int)(doubleMask + INT_MIN)| 
INT_MIN : (int)doubleMask;
---------------
I expected that (int)((unsigned int)doubleMask) would work but it does not
((unsigned int)doubleMask) is 0x8000000 I whould have expected 0xfe000000 
since 
unsigned int xxx = 0xfe000000; sets xxx to 0xfe000000
all rather mysterious.
Andre
From: John L. <jla...@gm...> - 2009年02月19日 19:11:14
On Thu, Feb 19, 2009 at 10:15 AM, Andre Arpin <ar...@ki...> wrote:
> John Labenski <jlabenski@...> writes:
>
>> On Wed, Feb 18, 2009 at 7:58 PM, Andre Arpin <arpin@...> wrote:
>> > The value for wxstc.wxSTC_MASK_FOLDERS has to be -33554432 or maybe -
> 0x2000000
>> >
>> > or SetMarginMask should expect an unsigned int (I did not check that).
The C++ function has this signature:
wxStyledTextCtrl::SetMarginMask(int margin, int mask)
Even if wxLua handed it with an unsigned int it would be turned right
back into -33554432 inside the wxStyledTextCtrl function. I see that
editor.wx.lua makes a call to SetMarginMask(2,
wxstc.wxSTC_MASK_FOLDERS) and it works fine since if you type "do \n
end" into wxlua.exe, Scintilla draws the code folding icons.
So just to be sure, what is the problem? Do you not see the code folding icons?
Regards,
 John
>>
>> I'm not sure what you're trying to do, but this is the C++ code that defines
> it.
>>
>> #define wxSTC_MASK_FOLDERS 0xFE000000
>>
>
> this solves the problem this number is too large for an int
> static int LUACALL wxLua_wxStyledTextCtrl_SetMarginMask(lua_State *L)
> {
> double doubleMask = wxlua_getnumbertype(L, 3);
> int mask = (doubleMask > INT_MAX) ? (int)((doubleMask - INT_MAX) -1 )|
> INT_MIN : (int)doubleMask;
>
> ---------- you can look below if you like it shows some detail of
> ---------- the problem (if you are interested)
>
> We are hitting a LUA limit (really a double to int limit)
> ---------------the first section show the problem in LUA
> ---------------the second section show the problem in the C code
> ------------- first section -------------
> --- the following shows that lua will display both
> --- wxstc.wxSTC_MASK_FOLDERS and -33554432 as fe000000
> --- but they are not equal
> print("1:", wxstc.wxSTC_MASK_FOLDERS, string.format("%x",
> wxstc.wxSTC_MASK_FOLDERS))
> 1: 4261412864 fe000000
> print("2:", string.format("%x", -33554432))
> 2: fe000000
> print("3:", wxstc.wxSTC_MASK_FOLDERS == (-33554432))
> 3: false
> print("4:", string.format("%x", wxstc.wxSTC_MASK_FOLDERS - (-33554432)))
> 4: 0
> print("5:", wxstc.wxSTC_MASK_FOLDERS - (-33554432))
> 5: 4294967296
> local xx = wxstc.wxSTC_MASK_FOLDERS - (-33554432)
> print("6:", xx, string.format("%x", xx))
> 6: 4294967296 0
>
> ------------- second section -------------
> static int LUACALL wxLua_wxStyledTextCtrl_SetMarginMask(lua_State *L)
> {
> // int mask
> int mask = (int)wxlua_getnumbertype(L, 3);
> // int margin
> int margin = (int)wxlua_getnumbertype(L, 2); <<<< breakpoint on this line
> -----------> breaking while the program execute these line
> -----------> the mask value as displayed in the watch panel
> editor:SetMarginMask(2, -1)
> mask 0xffffffff int
> editor:SetMarginMask(2, wxstc.wxSTC_MASK_FOLDERS)
> mask 0x80000000 int <<<< this is the problem
> editor:SetMarginMask(2, -2)
> mask 0xfffffffe int
> editor:SetMarginMask(2, -33554432)
> mask 0xfe000000 int
> editor:SetMarginMask(2, -3)
> mask 0xfffffffd int
> editor:SetMarginMask(2, -0x2000000)
> mask 0xfe000000 int
>
>
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a 600ドル discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> wxlua-users mailing list
> wxl...@li...
> https://lists.sourceforge.net/lists/listinfo/wxlua-users
>
From: Andre A. <ar...@ki...> - 2009年02月19日 15:15:29
John Labenski <jlabenski@...> writes:
> 
> On Wed, Feb 18, 2009 at 7:58 PM, Andre Arpin <arpin@...> wrote:
> > The value for wxstc.wxSTC_MASK_FOLDERS has to be -33554432 or maybe -
0x2000000
> >
> > or SetMarginMask should expect an unsigned int (I did not check that).
> >
> 
> I'm not sure what you're trying to do, but this is the C++ code that defines 
it.
> 
> #define wxSTC_MASK_FOLDERS 0xFE000000
> 
this solves the problem this number is too large for an int
static int LUACALL wxLua_wxStyledTextCtrl_SetMarginMask(lua_State *L)
{
 double doubleMask = wxlua_getnumbertype(L, 3);
 int mask = (doubleMask > INT_MAX) ? (int)((doubleMask - INT_MAX) -1 )| 
 INT_MIN : (int)doubleMask;
---------- you can look below if you like it shows some detail of 
---------- the problem (if you are interested)
We are hitting a LUA limit (really a double to int limit)
---------------the first section show the problem in LUA
---------------the second section show the problem in the C code
------------- first section -------------
--- the following shows that lua will display both 
--- wxstc.wxSTC_MASK_FOLDERS and -33554432 as fe000000
--- but they are not equal
 print("1:", wxstc.wxSTC_MASK_FOLDERS, string.format("%x", 
wxstc.wxSTC_MASK_FOLDERS))
1:	4261412864	fe000000
 print("2:", string.format("%x", -33554432))
2:	fe000000
 print("3:", wxstc.wxSTC_MASK_FOLDERS == (-33554432))
3:	false
 print("4:", string.format("%x", wxstc.wxSTC_MASK_FOLDERS - (-33554432)))
4:	0
 print("5:", wxstc.wxSTC_MASK_FOLDERS - (-33554432))
5:	4294967296
 local xx = wxstc.wxSTC_MASK_FOLDERS - (-33554432)
 print("6:", xx, string.format("%x", xx))
6:	4294967296	0
------------- second section -------------
static int LUACALL wxLua_wxStyledTextCtrl_SetMarginMask(lua_State *L)
{
 // int mask
 int mask = (int)wxlua_getnumbertype(L, 3);
 // int margin
 int margin = (int)wxlua_getnumbertype(L, 2); <<<< breakpoint on this line
-----------> breaking while the program execute these line
-----------> the mask value as displayed in the watch panel
 editor:SetMarginMask(2, -1)
 		mask	0xffffffff	int
 editor:SetMarginMask(2, wxstc.wxSTC_MASK_FOLDERS)
 		mask	0x80000000	int <<<< this is the problem
 editor:SetMarginMask(2, -2)
 		mask	0xfffffffe	int
 editor:SetMarginMask(2, -33554432)
		mask	0xfe000000	int
 editor:SetMarginMask(2, -3)
		mask	0xfffffffd	int
 editor:SetMarginMask(2, -0x2000000)
		mask	0xfe000000	int
From: John L. <jla...@gm...> - 2009年02月19日 03:07:27
On Wed, Feb 18, 2009 at 7:58 PM, Andre Arpin <ar...@ki...> wrote:
> The value for wxstc.wxSTC_MASK_FOLDERS has to be -33554432 or maybe -0x2000000
>
> or SetMarginMask should expect an unsigned int (I did not check that).
>
I'm not sure what you're trying to do, but this is the C++ code that defines it.
#define wxSTC_MASK_FOLDERS 0xFE000000
which is decimal 4261412864
print(wxstc.wxSTC_MASK_FOLDERS == 0xFE000000) is 'true'
print(wxstc.wxSTC_MASK_FOLDERS == 4261412864) is 'true'
I don't know where you got the -33554432 number from, but I suspect
that it's equivalence to the positive numbers above is only because of
some limited number of bytes from something you're using to calculate
it?
Regards,
 John
>
> the following
> print(string.format('%x',-33554432))
> print(string.format('%x',-0x2000000))
> print(string.format('%x',wxstc.wxSTC_MASK_FOLDERS))
> print(-0x2000000 == wxstc.wxSTC_MASK_FOLDERS)
>
> output:
>
> fe000000
> fe000000
> fe000000
> false
>
> the values display identical string but are not equal.
>
> Andre
From: Andre A. <ar...@ki...> - 2009年02月19日 00:58:31
The value for wxstc.wxSTC_MASK_FOLDERS has to be -33554432 or maybe -0x2000000
or SetMarginMask should expect an unsigned int (I did not check that).
both 
the following 
 print(string.format('%x',-33554432))
 print(string.format('%x',-0x2000000))
 print(string.format('%x',wxstc.wxSTC_MASK_FOLDERS))
 print(-0x2000000 == wxstc.wxSTC_MASK_FOLDERS)
output:
fe000000
fe000000
fe000000
false
 
the values display identical string but are not equal.
Andre
From: John L. <jla...@gm...> - 2009年02月13日 16:57:27
On Fri, Feb 13, 2009 at 5:43 AM, LPE <lp...@f4...> wrote:
> With wxLua 2.8.7.0 under Windows, this code produces a crash :
>
> local proc = wx.wxProcess()
> wx.wxExecute( "dir", wx.wxEXEC_ASYNC, proc )
> proc = nil
> collectgarbage( "collect" )
>
> Is there a way to prevent it?
Yes. The wxWidgets docs are a little cryptic, but I think they're
trying to say that you have to connect to the event to stop wxWidgets
from deleting it. See second paragraph.
http://docs.wxwidgets.org/stable/wx_wxprocess.html
=========================
USE_EVENT = 0
proc = wx.wxProcess()
if USE_EVENT then -- Use the wxProcessEvent to stop wxWidgets from deleting
proc:Connect(wx.wxEVT_END_PROCESS,
 function(event)
 print("Hello - the process is over and won't be deleted.")
 -- event:Skip(true) <-- will crash since wxWidgets will delete it too
 proc = nil
 collectgarbage( "collect" ) -- not necessary, but it tests the problem
 end)
else
 wxlua.ungcobject(proc) -- don't let Lua GC it, wxWidgets will do it
end
wx.wxExecute( "dir", wx.wxEXEC_ASYNC, proc )
if not USE_EVENT then
 proc = nil -- force GC to delete it
end
collectgarbage( "collect" )
=========================
I've shown two ways to do it, with and without events. I can't think
of any reasonable way that wxLua could detect that if you have
Connected to the wxEVT_END_PROCESS whether you are going to call
event:Skip(true/false) so there doesn't seem to be a way to make this
work more elegantly.
Hope this helps,
 John
From: LPE <lp...@f4...> - 2009年02月13日 13:50:18
With wxLua 2.8.7.0 under Windows, this code produces a crash :
 local proc = wx.wxProcess()
 wx.wxExecute( "dir", wx.wxEXEC_ASYNC, proc )
 proc = nil
 collectgarbage( "collect" )
Is there a way to prevent it?
From: John L. <jla...@gm...> - 2009年02月03日 03:43:43
I found another "fix" too.
Do NOT ever use "wx.wxExit(0)" to close wxWidgets apps. There are a
lot of things going on behind the scenes for GUI apps and you should
call wxFrame::Destroy() if you want to close the app nicely, see also
wxApp::ExitMainLoop(). In fact, your event handler for
wx.wxEVT_CLOSE_WINDOW does nothing useful and you should remove it.
Regards,
 John
On Sun, Feb 1, 2009 at 5:21 AM, Éjjeli Őrjárat <ejj...@gm...> wrote:
> I found the problem now, and fixed it:
>
> hep = wx.wxHtmlEasyPrinting("My print's preview",myApp)
> hep:SetHeader("@PAGENUM@/@PAGESCNT@. page")
> prnSetup = hep:GetPageSetupData()
> prnData = hep:GetPrintData()
> prnData:SetNoCopies(3)
>
> tMinoseg =
> {wx.wxPRINT_QUALITY_DRAFT,wx.wxPRINT_QUALITY_LOW,wx.wxPRINT_QUALITY_MEDIUM,wx.wxPRINT_QUALITY_HIGH}
> prnData:SetQuality(2)
> prnSetup:SetMarginTopLeft(wx.wxPoint(12,12))
>
> This works as it excepted, everything is OK now, no crash :-)
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> wxlua-users mailing list
> wxl...@li...
> https://lists.sourceforge.net/lists/listinfo/wxlua-users
>
>
From: Lothar B. <lot...@lo...> - 2009年02月01日 10:47:54
Hi,
I have found in the wxAUI sample an event handler for closing panels. 
That is the place
to set the corresponding panel variable to nil.
...
 this:Connect(wxaui.wxEVT_AUI_PANE_CLOSE, function(event) 
self:OnPaneClose(event) end)
...
function MyFrame:OnPaneClose(evt)
 local this = self.this
 if (evt:GetPane().name == wxT("MyPane")) then
	myPanelMyPane = nil
 end
end
I also see, how to connect specific events manually.
Thanks
Am 30.01.2009 um 15:14 schrieb Andre Arpin:
>>
>>
>> I have got it working to avoid opening a second window, but when I 
>> close the
> pane, I didn't get it back reopened.
>> Also I have a local MyFrame and the panels are implemented in 
>> separate
> files, so I don't know exactly if I could
>> access MyFrame to change a variable in that class to indicate pane 
>> closed.
>>
>
> if MyFrame then set the pane to close
> else message I do not have the frame
> end
>
> this would be a quick check
> if you do not have MyFrame it should be nil.
>
> Andre
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> wxlua-users mailing list
> wxl...@li...
> https://lists.sourceforge.net/lists/listinfo/wxlua-users
>
-- | Rapid Prototyping | XSLT Codegeneration | http://www.lollisoft.de
Lothar Behrens
Heinrich-Scheufelen-Platz 2
73252 Lenningen
From: Éjjeli Ő. <ejj...@gm...> - 2009年02月01日 10:21:53
I found the problem now, and fixed it:
hep = wx.wxHtmlEasyPrinting("My print's preview",myApp)
 hep:SetHeader("@PAGENUM@/@PAGESCNT@. page")
 prnSetup = hep:GetPageSetupData()
 prnData = hep:GetPrintData()
 prnData:SetNoCopies(3)
 tMinoseg =
{wx.wxPRINT_QUALITY_DRAFT,wx.wxPRINT_QUALITY_LOW,wx.wxPRINT_QUALITY_MEDIUM,wx.wxPRINT_QUALITY_HIGH}
 prnData:SetQuality(2)
 prnSetup:SetMarginTopLeft(wx.wxPoint(12,12))
This works as it excepted, everything is OK now, no crash :-)

Showing 20 results of 20

Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /