Jump to content

Tabs and On Event Mode


saywell
 Share

Recommended Posts

Hi,

I'm converting aworking program that has too many buttons in one window into a tabbed menu to make it easier to use.

I've created the meu with the help of coda, and am now translating my old GUI buttons to the new tabbed controls.

I've hit a snag in that althugh I identify the default tag to show on stsrt-up, it's not working properly.

It shows the tab, but not the labels in it, and even shows part of the updown control in the net tab!

If I click to another tab, then back to the first, it displays correctly.

I suspect it's to do with me using onevent mode, hence this prelimianry question:

Is there anything I shouls do special/differently when using tabs with this mode?

If so, I'll pursue that line.

If not, I'll post my code when I get back later today to seek more specific advice.

On second thought, I'll post the GUI bit of the code anyway!

#include <Word.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <file.au3>
#include <String.au3>
#Include <Array.au3>
#include <mysql.au3>
#include "ExtMsgBox.au3"
#include <IE.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
#Include <Clipboard.au3>
#include <Process.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <TabConstants.au3>



#include-once

Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode
Opt("WinTitleMatchMode", 2)
Opt("SendCapslockMode",0)


$mainwindow = GUICreate("Clinical Document Manager", 731, 440, 186, 123)

GUICtrlCreateLabel("Yeovil District Hospital NHS FT", 250, 370)
GUICtrlCreateLabel("Part of the CDM Suite", 7,400)
GUICtrlCreateLabel("Created by W. R. Saywell", 600, 400)

Global $toolmenu = GUICtrlCreateMenu ("Tools")
Global $PASitem = GUICtrlCreateMenuItem("Open PAS (Alt-F12)", $toolmenu)
GUICtrlSetOnEvent($PASitem , "Open_PAS")
Global $CONFIGitem = GUICtrlCreateMenuItem("Configure (F2)", $toolmenu)
GUICtrlSetOnEvent($CONFIGitem, "Config")
Global $LOGitem = GUICtrlCreateMenuItem("Open Log (Pause)", $toolmenu)
GUICtrlSetOnEvent($LOGitem, "ViewLog")

Global $helpmenu = GUICtrlCreateMenu ("Help")
Global $helpitem = GUICtrlCreateMenuItem("Help (F1)", $helpmenu)
GUICtrlSetOnEvent($helpitem, "help")


$Pic1 = GUICtrlCreatePic(@ScriptDir & "\ydhlogo.gif", 520, 0, 193, 36)

;GUICtrlCreateTabItem("")



$setradio10 = GUICtrlCreateRadio("Real Patient Data", 24, 56, 113, 17)
$setradio11 = GUICtrlCreateRadio("Training Environment", 168, 56, 129, 17)
$Group1 = GUICtrlCreateGroup("Select Environment", 16, 40, 297, 49)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Label1 = GUICtrlCreateLabel("Specialty", 531, 78, 47, 17)
$setSpec = GUICtrlCreateCombo($sDefSpec, 580, 75, 130, 25)
    GUICtrlSetData(-1, $sSpecList)

$Label2 = GUICtrlCreateLabel("Author", 544, 99, 35, 17)
$setAuthor = GUICtrlCreateCombo($sDefAuth, 580, 96, 130, 25)
    GUICtrlSetData(-1, $sAuthList)

$Label3 = GUICtrlCreateLabel("Sec", 552, 123, 23, 17)
$setSecretary = GUICtrlCreateCombo($sDefSec, 580, 120, 130, 25)
    GUICtrlSetData(-1, $sSecList)

$Button1 = GUICtrlCreateButton("My Recent Clin Docs", 16, 104, 139, 25, 0)
GUICtrlSetOnEvent($Button1, "MyRecent")
GUISetState(@SW_SHOW)

$Button2 = GUICtrlCreateButton("Open Patient Folder", 168, 104, 137, 25, 0)
GUICtrlSetOnEvent($Button2, "Open_Folder")
    GUISetState(@SW_SHOW)

$Button3 = GUICtrlCreateButton("View Patient History", 320, 104, 153, 25, 0)
GUICtrlSetOnEvent($Button3, "browse")
    GUISetState(@SW_SHOW)



$Tab1 = GUICtrlCreateTab(16, 152, 673, 209)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$TabSheet1 = GUICtrlCreateTabItem("Intro")
GUICtrlSetState(-1,$GUI_SHOW)
$IntroLabel = GUICtrlCreateLabel("Set the details in the upper menu", 64, 200, 255, 17)
;GUISetState(@SW_SHOW)

$TabSheet2 = GUICtrlCreateTabItem("Clinic Work")
;GUICtrlSetState(-1,$GUI_SHOW)

$Label4 = GUICtrlCreateLabel("Clinic Date", 64, 200, 55, 17)
$setClinicDate = GuiCtrlCreateDate("Clinic Date",  136, 200, 129, 25)
;GUISetState(@SW_SHOW)

