|
Post by ensoniq on Nov 17, 2015 0:17:27 GMT 1
Hi GFA'ers,
I've written a program which i'd like to send to members of my family but when I run the compiled program on another computer the result is completely different to what I get on my own computer. Do I have to include code in the program to accomodate different versions of windows or is there another reason?
|
|
|
Post by dragonjim on Nov 17, 2015 21:07:11 GMT 1
Hi ensoniq,
There are a number of reasons why a compiled program may look different, and they could take a while to list. Could you provide some more information such as:
1. Is the difference in the controls (text boxes, combo boxes, etc) in a form? 2. Is the difference in the interior dimensions of the form? 3. Are you using background images? 4. ...and so on.
If you can, can you provide a screenshot of what it is supposed to look like and another of how it actually does?
With some or all of that information, it should make it easier to pinpoint what is going wrong.
|
|
|
Post by ensoniq on Nov 17, 2015 22:17:30 GMT 1
Hi dragonjim, Thanks for your prompt reply. Hereby a couple of screenshots to indicate the problem I'm having. The first is what it should be and the second is what I get on when run on another computer. This is just one example, the other pages in the program give similar results, e.g smaller text, etc. Also program navigation between pages (using inkey$) gives problems; doesn't work or exits the program. For what it's worth I am using Windows Vista and the other computer has XP.
|
|
|
Post by dragonjim on Nov 18, 2015 0:14:06 GMT 1
Interesting...
The fonts are definitely different, which could account for the text being orientated more to the right (and upwards) - is the font you are using in your program one of the Windows defaults? It looks like Windows/GB32 can not find the font you have specified and have replaced it with, possibly, the default MS Dialog. (That's the most likely theory, anyway).
The lines seem to be drawn to similar dimensions on both (although the second is smaller - a smaller resolution and/or screen?), so there doesn't seem to be a problem there.
As for Inkey$ - it's only in GB32 for backwards compatibility and, although it still works (sort of) has been replaced by the Form or Window Events. So, rather than use Inkey$, try using something like this:
Global Dim key% = 0, line% = 2 OpenW Full 1 Print "Press 'p' to print "#34"Hello"#34" or 'x' to close" Do : Sleep : Until key% <> 0 CloseW 1 Sub Win_1_KeyUp(Code&, Shift&) If Code& = 80 Then Print AT(1, line%); "Hello" : Inc line% // 'p' pressed If Code& = 88 Then key% = 1 // 'x' pressed EndSub
I hope the above is helpful; if you still have a problem, let me know.
|
|
|
Post by wrencourt on Nov 18, 2015 0:28:05 GMT 1
Hi dragonjim,
Thanks for your help. I'll have a look tomorrow and let you know how I het on.
|
|
|
Post by troycheek on Nov 18, 2015 3:18:51 GMT 1
This may not make any difference, but the icons in the upper left corners of the GIFs suggest that 1.GIF is from a program running from inside the GB32 IDE, whereas 2.GIF is from a compiled program running separately from the IDE. Some programs behave differently depending on whether they're run from within the IDE or not. Oh, and I don't pretend to understand what this means: XP Visual Styles but it might be applicable.
|
|
|
Post by ensoniq on Nov 18, 2015 16:46:16 GMT 1
Thanks troycheek, that's worth a look into ... I'll let you know.
|
|
|
Post by dragonjim on Nov 18, 2015 21:40:30 GMT 1
Hi,
Just a little info here...
XP Visual Styles: These have now been superseded by other visual styles, but the principal is still the same. Put simply, GB32 uses control objects (ComboBoxes, TextBoxes, etc) through Ocx, which references the old style Windows COM objects - hence, by default, GB32 will display command buttons and option boxes as they appeared in Windows 98. For WinXP (and Vista, 7, 8 and 10), Microsoft created new 'visual styles' for its control objects - i.e. the rounded corners on the command/push button - and to use the most current style, a 'manifest' file needs to be included with all executable files (the IDE displays the up to date control objects due to the manifest file in the program folder).
I would have thought it would be unlikely if this is causing the problems shown above, but you never know.
|
|
|
Post by ensoniq on Nov 18, 2015 23:31:33 GMT 1
It seems that your original solution to the problem is the one I've been looking for. The fonts that I used weren't present on the other computer. So I've changed all the fonts to 'Arial' which seems to be the most common font on all computers, compiled the program and it works fine.
Many thanks dragonjim and also troycheek for your input!
|
|
|
Post by dragonjim on Nov 19, 2015 17:55:59 GMT 1
Pleasure. Glad it turned out nothing serious.
|
|
|
Post by scalion on Apr 11, 2018 21:56:53 GMT 1
Hello, I think the job maybe you have is to fit text in zones who have size changing. Now to do that try fot each text zone : 1) Compute the size of zone (a percentages of screen size i think) 2) Use TextWidth(StringName) to get the size of text to write if Size > zone decrease size of font used and reuse textwidth if Size < zone increase the size and do the same... Until size < 4 or size > Zone (Then dec size and stop tests)
|
|
|
Post by scalion on Apr 12, 2018 8:10:04 GMT 1
With this example of simple fit text to zone you can see what happen hen you resize the window :
Global String Mari = "John Douglas" Global String Femme = "Mary Kilday" Global String MF = Mari & "---" & Femme Global Double ZonePercent = 20 Global Double ZoneCenterX, ZoneCenterY Global Long ZoneW, ZoneH = 30, Tw, Th, x1, y1, x2, y2 OpenW 1 Void SetForegroundWindow(Me.hWnd) Do PeekEvent Loop Until Me Is Nothing Sub Win_1_MouseMove(Button&, Shift&, x!, y!) ZoneCenterX = x ZoneCenterY = y ZoneW = Me.ScaleWidth * ZonePercent / 100 x1 = ZoneCenterX - ZoneW / 2 y1 = ZoneCenterY - ZoneH / 2 x2 = ZoneCenterX + ZoneW / 2 y2 = ZoneCenterY + ZoneH / 2 Cls RGBColor RGB(200, 240, 255) PBox ZoneCenterX - ZoneW / 2, ZoneCenterY - ZoneH / 2, ZoneCenterX + ZoneW / 2, ZoneCenterY + ZoneH / 2 RGBColor 0 GraphMode , TRANSPARENT TextFit MF, x1, y1, x2, y2 EndSub
Proc TextFit(T As String, x1%, y1%, x2%, y2%) Local Long Tw, Th, ZoneW, ZoneH Tw = TextWidth(T) ZoneW = 1 + x2 - x1 ZoneH = 1 + y2 - y1 Do If Tw < ZoneW FontSize = FontSize + 2 : Tw = TextWidth(T) Else If Tw > ZoneW FontSize = FontSize - 2 : Tw = TextWidth(T) Exit If Tw < ZoneW EndIf Loop Until FontSize <= 4 Th = TextHeight(T) Do While Th > ZoneH FontSize = FontSize - 2 : Th = TextHeight(T) Loop Until FontSize <= 4 Text (x1 + x2) / 2 - TextWidth(T) / 2, (y1 + y2) / 2 - Th / 2, T EndProc
|
|