Page 1 of 1 1
Topic Options
#208111 - 2013-12-02 03:09 PM KixForms (classic) Tabs question
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Since there's been little traffic at KF.ORG, I'm posting here in hopes of an answer...

I'm working on a KF-Classic form that uses tabs. Each tab allows editing of a different set of data. When any object on a page is changed, it sets $MODIFIED to true. This is a Global var. It does this by calling a SetModified() UDF, either directly or via a primary UDF. (some controls enable others on the page, for example - clicking the RunSilent checkbox disables the controls related to the display format via an OnClickRunSilent() UDF. This UDF disables the related controls and then calls the SetModified() UDF.)

The $MODIFIED flag causes a warning dialog to display when exiting the application, allowing the user to save or discard the changes. What I'm trying to accomplish is preventing the selection of other tabs when unsaved data exists on the current tab instead of this pop-up dialog box. When I try using
 Code:
$tabPAGE2.Enable = 0
it disables the objects on that tab, but does not prevent that tab from being selected. I know that the .Visible control isn't supported on TabPages, but I'd really like a simple solution to lock a user to a specific tab once they've modified data on that tab.

I'm trying to avoid something like
 Code:
$tabTabControl.OnSelectedIndexChanged = 'OnTabChange()'
Function OnTabChange()
  If $MODIFIED   ; don't allow tab changes
    $tabTabControl.SelectedIndex = $ACTIVETAB
  EndIf
  Exit 0
EndFunction
$MODIFIED and $ACTIVETAB are set when any data object is modified. This would work, and in production I'd flash the background of the MODIFIED message in the status bar, but this allows the alternate tab to be selected momentarily before focus is restored to the tab with modified data. The result isn't pretty and is downright distracting.

Thanks,

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#208112 - 2013-12-02 03:36 PM Re: KixForms (classic) Tabs question [Re: Glenn Barnas]
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Although I have no experience writing a KF program, I would venture a guess that the $Tabcontrol object event processor should be updated to conditionally avoid the processing of the OnSelectedIndexChanged event. Not sure how the product is architected, but it woud be useful to be able to enble and disable selected event processing.

Edited by Howard Bullock (2013-12-02 03:45 PM)
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#208113 - 2013-12-02 04:30 PM Re: KixForms (classic) Tabs question [Re: Howard Bullock]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
I changed some other initialization code.. the sample I posted above works well enough, but - sometimes - there is a flash as the primarty tab is re-focused. Being able to disable the selection of tabs would be the best solution, but doesn't look like it's supported.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 739 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.053 seconds in which 0.025 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org