$Label5 = GUICtrlCreateLabel("Clinic Code", 320, 200, 57, 17)
$setClinCode = GUICtrlCreateCombo($DefCode, 392, 200, 121, 25)
GUICtrlSetData(-1, $CodeList)
;GUISetState(@SW_SHOW)

$Button4 = GUICtrlCreateButton("CREATE LETTER", 216, 232, 201, 41, 0)
GUICtrlSetOnEvent($Button4, "Create_PAS")
;GUISetState(@SW_SHOW)

$Button5 = GUICtrlCreateButton("Batch Print Clinic", 40, 288, 113, 41, 0)
GUICtrlSetOnEvent($Button5, "Batch_Print")
;GUISetState(@SW_SHOW)

$input = GUICtrlCreateInput("1", 154, 289, 30, 40)
    $updown = GUICtrlCreateUpdown($input)
    GUICtrlSetLimit($updown,9, 1)
    ;GUISetState(@SW_SHOW)

$Button6 = GUICtrlCreateButton("Batch Verify Clinic", 208, 288, 129, 41, 0)
GUICtrlSetOnEvent($Button6, "Batch_Verify")

$Button7 = GUICtrlCreateButton("E-Mail Clinic List", 352, 288, 129, 41, 0)
GUICtrlSetOnEvent($Button7, "Email")

$Button8 = GUICtrlCreateButton("Batch E-Mail to GPs", 496, 288, 137, 41, 0)
GUICtrlSetOnEvent($Button8, "GP_Email")


$TabSheet3 = GUICtrlCreateTabItem("Patient Letter")

$Button9 = GUICtrlCreateButton("CREATE LETTER", 210, 193, 201, 41, 0)
$Button10 = GUICtrlCreateButton("E-Mail letter ", 48, 296, 169, 33, 0)
$Label6 = GUICtrlCreateLabel("To:", 240, 304, 20, 17)
$Input1 = GUICtrlCreateInput("Input1", 264, 304, 121, 21)
$Checkbox1 = GUICtrlCreateCheckbox("Instant Verify", 584, 336, 97, 17)
$TabSheet3 = GUICtrlCreateTabItem("Referral Letter")
$Checkbox2 = GUICtrlCreateCheckbox("Instant Verify", 582, 334, 97, 17)
$Button11 = GUICtrlCreateButton("CREATE LETTER", 244, 205, 201, 41, 0)
$Button12 = GUICtrlCreateButton("E-Mail letter ", 45, 289, 169, 33, 0)
$Label7 = GUICtrlCreateLabel("To:", 235, 298, 20, 17)
$Input2 = GUICtrlCreateInput("Input2", 264, 296, 145, 21)


$TabSheet4 = GUICtrlCreateTabItem("Import Document")


$Button13 = GUICtrlCreateButton("Browse, Select and Import File", 424, 184, 241, 65, 0)
$Label17 = GUICtrlCreateLabel("OR Drag and Drop", 496, 256, 93, 17)
$Label18 = GUICtrlCreateLabel("into the box below:", 496, 272, 93, 17)
$Label19 = GUICtrlCreateLabel("NHS Number", 24, 200, 67, 17)
$Label20 = GUICtrlCreateLabel("First name", 40, 232, 52, 17)
$Label21 = GUICtrlCreateLabel("Title", 64, 264, 24, 17)
$Label22 = GUICtrlCreateLabel("From", 64, 296, 27, 17)
$Label23 = GUICtrlCreateLabel("To", 272, 296, 17, 17)
$Label24 = GUICtrlCreateLabel("Hospital Number", 208, 200, 82, 17)
$Label25 = GUICtrlCreateLabel("Last name", 232, 240, 53, 17)
$Label26 = GUICtrlCreateLabel("Date of Birth", 224, 272, 63, 17)
$Input12 = GUICtrlCreateInput("Input12", 104, 200, 81, 21)
$Input13 = GUICtrlCreateInput("Input13", 304, 200, 89, 21)
$Input14 = GUICtrlCreateInput("Input14", 104, 232, 81, 21)
$Input15 = GUICtrlCreateInput("Input15", 304, 232, 89, 21)
$Input16 = GUICtrlCreateInput("Input16", 104, 264, 81, 21)
$Input17 = GUICtrlCreateInput("Input17", 304, 264, 89, 21)
$Input18 = GUICtrlCreateInput("Input18", 104, 296, 81, 21)
$Input19 = GUICtrlCreateInput("Input19", 304, 296, 89, 21)
$Label27 = GUICtrlCreateLabel("Drop Here", 472, 296, 150, 41, BitOR($SS_RIGHT,$SS_ETCHEDHORZ,$SS_ETCHEDFRAME))
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0xFFFFFF)


