Form hanging out when opened in main.pb file

You need some new stunning features ? Tell us here.
QBS
New User
New User
Posts: 7
Joined: Sun Apr 07, 2013 7:59 am

Form hanging out when opened in main.pb file

Post by QBS »

I made a form in integrated Form Designer. It works perfectly when compiling and running the Form.pbf. I have included it in main.pb file with xIncludeFile and tried to open with OpenForm ()
Result --- LoaDING SOME 50% OF THE FORM AND HANGS OUT.
What I am doing wrong ????????
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form hanging out when opened in main.pb file

Post by Polo »

Hard to tell without any code, turn the debugger on and see what it says :)
QBS
New User
New User
Posts: 7
Joined: Sun Apr 07, 2013 7:59 am

Re: Form hanging out when opened in main.pb file

Post by QBS »

I made an experiment ----- copy/pasted the code of the form in main.pb ---- the same --HANGING!!!! While compiled and run in form.pbf --all is OK. I have tried to find the functions that may HANG my form and started to comment some code lines///// The surpeise was that form designer removed that lines ----- very strange ... I start to hate it)))))
QBS
New User
New User
Posts: 7
Joined: Sun Apr 07, 2013 7:59 am

Re: Form hanging out when opened in main.pb file

Post by QBS »

Another surprise !!!!! I tried to debug the code in form.pbf ----- no chance !!!! HANGING on second line !!!! iMPOSSIBLE TO TRACE THE CODE GENERATED BY FORM DESIGNER _))))))))))))))
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form hanging out when opened in main.pb file

Post by Polo »

Copy and paste the .pbf source code and your .pb source code so I can help!
User avatar
Kiffi
Addict
Addict
Posts: 1502
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: Form hanging out when opened in main.pb file

Post by Kiffi »

<OT>
Terry Pratchett wrote:And all those exclamation marks, you notice? Five? A sure sign of someone who wears his underpants on his head.
</OT>
Hygge
QBS
New User
New User
Posts: 7
Joined: Sun Apr 07, 2013 7:59 am

Re: Form hanging out when opened in main.pb file

Post by QBS »

I really don't know where Enthusiast is wearing his underpants - up to him ...

Polo , thank You. The code is too big to paste it here . But I will try.
The code was generated by integrated Form Designer. I have changed only names of variables.

Thank You!!
Global MainForm

Global txtP1, txtP2, imgfL, imgfL_100, imgfR_100, imgfR, btnPause, btnStop, btnStart, btnConnect, txtDataBuff, btnPPControl, imgConnectOK, imgStartOn, txtNSCaption, txtNSValue, txtNSCaption_Copy1, txtNSCaption_Copy2, txtNSCaption_Copy3, txtNSCaption_Copy4, txtNSCaption_Copy5, txtNSCaption_Copy7, txtNSCaption_Copy8, txtNSCaption_Copy9, txtNSCaption_Copy10, txtVVDalue, txtDRValue, txtTLValue, txtTRValue, txtLUValue, txtLDValue, txtRUValue, txtRDValue, txtACValue, Text_NSC, StrNS_Set, StrMAX_Set, Text_MP, Text_P, StrTO_Set, StrTC_Set, Text_OTC, Text_TCC, Text_HMC, StrHM_Set, StrPP_Set, Text_PPC, Text_LCC, Text_LCC_T, Text_LCC_TL, Text_LCC_TR, StrLDLtmr_Set, StrLDRtmr_Set, Text_LCC_T_Copy1, Text_LCC_TL_Copy1, Text_LCC_TR_Copy1, StrLDLcnt_Set, StrLDRcnt_Set, OptionLDL_tmr, OptionLDL_cnt, StrLDLtmr_Set_Copy3, btnSet_Val_Accept, txtDataBuff

Global Img_0, Img_1, Img_2, Img_3, Img_4, Img_5, Img_6, Img_7

UsePNGImageDecoder()

