flatnotebook

BlitzMax Forums/Brucey's Modules/flatnotebook

plash(Posted 2008) [#1]
I'm trying to get the text of a page as it's being closed, however using this:
	Function OnPageClosing(event:wxEvent) 
	  Local fnb:wxFlatNotebook = mainFrame.book
		  Notify fnb.GetPageText(fnb.GetPageIndex(fnb.GetCurrentPage())) 
		
	End Function

I get a number from the notify command, why?

EDIT: is there a simpler way to get the text of a tab on a flatnotebook?


DavidDC(Posted 2008) [#2]
If you mean Notify as in BRL.System's Notify() then I've found it's best not to mix it with wxMax.

Not sure if that's your problem in this case, but use a wxMessageBox(s_text) instead.


plash(Posted 2008) [#3]
Most certainly not the problem, still getting numbers.

old habits ;)


DavidDC(Posted 2008) [#4]
I'd break up that one line and see if GetCurrentPage() is working. What event are you hooking into? Perhaps the page has already closed?


plash(Posted 2008) [#5]
If I use the same technique when the page is changed it gives a number again, if I switch to another tab, and back again, the number is different then the first time on that tab.


DavidDC(Posted 2008) [#6]
I think it's better to initialise fnb as

fnb:wxFlatNotebook = wxFlatNotebook(event.parent) instead of using that global. Assuming the notebook is the source of the event of course.

GetPageText(GetSelection()) ? [edit] Actually you should be able to cast the event to a wxFlatNoteBookEvent and then event.GetSelection()

Does that make any difference? Not having used wxFlatNotebook, I'm about at the end of my guesses, sorry.


plash(Posted 2008) [#7]
event.parent is a wxEvtHandler, and does not seem to convert to a wxFlatNotebook type. (I get "Unhandled Exception:Attempt to access field or method of Null object" any time i try to access something from fnb, using event.parent to wxFlatNotebook)


DavidDC(Posted 2008) [#8]
OK, so I just tried it below and am getting a number readout too. If you type something in each page and switch back and forth, you will see the second method works:

wxTextCtrl(GetCurrentPage()).GetValue()




plash(Posted 2008) [#9]
Your code doesn't seem to run. From what I can see, your just getting the text from the textctrl, I'm trying to get the title of the tab.


DavidDC(Posted 2008) [#10]
Oh dear, I'm not doing very well am I? :-) I completely misunderstood you.

Strange that the code above doesn't run. Works fine here in Leopard.

I just edited it to show *a* way of getting the labels. Cheating, I know.

[edit] Hmmm works fine in XP Parallels too...


Brucey(Posted 2008) [#11]
Apologies for not replying sooner.
Please update for a fix.

SuperStrict isn't completely Super Strict, unfortunately...


plash(Posted 2008) [#12]
Thanks Brucey, forgot I had one of the first versions of wxmax.