$TabSheet5 = GUICtrlCreateTabItem("E-Mail and Print")

$Button14 = GUICtrlCreateButton("Select and Email Document", 40, 208, 209, 57, 0)
$Label8 = GUICtrlCreateLabel("To:", 128, 272, 20, 17)
$Input3 = GUICtrlCreateInput("Input3", 40, 296, 209, 21)
$Button15 = GUICtrlCreateButton("Select and Print (from Recent Docs)", 280, 208, 193, 57, 0)
$Button16 = GUICtrlCreateButton("Select and Print (from all files)", 488, 208, 185, 57, 0)



$TabSheet6 = GUICtrlCreateTabItem("Non-PAS letters")
$Label9 = GUICtrlCreateLabel("This function should be used only as a last resort if PAS is down", 184, 184, 304, 17)
GUICtrlSetColor(-1, 0xFF0000)

;GUICtrlCreateTabItem("")


$setNHSnumber = GUICtrlCreateLabel("NHS_Number", 48, 224, 67, 17)
$Input4 = GUICtrlCreateInput("NHS_Number", 128, 224, 113, 21)
$Label11 = GUICtrlCreateLabel("First name", 64, 256, 52, 17)
$setFirstName = GUICtrlCreateInput("FirstName", 128, 256, 113, 21)
$Label12 = GUICtrlCreateLabel("Title", 80, 288, 24, 17)
$setSalut = GUICtrlCreateInput("Title", 128, 288, 113, 21)
$Label13 = GUICtrlCreateLabel("Recipient", 64, 320, 49, 17)
$setRecipient = GUICtrlCreateInput("Recipient", 128, 320, 113, 21)

$Label14 = GUICtrlCreateLabel("Hospital Number", 280, 224, 82, 17)
$setHSP= GUICtrlCreateInput("Hos_No", 384, 224, 137, 21)
$Label15 = GUICtrlCreateLabel("Last Name", 280, 256, 55, 17)
$setLastName= GUICtrlCreateInput("LastName", 384, 256, 137, 21)
$setDoB = GUICtrlCreateInput("IDoB", 384, 288, 105, 21)

$Create = GUICtrlCreateButton("Create", 568, 224, 97, 105, 0)
GUICtrlSetColor(-1, 0x800000)
GUICtrlSetOnEvent($Create, "Create_data")



GUICtrlCreateLabel("Yeovil District Hospital NHS FT", 105, 534)
GUICtrlCreateLabel("Part of the CDM Suite", 7,553)
GUICtrlCreateLabel("Created by W. R. Saywell", 450, 553)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

; GUI MESSAGE LOOP

While 1

    Sleep (300)
WEnd

Regards,

William

Link to comment
Share on other sites

  • Moderators

saywell,

The main problem is that you never close your Tab definition. You have 2 GUICtrlCreateTabItem("") lines, but both are commented out! :P

With serious multi-tab controls like this, I have always found it best to set the default tab immediately after ending the tab definition - when I do this with your code all seems to work: :)

#include <Word.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <file.au3>
#include <String.au3>
#Include <Array.au3>
;#include <mysql.au3>
#include "ExtMsgBox.au3"
#include <IE.au3>
;#include <SQLite.au3>
;#include <SQLite.dll.au3>
;#Include <Clipboard.au3>
;#include <Process.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <TabConstants.au3>



#include-once

Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode
Opt("WinTitleMatchMode", 2)
Opt("SendCapslockMode",0)


$mainwindow = GUICreate("Clinical Document Manager", 731, 440, 186, 123)

GUICtrlCreateLabel("Yeovil District Hospital NHS FT", 250, 370)
GUICtrlCreateLabel("Part of the CDM Suite", 7,400)
GUICtrlCreateLabel("Created by W. R. Saywell", 600, 400)

Global $toolmenu = GUICtrlCreateMenu ("Tools")
Global $PASitem = GUICtrlCreateMenuItem("Open PAS (Alt-F12)", $toolmenu)
;GUICtrlSetOnEvent($PASitem , "Open_PAS")
Global $CONFIGitem = GUICtrlCreateMenuItem("Configure (F2)", $toolmenu)
;GUICtrlSetOnEvent($CONFIGitem, "Config")
Global $LOGitem = GUICtrlCreateMenuItem("Open Log (Pause)", $toolmenu)
;GUICtrlSetOnEvent($LOGitem, "ViewLog")

Global $helpmenu = GUICtrlCreateMenu ("Help")
Global $helpitem = GUICtrlCreateMenuItem("Help (F1)", $helpmenu)
;GUICtrlSetOnEvent($helpitem, "help")


$Pic1 = GUICtrlCreatePic(@ScriptDir & "\ydhlogo.gif", 520, 0, 193, 36)

;GUICtrlCreateTabItem("")