Img_0 = LoadImage(#PB_Any,"C:\Documents and Settings\QBS\Рабочий стол\PureBasic\aquaballgreen_4882____60proc.png")
Img_1 = LoadImage(#PB_Any,"C:\Documents and Settings\QBS\Рабочий стол\ButtonIMG\box_red_1433.ico")
Img_2 = LoadImage(#PB_Any,"C:\Documents and Settings\QBS\Рабочий стол\ButtonIMG\glossy_blue_button_30_50_60.png")
Img_3 = LoadImage(#PB_Any,"C:\Documents and Settings\QBS\Рабочий стол\ButtonIMG\radar_10.png")
Img_4 = LoadImage(#PB_Any,"C:\Documents and Settings\QBS\Рабочий стол\ButtonIMG\arrow_button_12.png")
Img_5 = LoadImage(#PB_Any,"C:\Documents and Settings\QBS\Рабочий стол\ButtonIMG\glossy_blue_button_30_50_70.png")
Img_6 = LoadImage(#PB_Any,"C:\Documents and Settings\QBS\Рабочий стол\ButtonIMG\GreenNarowLamp.png")
Img_7 = LoadImage(#PB_Any,"C:\Documents and Settings\QBS\Рабочий стол\ButtonIMG\buttonAccept_20.PNG")

Enumeration #PB_Compiler_EnumerationValue
#Font_0
#Font_1
#Font_2
#Font_3
#Font_4
#Font_5
#Font_6
EndEnumeration

LoadFont(#Font_0,"Arial Black", 72, #PB_Font_Bold)
LoadFont(#Font_1,"Arial Black", 22, #PB_Font_Bold)
LoadFont(#Font_2,"Arial Black", 12, #PB_Font_Bold)
LoadFont(#Font_3,"Arial Black", 14, #PB_Font_Bold)
LoadFont(#Font_4,"Arial Unicode MS", 10, #PB_Font_Bold)
LoadFont(#Font_5,"Arial Unicode MS", 11, #PB_Font_Bold)
LoadFont(#Font_6,"Arial Unicode MS", 8, #PB_Font_Bold)


Procedure OpenMainForm()
MainForm = OpenWindow(#PB_Any, 0, 0, 1000, 600, "", #PB_Window_MaximizeGadget | #PB_Window_Maximize)
txtP1 = TextGadget(#PB_Any, 10, 10, 220, 170, "233", #PB_Text_Center | #PB_Text_Border)
SetGadgetColor(txtP1, #PB_Gadget_BackColor,RGB(255,255,255))
SetGadgetFont(txtP1, FontID(#Font_0))
txtP2 = TextGadget(#PB_Any, 260, 10, 220, 170, "233", #PB_Text_Center | #PB_Text_Border)
SetGadgetColor(txtP2, #PB_Gadget_BackColor,RGB(255,255,255))
SetGadgetFont(txtP2, FontID(#Font_0))
imgfL = ImageGadget(#PB_Any, 20, 200, 90, 100, ImageID(Img_0))
imgfL_100 = ImageGadget(#PB_Any, 120, 200, 90, 100, ImageID(Img_0))
imgfR_100 = ImageGadget(#PB_Any, 280, 200, 90, 100, ImageID(Img_0))
imgfR = ImageGadget(#PB_Any, 380, 200, 90, 100, ImageID(Img_0))
btnPause = ButtonImageGadget(#PB_Any, 500, 450, 230, 80, ImageID(Img_5), #PB_Button_Toggle)
SetGadgetFont(btnPause, FontID(#Font_1))
btnStop = ButtonImageGadget(#PB_Any, 860, 410, 128, 128, ImageID(Img_1))
SetGadgetFont(btnStop, FontID(#Font_1))
btnStart = ButtonImageGadget(#PB_Any, 210, 450, 250, 80, ImageID(Img_4))
SetGadgetFont(btnStart, FontID(#Font_1))
btnConnect = ButtonImageGadget(#PB_Any, 20, 450, 150, 80, ImageID(Img_3))
SetGadgetFont(btnConnect, FontID(#Font_1))
txtDataBuff = TextGadget(#PB_Any, 10, 300, 260, 120, "")
btnPPControl = ButtonImageGadget(#PB_Any, 750, 450, 90, 80, ImageID(Img_2), #PB_Button_Toggle)
SetGadgetFont(btnPPControl, FontID(#Font_1))
imgConnectOK = ImageGadget(#PB_Any, 20, 430, 140, 16, ImageID(Img_6))
imgStartOn = ImageGadget(#PB_Any, 260, 430, 140, 16, ImageID(Img_6))
txtNSCaption = TextGadget(#PB_Any, 510, 10, 40, 30, "NS", #PB_Text_Center | #PB_Text_Border)
SetGadgetFont(txtNSCaption, FontID(#Font_2))
txtNSValue = TextGadget(#PB_Any, 510, 40, 40, 30, "1", #PB_Text_Center | #PB_Text_Border)
SetGadgetColor(txtNSValue, #PB_Gadget_BackColor,RGB(255,255,255))
SetGadgetFont(txtNSValue, FontID(#Font_3))
txtNSCaption_Copy1 = TextGadget(#PB_Any, 560, 10, 40, 30, "VD", #PB_Text_Center | #PB_Text_Border)
SetGadgetFont(txtNSCaption_Copy1, FontID(#Font_2))
txtNSCaption_Copy2 = TextGadget(#PB_Any, 610, 10, 40, 30, "DR", #PB_Text_Center | #PB_Text_Border)
SetGadgetFont(txtNSCaption_Copy2, FontID(#Font_2))
txtNSCaption_Copy3 = TextGadget(#PB_Any, 660, 10, 40, 30, "TL", #PB_Text_Center | #PB_Text_Border)
SetGadgetFont(txtNSCaption_Copy3, FontID(#Font_2))
txtNSCaption_Copy4 = TextGadget(#PB_Any, 710, 10, 40, 30, "TR", #PB_Text_Center | #PB_Text_Border)
SetGadgetFont(txtNSCaption_Copy4, FontID(#Font_2))
txtNSCaption_Copy5 = TextGadget(#PB_Any, 510, 80, 40, 30, "LU", #PB_Text_Center | #PB_Text_Border)
SetGadgetFont(txtNSCaption_Copy5, FontID(#Font_2))
txtNSCaption_Copy7 = TextGadget(#PB_Any, 560, 80, 40, 30, "LD", #PB_Text_Center | #PB_Text_Border)
SetGadgetFont(txtNSCaption_Copy7, FontID(#Font_2))
txtNSCaption_Copy8 = TextGadget(#PB_Any, 610, 80, 40, 30, "RU", #PB_Text_Center | #PB_Text_Border)
SetGadgetFont(txtNSCaption_Copy8, FontID(#Font_2))
txtNSCaption_Copy9 = TextGadget(#PB_Any, 660, 80, 40, 30, "RD", #PB_Text_Center | #PB_Text_Border)
SetGadgetFont(txtNSCaption_Copy9, FontID(#Font_2))
txtNSCaption_Copy10 = TextGadget(#PB_Any, 710, 80, 40, 30, "AC", #PB_Text_Center | #PB_Text_Border)
SetGadgetFont(txtNSCaption_Copy10, FontID(#Font_2))
txtVVDalue = TextGadget(#PB_Any, 560, 40, 40, 30, "1", #PB_Text_Center | #PB_Text_Border)
SetGadgetColor(txtVVDalue, #PB_Gadget_BackColor,RGB(255,255,255))
SetGadgetFont(txtVVDalue, FontID(#Font_3))
txtDRValue = TextGadget(#PB_Any, 610, 40, 40, 30, "1", #PB_Text_Center | #PB_Text_Border)
SetGadgetColor(txtDRValue, #PB_Gadget_BackColor,RGB(255,255,255))
SetGadgetFont(txtDRValue, FontID(#Font_3))
txtTLValue = TextGadget(#PB_Any, 660, 40, 40, 30, "1", #PB_Text_Center | #PB_Text_Border)
SetGadgetColor(txtTLValue, #PB_Gadget_BackColor,RGB(255,255,255))
SetGadgetFont(txtTLValue, FontID(#Font_3))
txtTRValue = TextGadget(#PB_Any, 710, 40, 40, 30, "1", #PB_Text_Center | #PB_Text_Border)
SetGadgetColor(txtTRValue, #PB_Gadget_BackColor,RGB(255,255,255))
SetGadgetFont(txtTRValue, FontID(#Font_3))
txtLUValue = TextGadget(#PB_Any, 510, 110, 40, 30, "1", #PB_Text_Center | #PB_Text_Border)
SetGadgetColor(txtLUValue, #PB_Gadget_BackColor,RGB(255,255,255))
SetGadgetFont(txtLUValue, FontID(#Font_3))
txtLDValue = TextGadget(#PB_Any, 560, 110, 40, 30, "1", #PB_Text_Center | #PB_Text_Border)
SetGadgetColor(txtLDValue, #PB_Gadget_BackColor,RGB(255,255,255))
SetGadgetFont(txtLDValue, FontID(#Font_3))
txtRUValue = TextGadget(#PB_Any, 610, 110, 40, 30, "1", #PB_Text_Center | #PB_Text_Border)
SetGadgetColor(txtRUValue, #PB_Gadget_BackColor,RGB(255,255,255))
SetGadgetFont(txtRUValue, FontID(#Font_3))
txtRDValue = TextGadget(#PB_Any, 660, 110, 40, 30, "1", #PB_Text_Center | #PB_Text_Border)
SetGadgetColor(txtRDValue, #PB_Gadget_BackColor,RGB(255,255,255))
SetGadgetFont(txtRDValue, FontID(#Font_3))
txtACValue = TextGadget(#PB_Any, 710, 110, 40, 30, "1", #PB_Text_Center | #PB_Text_Border)
SetGadgetColor(txtACValue, #PB_Gadget_BackColor,RGB(255,255,255))
SetGadgetFont(txtACValue, FontID(#Font_3))
Text_NSC = TextGadget(#PB_Any, 520, 230, 110, 20, "МАХ НШ100", #PB_Text_Center)
SetGadgetFont(Text_NSC, FontID(#Font_4))
StrNS_Set = StringGadget(#PB_Any, 630, 220, 60, 30, "80", #PB_String_Numeric)
SetGadgetFont(StrNS_Set, FontID(#Font_3))
StrMAX_Set = StringGadget(#PB_Any, 630, 190, 60, 30, "333", #PB_String_Numeric)
SetGadgetFont(StrMAX_Set, FontID(#Font_3))
Text_MP = TextGadget(#PB_Any, 520, 200, 110, 20, "МАХ", #PB_Text_Center)
SetGadgetFont(Text_MP, FontID(#Font_5))
Text_P = TextGadget(#PB_Any, 540, 160, 110, 20, "ДАВЛЕНИЕ", #PB_Text_Center)
SetGadgetFont(Text_P, FontID(#Font_4))
StrTO_Set = StringGadget(#PB_Any, 630, 250, 60, 30, "150", #PB_String_Numeric)
SetGadgetFont(StrTO_Set, FontID(#Font_3))
StrTC_Set = StringGadget(#PB_Any, 630, 280, 60, 30, "40", #PB_String_Numeric)
SetGadgetFont(StrTC_Set, FontID(#Font_3))
Text_OTC = TextGadget(#PB_Any, 520, 260, 110, 20, "ОТК. Цанги", #PB_Text_Center)
SetGadgetFont(Text_OTC, FontID(#Font_4))
Text_TCC = TextGadget(#PB_Any, 520, 290, 110, 20, "ЗАКР. Цанги", #PB_Text_Center)
SetGadgetFont(Text_TCC, FontID(#Font_4))
Text_HMC = TextGadget(#PB_Any, 520, 320, 110, 20, "Гидромотор", #PB_Text_Center)
SetGadgetFont(Text_HMC, FontID(#Font_4))
StrHM_Set = StringGadget(#PB_Any, 630, 310, 60, 30, "60", #PB_String_Numeric)
SetGadgetFont(StrHM_Set, FontID(#Font_3))
StrPP_Set = StringGadget(#PB_Any, 630, 340, 60, 30, "70", #PB_String_Numeric)
SetGadgetFont(StrPP_Set, FontID(#Font_3))
Text_PPC = TextGadget(#PB_Any, 520, 350, 110, 20, "Подпресс.", #PB_Text_Center)
SetGadgetFont(Text_PPC, FontID(#Font_4))
Text_LCC = TextGadget(#PB_Any, 750, 160, 180, 20, "Управление загрузкой", #PB_Text_Center)
SetGadgetFont(Text_LCC, FontID(#Font_4))
Text_LCC_T = TextGadget(#PB_Any, 710, 180, 120, 20, "По Таймеру", #PB_Text_Center)
SetGadgetFont(Text_LCC_T, FontID(#Font_4))
Text_LCC_TL = TextGadget(#PB_Any, 710, 200, 50, 20, "Левый", #PB_Text_Center)
SetGadgetFont(Text_LCC_TL, FontID(#Font_6))
Text_LCC_TR = TextGadget(#PB_Any, 770, 200, 60, 20, "Правый", #PB_Text_Center)
SetGadgetFont(Text_LCC_TR, FontID(#Font_6))
StrLDLtmr_Set = StringGadget(#PB_Any, 710, 220, 60, 30, "333", #PB_String_Numeric)
SetGadgetFont(StrLDLtmr_Set, FontID(#Font_3))
StrLDRtmr_Set = StringGadget(#PB_Any, 770, 220, 60, 30, "333", #PB_String_Numeric)
SetGadgetFont(StrLDRtmr_Set, FontID(#Font_3))
Text_LCC_T_Copy1 = TextGadget(#PB_Any, 840, 180, 120, 20, "По Счетчику", #PB_Text_Center)
SetGadgetFont(Text_LCC_T_Copy1, FontID(#Font_4))
Text_LCC_TL_Copy1 = TextGadget(#PB_Any, 850, 200, 50, 20, "Левый", #PB_Text_Center)
SetGadgetFont(Text_LCC_TL_Copy1, FontID(#Font_6))
Text_LCC_TR_Copy1 = TextGadget(#PB_Any, 900, 200, 60, 20, "Правый", #PB_Text_Center)
SetGadgetFont(Text_LCC_TR_Copy1, FontID(#Font_6))
StrLDLcnt_Set = StringGadget(#PB_Any, 840, 220, 60, 30, "333", #PB_String_Numeric)
SetGadgetFont(StrLDLcnt_Set, FontID(#Font_3))
StrLDRcnt_Set = StringGadget(#PB_Any, 900, 220, 60, 30, "333", #PB_String_Numeric)
SetGadgetFont(StrLDRcnt_Set, FontID(#Font_3))
OptionLDL_tmr = OptionGadget(#PB_Any, 710, 250, 30, 40, "")
SetGadgetState(OptionLDL_tmr, 1)
OptionLDL_cnt = OptionGadget(#PB_Any, 840, 250, 20, 40, "")
StrLDLtmr_Set_Copy3 = StringGadget(#PB_Any, 770, 220, 60, 30, "333", #PB_String_Numeric)
SetGadgetFont(StrLDLtmr_Set_Copy3, FontID(#Font_3))
btnSet_Val_Accept = ButtonImageGadget(#PB_Any, 890, 330, 90, 50, ImageID(Img_7))
txtDataBuff = TextGadget(#PB_Any, 10, 300, 260, 120, "DataBuff")
EndProcedure
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form hanging out when opened in main.pb file

Post by Polo »

I'm not sure the form designer support characters such as Подпресс, as I think the file is saved in with standard encoding and not utf8.
SniffTheGlove
Enthusiast
Enthusiast
Posts: 122
Joined: Sat Nov 19, 2011 6:51 pm

Re: Form hanging out when opened in main.pb file

Post by SniffTheGlove »

Hi QBS,
It makes things easier if you could use the code tags when posting code as copy and pasting out of webpages sometimes brings out the html as well screwing with the code.

First off I changed your file strings and also use my own png's

I ran you code and everything worked fine and the form loaded up in a few milliseconds with the png's all showing.

I suspect it might be the foreign utf-8 character set that was causing problems as Polo said unless you know that utf-8 encoding currently works fine on your PC
QBS
New User
New User
Posts: 7
Joined: Sun Apr 07, 2013 7:59 am

Re: Form hanging out when opened in main.pb file

Post by QBS »

Thank You for your help. I will check .
Post Reply