$setradio10 = GUICtrlCreateRadio("Real Patient Data", 24, 56, 113, 17)
$setradio11 = GUICtrlCreateRadio("Training Environment", 168, 56, 129, 17)
$Group1 = GUICtrlCreateGroup("Select Environment", 16, 40, 297, 49)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Label1 = GUICtrlCreateLabel("Specialty", 531, 78, 47, 17)
$setSpec = GUICtrlCreateCombo("", 580, 75, 130, 25)
;    GUICtrlSetData(-1, $sSpecList)

$Label2 = GUICtrlCreateLabel("Author", 544, 99, 35, 17)
$setAuthor = GUICtrlCreateCombo("", 580, 96, 130, 25)
;    GUICtrlSetData(-1, $sAuthList)

$Label3 = GUICtrlCreateLabel("Sec", 552, 123, 23, 17)
$setSecretary = GUICtrlCreateCombo("", 580, 120, 130, 25)
;    GUICtrlSetData(-1, $sSecList)

$Button1 = GUICtrlCreateButton("My Recent Clin Docs", 16, 104, 139, 25, 0)
;GUICtrlSetOnEvent($Button1, "MyRecent")
GUISetState(@SW_SHOW)

$Button2 = GUICtrlCreateButton("Open Patient Folder", 168, 104, 137, 25, 0)
;GUICtrlSetOnEvent($Button2, "Open_Folder")
    GUISetState(@SW_SHOW)

$Button3 = GUICtrlCreateButton("View Patient History", 320, 104, 153, 25, 0)
;GUICtrlSetOnEvent($Button3, "browse")
    GUISetState(@SW_SHOW)



$Tab1 = GUICtrlCreateTab(16, 152, 673, 209) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Tab Creation
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$TabSheet1 = GUICtrlCreateTabItem("Intro") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Tab 1
;GUICtrlSetState(-1,$GUI_SHOW)
$IntroLabel = GUICtrlCreateLabel("Set the details in the upper menu", 64, 200, 255, 17)
;GUISetState(@SW_SHOW)

$TabSheet2 = GUICtrlCreateTabItem("Clinic Work") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<< Tab 2
;GUICtrlSetState(-1,$GUI_SHOW)

$Label4 = GUICtrlCreateLabel("Clinic Date", 64, 200, 55, 17)
$setClinicDate = GuiCtrlCreateDate("Clinic Date",  136, 200, 129, 25)
;GUISetState(@SW_SHOW)

$Label5 = GUICtrlCreateLabel("Clinic Code", 320, 200, 57, 17)
$setClinCode = GUICtrlCreateCombo("", 392, 200, 121, 25)
;GUICtrlSetData(-1, $CodeList)
;GUISetState(@SW_SHOW)

$Button4 = GUICtrlCreateButton("CREATE LETTER", 216, 232, 201, 41, 0)
;GUICtrlSetOnEvent($Button4, "Create_PAS")
;GUISetState(@SW_SHOW)

$Button5 = GUICtrlCreateButton("Batch Print Clinic", 40, 288, 113, 41, 0)
;GUICtrlSetOnEvent($Button5, "Batch_Print")
;GUISetState(@SW_SHOW)

$input = GUICtrlCreateInput("1", 154, 289, 30, 40)
    $updown = GUICtrlCreateUpdown($input)
    GUICtrlSetLimit($updown,9, 1)
    ;GUISetState(@SW_SHOW)

$Button6 = GUICtrlCreateButton("Batch Verify Clinic", 208, 288, 129, 41, 0)
;GUICtrlSetOnEvent($Button6, "Batch_Verify")

$Button7 = GUICtrlCreateButton("E-Mail Clinic List", 352, 288, 129, 41, 0)
;GUICtrlSetOnEvent($Button7, "Email")

$Button8 = GUICtrlCreateButton("Batch E-Mail to GPs", 496, 288, 137, 41, 0)
;GUICtrlSetOnEvent($Button8, "GP_Email")


$TabSheet3 = GUICtrlCreateTabItem("Patient Letter") ; <<<<<<<<<<<<<<<<<<<<<<<<<<< Tab 3

$Button9 = GUICtrlCreateButton("CREATE LETTER", 210, 193, 201, 41, 0)
$Button10 = GUICtrlCreateButton("E-Mail letter ", 48, 296, 169, 33, 0)
$Label6 = GUICtrlCreateLabel("To:", 240, 304, 20, 17)
$Input1 = GUICtrlCreateInput("Input1", 264, 304, 121, 21)
$Checkbox1 = GUICtrlCreateCheckbox("Instant Verify", 584, 336, 97, 17)
#cs
$TabSheet3 = GUICtrlCreateTabItem("Referral Letter") ; <<<<<<<<<<<<<<<<<<<<<<<<< Is this a tab that has been misnumbered?
$Checkbox2 = GUICtrlCreateCheckbox("Instant Verify", 582, 334, 97, 17)
$Button11 = GUICtrlCreateButton("CREATE LETTER", 244, 205, 201, 41, 0)
$Button12 = GUICtrlCreateButton("E-Mail letter ", 45, 289, 169, 33, 0)
$Label7 = GUICtrlCreateLabel("To:", 235, 298, 20, 17)
$Input2 = GUICtrlCreateInput("Input2", 264, 296, 145, 21)
#ce

$TabSheet4 = GUICtrlCreateTabItem("Import Document") ; <<<<<<<<<<<<<<<<<<<<<<<<<< Tab 4


$Button13 = GUICtrlCreateButton("Browse, Select and Import File", 424, 184, 241, 65, 0)
$Label17 = GUICtrlCreateLabel("OR Drag and Drop", 496, 256, 93, 17)
$Label18 = GUICtrlCreateLabel("into the box below:", 496, 272, 93, 17)
$Label19 = GUICtrlCreateLabel("NHS Number", 24, 200, 67, 17)
$Label20 = GUICtrlCreateLabel("First name", 40, 232, 52, 17)
$Label21 = GUICtrlCreateLabel("Title", 64, 264, 24, 17)
$Label22 = GUICtrlCreateLabel("From", 64, 296, 27, 17)
$Label23 = GUICtrlCreateLabel("To", 272, 296, 17, 17)
$Label24 = GUICtrlCreateLabel("Hospital Number", 208, 200, 82, 17)
$Label25 = GUICtrlCreateLabel("Last name", 232, 240, 53, 17)
$Label26 = GUICtrlCreateLabel("Date of Birth", 224, 272, 63, 17)
$Input12 = GUICtrlCreateInput("Input12", 104, 200, 81, 21)
$Input13 = GUICtrlCreateInput("Input13", 304, 200, 89, 21)
$Input14 = GUICtrlCreateInput("Input14", 104, 232, 81, 21)
$Input15 = GUICtrlCreateInput("Input15", 304, 232, 89, 21)
$Input16 = GUICtrlCreateInput("Input16", 104, 264, 81, 21)
$Input17 = GUICtrlCreateInput("Input17", 304, 264, 89, 21)
$Input18 = GUICtrlCreateInput("Input18", 104, 296, 81, 21)
$Input19 = GUICtrlCreateInput("Input19", 304, 296, 89, 21)
$Label27 = GUICtrlCreateLabel("Drop Here", 472, 296, 150, 41, BitOR($SS_RIGHT,$SS_ETCHEDHORZ,$SS_ETCHEDFRAME))
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0xFFFFFF)


$TabSheet5 = GUICtrlCreateTabItem("E-Mail and Print") ; <<<<<<<<<<<<<<<<<<<<<<<<<< Tab 5

$Button14 = GUICtrlCreateButton("Select and Email Document", 40, 208, 209, 57, 0)
$Label8 = GUICtrlCreateLabel("To:", 128, 272, 20, 17)
$Input3 = GUICtrlCreateInput("Input3", 40, 296, 209, 21)
$Button15 = GUICtrlCreateButton("Select and Print (from Recent Docs)", 280, 208, 193, 57, 0)
$Button16 = GUICtrlCreateButton("Select and Print (from all files)", 488, 208, 185, 57, 0)



$TabSheet6 = GUICtrlCreateTabItem("Non-PAS letters") ; <<<<<<<<<<<<<<<<<<<<<<<<<<< Tab 6
$Label9 = GUICtrlCreateLabel("This function should be used only as a last resort if PAS is down", 184, 184, 304, 17)
GUICtrlSetColor(-1, 0xFF0000)

;GUICtrlCreateTabItem("")


$setNHSnumber = GUICtrlCreateLabel("NHS_Number", 48, 224, 67, 17)
$Input4 = GUICtrlCreateInput("NHS_Number", 128, 224, 113, 21)
$Label11 = GUICtrlCreateLabel("First name", 64, 256, 52, 17)
$setFirstName = GUICtrlCreateInput("FirstName", 128, 256, 113, 21)
$Label12 = GUICtrlCreateLabel("Title", 80, 288, 24, 17)
$setSalut = GUICtrlCreateInput("Title", 128, 288, 113, 21)
$Label13 = GUICtrlCreateLabel("Recipient", 64, 320, 49, 17)
$setRecipient = GUICtrlCreateInput("Recipient", 128, 320, 113, 21)

$Label14 = GUICtrlCreateLabel("Hospital Number", 280, 224, 82, 17)
$setHSP= GUICtrlCreateInput("Hos_No", 384, 224, 137, 21)
$Label15 = GUICtrlCreateLabel("Last Name", 280, 256, 55, 17)
$setLastName= GUICtrlCreateInput("LastName", 384, 256, 137, 21)
$setDoB = GUICtrlCreateInput("IDoB", 384, 288, 105, 21)

$Create = GUICtrlCreateButton("Create", 568, 224, 97, 105, 0)
GUICtrlSetColor(-1, 0x800000)
;GUICtrlSetOnEvent($Create, "Create_data")

GUICtrlCreateTabItem("") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end tabitem definition

GUICtrlSetState($TabSheet1, $GUI_SHOW)

GUICtrlCreateLabel("Yeovil District Hospital NHS FT", 105, 534)
GUICtrlCreateLabel("Part of the CDM Suite", 7,553)
GUICtrlCreateLabel("Created by W. R. Saywell", 450, 553)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


;GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

; GUI MESSAGE LOOP

While 1

    Sleep (300)
WEnd

I had to comment out a fair anount of your code to get it to run, but the basics are still there and it is easy to reset.

Note that you have 2 TabSheet3 definitions - I was not sure if you wanted an extra tab in there or not. ;)

Glad to see you are using my ExtMsgBox UDF. o:)

All clear? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

saywell,

The main problem is that you never close your Tab definition. You have 2 GUICtrlCreateTabItem("") lines, but both are commented out! :P

With serious multi-tab controls like this, I have always found it best to set the default tab immediately after ending the tab definition - when I do this with your code all seems to work: :)

#include <Word.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <file.au3>
#include <String.au3>
#Include <Array.au3>
;#include <mysql.au3>
#include "ExtMsgBox.au3"
#include <IE.au3>
;#include <SQLite.au3>
;#include <SQLite.dll.au3>
;#Include <Clipboard.au3>
;#include <Process.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <TabConstants.au3>



#include-once

Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode
Opt("WinTitleMatchMode", 2)
Opt("SendCapslockMode",0)


$mainwindow = GUICreate("Clinical Document Manager", 731, 440, 186, 123)

GUICtrlCreateLabel("Yeovil District Hospital NHS FT", 250, 370)
GUICtrlCreateLabel("Part of the CDM Suite", 7,400)
GUICtrlCreateLabel("Created by W. R. Saywell", 600, 400)

Global $toolmenu = GUICtrlCreateMenu ("Tools")
Global $PASitem = GUICtrlCreateMenuItem("Open PAS (Alt-F12)", $toolmenu)
;GUICtrlSetOnEvent($PASitem , "Open_PAS")
Global $CONFIGitem = GUICtrlCreateMenuItem("Configure (F2)", $toolmenu)
;GUICtrlSetOnEvent($CONFIGitem, "Config")
Global $LOGitem = GUICtrlCreateMenuItem("Open Log (Pause)", $toolmenu)
;GUICtrlSetOnEvent($LOGitem, "ViewLog")

Global $helpmenu = GUICtrlCreateMenu ("Help")
Global $helpitem = GUICtrlCreateMenuItem("Help (F1)", $helpmenu)
;GUICtrlSetOnEvent($helpitem, "help")


$Pic1 = GUICtrlCreatePic(@ScriptDir & "\ydhlogo.gif", 520, 0, 193, 36)

;GUICtrlCreateTabItem("")



$setradio10 = GUICtrlCreateRadio("Real Patient Data", 24, 56, 113, 17)
$setradio11 = GUICtrlCreateRadio("Training Environment", 168, 56, 129, 17)
$Group1 = GUICtrlCreateGroup("Select Environment", 16, 40, 297, 49)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Label1 = GUICtrlCreateLabel("Specialty", 531, 78, 47, 17)
$setSpec = GUICtrlCreateCombo("", 580, 75, 130, 25)
;    GUICtrlSetData(-1, $sSpecList)

$Label2 = GUICtrlCreateLabel("Author", 544, 99, 35, 17)
$setAuthor = GUICtrlCreateCombo("", 580, 96, 130, 25)
;    GUICtrlSetData(-1, $sAuthList)

$Label3 = GUICtrlCreateLabel("Sec", 552, 123, 23, 17)
$setSecretary = GUICtrlCreateCombo("", 580, 120, 130, 25)
;    GUICtrlSetData(-1, $sSecList)

$Button1 = GUICtrlCreateButton("My Recent Clin Docs", 16, 104, 139, 25, 0)
;GUICtrlSetOnEvent($Button1, "MyRecent")
GUISetState(@SW_SHOW)

$Button2 = GUICtrlCreateButton("Open Patient Folder", 168, 104, 137, 25, 0)
;GUICtrlSetOnEvent($Button2, "Open_Folder")
    GUISetState(@SW_SHOW)

$Button3 = GUICtrlCreateButton("View Patient History", 320, 104, 153, 25, 0)
;GUICtrlSetOnEvent($Button3, "browse")
    GUISetState(@SW_SHOW)



$Tab1 = GUICtrlCreateTab(16, 152, 673, 209) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Tab Creation
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$TabSheet1 = GUICtrlCreateTabItem("Intro") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Tab 1
;GUICtrlSetState(-1,$GUI_SHOW)
$IntroLabel = GUICtrlCreateLabel("Set the details in the upper menu", 64, 200, 255, 17)
;GUISetState(@SW_SHOW)

$TabSheet2 = GUICtrlCreateTabItem("Clinic Work") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<< Tab 2
;GUICtrlSetState(-1,$GUI_SHOW)

$Label4 = GUICtrlCreateLabel("Clinic Date", 64, 200, 55, 17)
$setClinicDate = GuiCtrlCreateDate("Clinic Date",  136, 200, 129, 25)
;GUISetState(@SW_SHOW)

$Label5 = GUICtrlCreateLabel("Clinic Code", 320, 200, 57, 17)
$setClinCode = GUICtrlCreateCombo("", 392, 200, 121, 25)
;GUICtrlSetData(-1, $CodeList)
;GUISetState(@SW_SHOW)

$Button4 = GUICtrlCreateButton("CREATE LETTER", 216, 232, 201, 41, 0)
;GUICtrlSetOnEvent($Button4, "Create_PAS")
;GUISetState(@SW_SHOW)

$Button5 = GUICtrlCreateButton("Batch Print Clinic", 40, 288, 113, 41, 0)
;GUICtrlSetOnEvent($Button5, "Batch_Print")
;GUISetState(@SW_SHOW)

$input = GUICtrlCreateInput("1", 154, 289, 30, 40)
    $updown = GUICtrlCreateUpdown($input)
    GUICtrlSetLimit($updown,9, 1)
    ;GUISetState(@SW_SHOW)

$Button6 = GUICtrlCreateButton("Batch Verify Clinic", 208, 288, 129, 41, 0)
;GUICtrlSetOnEvent($Button6, "Batch_Verify")

$Button7 = GUICtrlCreateButton("E-Mail Clinic List", 352, 288, 129, 41, 0)
;GUICtrlSetOnEvent($Button7, "Email")

$Button8 = GUICtrlCreateButton("Batch E-Mail to GPs", 496, 288, 137, 41, 0)
;GUICtrlSetOnEvent($Button8, "GP_Email")


$TabSheet3 = GUICtrlCreateTabItem("Patient Letter") ; <<<<<<<<<<<<<<<<<<<<<<<<<<< Tab 3

$Button9 = GUICtrlCreateButton("CREATE LETTER", 210, 193, 201, 41, 0)
$Button10 = GUICtrlCreateButton("E-Mail letter ", 48, 296, 169, 33, 0)
$Label6 = GUICtrlCreateLabel("To:", 240, 304, 20, 17)
$Input1 = GUICtrlCreateInput("Input1", 264, 304, 121, 21)
$Checkbox1 = GUICtrlCreateCheckbox("Instant Verify", 584, 336, 97, 17)
#cs
$TabSheet3 = GUICtrlCreateTabItem("Referral Letter") ; <<<<<<<<<<<<<<<<<<<<<<<<< Is this a tab that has been misnumbered?
$Checkbox2 = GUICtrlCreateCheckbox("Instant Verify", 582, 334, 97, 17)
$Button11 = GUICtrlCreateButton("CREATE LETTER", 244, 205, 201, 41, 0)
$Button12 = GUICtrlCreateButton("E-Mail letter ", 45, 289, 169, 33, 0)
$Label7 = GUICtrlCreateLabel("To:", 235, 298, 20, 17)
$Input2 = GUICtrlCreateInput("Input2", 264, 296, 145, 21)
#ce

$TabSheet4 = GUICtrlCreateTabItem("Import Document") ; <<<<<<<<<<<<<<<<<<<<<<<<<< Tab 4


$Button13 = GUICtrlCreateButton("Browse, Select and Import File", 424, 184, 241, 65, 0)
$Label17 = GUICtrlCreateLabel("OR Drag and Drop", 496, 256, 93, 17)
$Label18 = GUICtrlCreateLabel("into the box below:", 496, 272, 93, 17)
$Label19 = GUICtrlCreateLabel("NHS Number", 24, 200, 67, 17)
$Label20 = GUICtrlCreateLabel("First name", 40, 232, 52, 17)
$Label21 = GUICtrlCreateLabel("Title", 64, 264, 24, 17)
$Label22 = GUICtrlCreateLabel("From", 64, 296, 27, 17)
$Label23 = GUICtrlCreateLabel("To", 272, 296, 17, 17)
$Label24 = GUICtrlCreateLabel("Hospital Number", 208, 200, 82, 17)
$Label25 = GUICtrlCreateLabel("Last name", 232, 240, 53, 17)
$Label26 = GUICtrlCreateLabel("Date of Birth", 224, 272, 63, 17)
$Input12 = GUICtrlCreateInput("Input12", 104, 200, 81, 21)
$Input13 = GUICtrlCreateInput("Input13", 304, 200, 89, 21)
$Input14 = GUICtrlCreateInput("Input14", 104, 232, 81, 21)
$Input15 = GUICtrlCreateInput("Input15", 304, 232, 89, 21)
$Input16 = GUICtrlCreateInput("Input16", 104, 264, 81, 21)
$Input17 = GUICtrlCreateInput("Input17", 304, 264, 89, 21)
$Input18 = GUICtrlCreateInput("Input18", 104, 296, 81, 21)
$Input19 = GUICtrlCreateInput("Input19", 304, 296, 89, 21)
$Label27 = GUICtrlCreateLabel("Drop Here", 472, 296, 150, 41, BitOR($SS_RIGHT,$SS_ETCHEDHORZ,$SS_ETCHEDFRAME))
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0xFFFFFF)


$TabSheet5 = GUICtrlCreateTabItem("E-Mail and Print") ; <<<<<<<<<<<<<<<<<<<<<<<<<< Tab 5

$Button14 = GUICtrlCreateButton("Select and Email Document", 40, 208, 209, 57, 0)
$Label8 = GUICtrlCreateLabel("To:", 128, 272, 20, 17)
$Input3 = GUICtrlCreateInput("Input3", 40, 296, 209, 21)
$Button15 = GUICtrlCreateButton("Select and Print (from Recent Docs)", 280, 208, 193, 57, 0)
$Button16 = GUICtrlCreateButton("Select and Print (from all files)", 488, 208, 185, 57, 0)



$TabSheet6 = GUICtrlCreateTabItem("Non-PAS letters") ; <<<<<<<<<<<<<<<<<<<<<<<<<<< Tab 6
$Label9 = GUICtrlCreateLabel("This function should be used only as a last resort if PAS is down", 184, 184, 304, 17)
GUICtrlSetColor(-1, 0xFF0000)

;GUICtrlCreateTabItem("")


$setNHSnumber = GUICtrlCreateLabel("NHS_Number", 48, 224, 67, 17)
$Input4 = GUICtrlCreateInput("NHS_Number", 128, 224, 113, 21)
$Label11 = GUICtrlCreateLabel("First name", 64, 256, 52, 17)
$setFirstName = GUICtrlCreateInput("FirstName", 128, 256, 113, 21)
$Label12 = GUICtrlCreateLabel("Title", 80, 288, 24, 17)
$setSalut = GUICtrlCreateInput("Title", 128, 288, 113, 21)
$Label13 = GUICtrlCreateLabel("Recipient", 64, 320, 49, 17)
$setRecipient = GUICtrlCreateInput("Recipient", 128, 320, 113, 21)

$Label14 = GUICtrlCreateLabel("Hospital Number", 280, 224, 82, 17)
$setHSP= GUICtrlCreateInput("Hos_No", 384, 224, 137, 21)
$Label15 = GUICtrlCreateLabel("Last Name", 280, 256, 55, 17)
$setLastName= GUICtrlCreateInput("LastName", 384, 256, 137, 21)
$setDoB = GUICtrlCreateInput("IDoB", 384, 288, 105, 21)

$Create = GUICtrlCreateButton("Create", 568, 224, 97, 105, 0)
GUICtrlSetColor(-1, 0x800000)
;GUICtrlSetOnEvent($Create, "Create_data")

GUICtrlCreateTabItem("") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end tabitem definition

GUICtrlSetState($TabSheet1, $GUI_SHOW)

GUICtrlCreateLabel("Yeovil District Hospital NHS FT", 105, 534)
GUICtrlCreateLabel("Part of the CDM Suite", 7,553)
GUICtrlCreateLabel("Created by W. R. Saywell", 450, 553)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


;GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

; GUI MESSAGE LOOP

While 1

    Sleep (300)
WEnd

I had to comment out a fair anount of your code to get it to run, but the basics are still there and it is easy to reset.

Note that you have 2 TabSheet3 definitions - I was not sure if you wanted an extra tab in there or not. ;)

Glad to see you are using my ExtMsgBox UDF. o:)

All clear? ;)

M23

Thanks.

I'm stuck in meetings all day so I'll give it a try tonight.

The second tab sheet 3 was unintentional - I obviously need counting lessns!

The commented out GUICtrlCreateTabItem("") are there because when I tried them, I got even more bizzare results.

Many thas for your helpful reply which I hope will solve my problems! It's the first time I've used tabs.

The ExtMsgBox UDF is great - without it I'd be floundering in 2 areas of functionality - so thanks for that, too.

Regards,

William

Link to comment
Share on other sites

  • Moderators

saywell,

Delighted I could help. ;)

I hope you get the rest of the conversion to work - you know where we are if you run into problems. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...